제출 #245128

#제출 시각아이디문제언어결과실행 시간메모리
245128TadijaSebez보물 찾기 (CEOI13_treasure2)C++11
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define pii pair<int,int> map<array<int,4>,int> was; int cnt=0,n; int Ask(int xl,int yl,int xr,int yr){ if(was.count({{xl,yl,xr,yr}}))return was[{xl,yl,xr,yr}]; printf("%i %i %i %i\n",xl,yl,xr,yr); fflush(stdout); int b;scanf("%i",&b); was[{xl,yl,xr,yr}]=b; return b; } const int N=105; int sum[N][N],ans[N][N]; int main(){ scanf("%i",&n); int m=n/2; for(int i=m+1+1;i<=n;i++) for(int j=m+1+1;j<=n;j++) ans[i][j]=Ask(1,1,i,j)-Ask(1,1,i-1,j)-Ask(1,1,i,j-1)+Ask(1,1,i-1,j-1); for(int i=m+1+1;i<=n;i++) for(int j=1;j<=m;j++) ans[i][j]=Ask(1,j,i,n)-Ask(1,j+1,i,n)-Ask(1,j,i-1,n)+Ask(1,j+1,i-1,n); for(int i=1;i<=m;i++) for(int j=m+1+1;j<=n;j++) ans[i][j]=Ask(i,1,n,j)-Ask(i+1,1,n,j)-Ask(i,1,n,j-1)+Ask(i+1,1,n,j-1); for(int i=1;i<=m;i++) for(int j=1;j<=m;j++) ans[i][j]=Ask(i,j,n,n)-Ask(i+1,j,n,n)-Ask(i,j+1,n,n)+Ask(i+1,j+1,n,n); for(int i=1;i<=m;i++){ ans[i][m+1]=Ask(i,1,n,n)-Ask(i+1,1,n,n); for(int j=1;j<=n;j++)if(j!=m+1)ans[i][m+1]-=ans[i][j]; } for(int i=n;i>m+1;i--){ ans[i][m+1]=Ask(1,1,i,n)-Ask(1,1,i-1,n); for(int j=1;j<=n;j++)if(j!=m+1)ans[i][m+1]-=ans[i][j]; } for(int j=1;j<=m;j++){ ans[m+1][j]=Ask(1,j,n,n)-Ask(1,j+1,n,n); for(int i=1;i<=n;i++)if(i!=m+1)ans[m+1][j]-=ans[i][j]; } for(int j=n;j>m+1;j--){ ans[m+1][j]=Ask(1,1,n,j)-Ask(1,1,n,j-1); for(int i=1;i<=n;i++)if(i!=m+1)ans[m+1][j]-=ans[i][j]; } ans[m+1][m+1]=Ask(1,1,n,n); for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)if(i!=m+1||j!=m+1)ans[m+1][m+1]-=ans[i][j]; printf("END\n"); for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++)printf("%i",ans[i][j]); printf("\n"); } fflush(stdout); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

treasure.cpp: In function 'int Ask(int, int, int, int)':
treasure.cpp:10:13: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  int b;scanf("%i",&b);
        ~~~~~^~~~~~~~~
treasure.cpp: In function 'int main()':
treasure.cpp:17:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%i",&n);
  ~~~~~^~~~~~~~~
/tmp/ccOVjJFC.o: In function `main':
treasure.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccJ4sra6.o:grader.c:(.text.startup+0x0): first defined here
/tmp/ccJ4sra6.o: In function `main':
grader.c:(.text.startup+0x109): undefined reference to `findTreasure(int)'
collect2: error: ld returned 1 exit status