Submission #48374

#TimeUsernameProblemLanguageResultExecution timeMemory
48374ExtazyTreasure (different grader from official contest) (CEOI13_treasure2)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define endl '\n' using namespace std; const int N = 107; int n,all; char out[N][N]; void print_answer() { int i,j; printf("END\n"); fflush(stdout); for(i=1;i<=n;i++) { for(j=1;j<=n;j++) { printf("%c", out[i][j]); } printf("\n"); } fflush(stdout); } void fill_all(int r1, int r2, int c1, int c2) { int i,j; for(i=r1;i<=r2;i++) { for(j=c1;j<=c2;j++) { out[i][j]='1'; } } } int ask(int r1, int r2, int c1, int c2) { printf("%d %d %d %d\n", r1, c1, r2, c2); fflush(stdout); int ans; scanf("%d", &ans); return ans; } void go(int r1, int r2, int c1, int c2, int all) { if(all==0) return; if(all==(r2-r1+1)*(c2-c1+1)) { fill_all(r1,r2,c1,c2); return; } int mid; if(r1==r2) { mid=(c1+c2)/2; int all2=ask(r1,r2,mid+1,c2),all1=all-all2; go(r1,r2,c1,mid,all1); go(r1,r2,mid+1,c2,all2); } else if(c1==c2) { mid=(r1+r2)/2; int all2=ask(mid+1,r2,c1,c2),all1=all-all2; go(r1,mid,c1,c2,all1); go(mid+1,r2,c1,c2,all2); } else if(rand()%2==0) { mid=(c1+c2)/2; int all2=ask(r1,r2,mid+1,c2),all1=all-all2; go(r1,r2,c1,mid,all1); go(r1,r2,mid+1,c2,all2); } else { mid=(r1+r2)/2; int all2=ask(mid+1,r2,c1,c2),all1=all-all2; go(r1,mid,c1,c2,all1); go(mid+1,r2,c1,c2,all2); } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int i,j; scanf("%d", &n); for(i=1;i<=n;i++) { for(j=1;j<=n;j++) { out[i][j]='0'; } } all=ask(1,n,1,n); go(1,n,1,n,all); print_answer(); return 0; }

Compilation message (stderr)

grader.c: In function 'int main()':
grader.c:63:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         my_assert(strlen(A[i]+1) == N, "each line of the map must contain N zeroes or ones (before loop)");
                   ~~~~~~~~~~~~~~~^~~~
treasure.cpp: In function 'int ask(int, int, int, int)':
treasure.cpp:38:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &ans);
   ~~~~~^~~~~~~~~~~~
treasure.cpp: In function 'int main()':
treasure.cpp:90:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &n);
   ~~~~~^~~~~~~~~~
/tmp/cczLlUtR.o: In function `main':
treasure.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccwVYFsj.o:grader.c:(.text.startup+0x0): first defined here
/tmp/ccwVYFsj.o: In function `main':
grader.c:(.text.startup+0x106): undefined reference to `findTreasure(int)'
collect2: error: ld returned 1 exit status