Submission #45037

#TimeUsernameProblemLanguageResultExecution timeMemory
45037TAMREFUntitled (GCJ18Q_gogopher)C++17
30 / 30
86 ms1816 KiB
#include <bits/stdc++.h> using namespace std; bool q[21][1005][1005]; inline bool full(int f, int r, int c){ return q[f][r-1][c-1] & q[f][r-1][c] & q[f][r-1][c+1] & q[f][r][c-1] & q[f][r][c] & q[f][r][c+1] & q[f][r+1][c-1] & q[f][r+1][c] & q[f][r+1][c+1]; } int main(){ int T, A; scanf("%d",&T); for(int f = 1; f <= T; f++){ scanf("%d",&A); int cx = 1, cy = 1, xtr = 2, ytr = 2; for(int loop = 1;;++loop){ if(cx == 0 && cy == 0) break; if(cx == -1 && cy == -1){ //fprintf(stderr,"We're doomed\n"); exit(0); } //fprintf(stderr,"%d\n",loop); printf("%d %d\n",xtr,ytr); fflush(stdout); scanf("%d %d",&cx,&cy); q[f][cx][cy] = 1; if(full(f,xtr,ytr)){ xtr += 3; if(xtr > 999){ xtr = 2; ytr += 3; } } } } }

Compilation message (stderr)

gogopher.cpp: In function 'int main()':
gogopher.cpp:9:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int T, A; scanf("%d",&T);
               ~~~~~^~~~~~~~~
gogopher.cpp:11:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&A);
         ~~~~~^~~~~~~~~
gogopher.cpp:22:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d %d",&cx,&cy);
             ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...