# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
168425 | 2019-12-13T04:22:29 Z | juggernaut | Chessboard (IZhO18_chessboard) | C++14 | 661 ms | 4476 KB |
#include<bits/stdc++.h> #define int long long int #define fr first #define sc second using namespace std; int n,k,i,j,x,y,res; pair<int,int>p[100001]; bool a[1001][1001]; int get(int f,int q){ int cnt=0; for(int i=0;i<n;i++) for(int j=0;j<n;j++){ x=i/f; y=j/f; if(q){ if((x+y)%2==0){ if(a[i][j])cnt++; }else{ if(!a[i][j])cnt++; } }else{ if((x+y)%2==0){ if(!a[i][j])cnt++; }else{ if(a[i][j])cnt++; } } } return cnt; } int get(int f){ return min(get(f,0),get(f,1)); } main(){ scanf("%lld%lld",&n,&k); for(i=0;i<k;i++){ scanf("%lld%lld%lld%lld",&p[i].fr,&p[i].sc,&p[i].fr,&p[i].sc); p[i].fr--; p[i].sc--; a[p[i].fr][p[i].sc]=1; } res=get(1); for(j=2;j*j<=n;j++){ if(n%j==0){ res=min(res,get(j)); res=min(res,get(n/j)); } } printf("%lld",res); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 4 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 256 KB | Output is correct |
4 | Correct | 3 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 5 ms | 256 KB | Output is correct |
7 | Correct | 3 ms | 376 KB | Output is correct |
8 | Correct | 3 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 376 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 376 KB | Output is correct |
3 | Correct | 4 ms | 380 KB | Output is correct |
4 | Correct | 3 ms | 504 KB | Output is correct |
5 | Correct | 3 ms | 504 KB | Output is correct |
6 | Correct | 3 ms | 376 KB | Output is correct |
7 | Correct | 3 ms | 376 KB | Output is correct |
8 | Correct | 3 ms | 376 KB | Output is correct |
9 | Correct | 3 ms | 504 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 3 ms | 376 KB | Output is correct |
14 | Correct | 3 ms | 504 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 376 KB | Output is correct |
3 | Correct | 4 ms | 380 KB | Output is correct |
4 | Correct | 3 ms | 504 KB | Output is correct |
5 | Correct | 3 ms | 504 KB | Output is correct |
6 | Correct | 3 ms | 376 KB | Output is correct |
7 | Correct | 3 ms | 376 KB | Output is correct |
8 | Correct | 3 ms | 376 KB | Output is correct |
9 | Correct | 3 ms | 504 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 3 ms | 376 KB | Output is correct |
14 | Correct | 3 ms | 504 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 82 ms | 2252 KB | Output is correct |
17 | Correct | 62 ms | 3960 KB | Output is correct |
18 | Correct | 118 ms | 4472 KB | Output is correct |
19 | Correct | 660 ms | 4088 KB | Output is correct |
20 | Correct | 661 ms | 4476 KB | Output is correct |
21 | Correct | 65 ms | 3964 KB | Output is correct |
22 | Correct | 376 ms | 1196 KB | Output is correct |
23 | Correct | 186 ms | 2700 KB | Output is correct |
24 | Correct | 116 ms | 4224 KB | Output is correct |
25 | Correct | 169 ms | 1628 KB | Output is correct |
26 | Correct | 94 ms | 3064 KB | Output is correct |
27 | Correct | 146 ms | 3548 KB | Output is correct |
28 | Correct | 111 ms | 4344 KB | Output is correct |
29 | Correct | 40 ms | 2428 KB | Output is correct |
30 | Correct | 75 ms | 1528 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 376 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 4 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 256 KB | Output is correct |
4 | Correct | 3 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 5 ms | 256 KB | Output is correct |
7 | Correct | 3 ms | 376 KB | Output is correct |
8 | Correct | 3 ms | 376 KB | Output is correct |
9 | Runtime error | 2 ms | 376 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
10 | Halted | 0 ms | 0 KB | - |