Submission #1071179

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10711792024-08-23 05:38:08sleepntsheepCultivation (JOI17_cultivation)C++17
5 / 100
297 ms424 KiB
#pragma GCC optimize("O3,unroll-loops")
#include<cstring>
#include <cstdio>
#include <algorithm>
using namespace std;
int C,z=1e9,R, n, x[300], y[300], c[41][41];
int Check(int l, int u, int r, int d) {
memset(c,0,sizeof c);
for (int i = 0; i < n; ++i) {
++c[max(0, x[i]-u)][max(0, y[i]-l)];
--c[max(0, x[i]-u)][min(40,y[i]+r+1)];
--c[min(40,x[i]+d+1)][max(0, y[i]-l)];
++c[min(40,x[i]+d+1)][min(40,y[i]+r+1)];
}
for(int i=1;i<R;++i)c[i][0]+=c[i-1][0];
for(int j=1;j<C;++j)c[0][j]+=c[0][j-1];
for(int i=1;i<R;++i)for(int j=1;j<C;++j)c[i][j]+=c[i-1][j]+c[i][j-1]-c[i-1][j-1];
for(int i=0;i<R;++i)for(int j=0;j<C;++j)if(!c[i][j])return 0;
return 1;
}
int main() {
scanf("%d%d%d", &R, &C, &n);
for (int i = 0; i < n; ++i) scanf("%d%d", x + i, y + i), --x[i], --y[i];
for(int l=0;l<=40;++l)for(int r=0;r<=40-l;++r){
for(int u=0;u<=40;++u){
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

cultivation.cpp: In function 'int main()':
cultivation.cpp:26:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |  scanf("%d%d%d", &R, &C, &n);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~~
cultivation.cpp:27:35: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |  for (int i = 0; i < n; ++i) scanf("%d%d", x + i, y + i), --x[i], --y[i];
      |                              ~~~~~^~~~~~~~~~~~~~~~~~~~~~
#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...