getchar on codeforces

Revision en2, by heyyolol, 2019-07-31 16:18:02

Recently I tried using getchar to take in char input (c++), the sample works fine on my compiler , but got idleness limit exceeded on judge, I tried the code in custom invocation, and it turns out getchar was reading random characters lol. My code is something like

for(int i=0;i<n;++i) for(int j=0;j<n;++j) while(grid[i][j]!='.'&&grid[i][j]!='#') grid[i][j]=getchar()

Does anyone know how to fix this problem? Thank you!! :)

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English heyyolol 2019-07-31 16:18:02 14
en1 English heyyolol 2019-07-31 16:17:07 465 Initial revision (published)