답안 #45037

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
45037 2018-04-11T04:40:25 Z TAMREF Go, Gopher! (GCJ18Q_gogopher) C++17
30 / 30
86 ms 1816 KB
#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

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);
             ~~~~~^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 86 ms 1816 KB Output is correct