Submission #747891

#TimeUsernameProblemLanguageResultExecution timeMemory
747891boyliguanhanPyramid Base (IOI08_pyramid_base)C++17
15 / 100
308 ms262144 KiB
#include"stdio.h" using namespace std; int arr[10001][10001], n, m, p; bool check(int l) { for(int i = l; i <= n; i++) for(int j = l; j <= m; j++) if((arr[i][j]-arr[i-l][j] - arr[i][j-l] + arr[i-l][j-l]) == 0) { return 1; } return 0; } int main() { scanf("%d%d%d%d", &n, &m, &p, &p); for(int i = 0; i < p; i++) { int a, b, c, d, e; scanf("%d%d%d%d%d", &a, &b, &c, &d, &e); arr[a][b]++; arr[a][d+1]--; arr[c+1][b]--; arr[c+1][d+1]++; } for(int i = 1; i <= n; i++) for(int j = 1; j <= m; j++) arr[i][j] += arr[i-1][j]+arr[i][j-1]-arr[i-1][j-1]; for(int i = 1; i <= n; i++) for(int j = 1; j <= m; j++) arr[i][j] += arr[i-1][j]+arr[i][j-1]-arr[i-1][j-1]; int l = 0, r = (n<m?n:m); while(l < r) { int mid = l+r+1>>1; if(check(mid)) { l = mid; } else { r = mid-1; } } printf("%d", l); }

Compilation message (stderr)

pyramid_base.cpp: In function 'int main()':
pyramid_base.cpp:30:22: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   30 |         int mid = l+r+1>>1;
      |                   ~~~^~
pyramid_base.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     scanf("%d%d%d%d", &n, &m, &p, &p);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
pyramid_base.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |         scanf("%d%d%d%d%d", &a, &b, &c, &d, &e);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...