# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
378535 | 2021-03-17T01:34:09 Z | ElaineHuang | Chessboard (IZhO18_chessboard) | C++14 | 84 ms | 1388 KB |
#include<bits/stdc++.h> #define debug 0 #define int long long using namespace std; int b[10005][2];//black squares vector<int> factor; int N; int p(int f) { int o=((N/f)*(N/f)/2)*f*f;//o->odd blocks int e=N*N-o;//e->even blocks if(debug) printf("f%d o%d e%d\n",f,o,e);// return min(b[f][1]+e-b[f][0],b[f][0]+o-b[f][1]);//e黑//o黑 } signed main() { int K,x1,x2,y1,y2; scanf("%lld %lld",&N,&K); int g=(int)sqrt(N); factor.clear(); memset(b,0,sizeof(b)); for(int i=1;i<=g;i++) { if(!(N%i)) { factor.push_back(i); } if(debug) printf("i=%d\n",i);// } if(debug) printf("%d, g%d\n",factor.size(),g);// while(K--) { scanf("%lld %lld %lld %lld",&x1,&y1,&x2,&y2); x1--,y1--,x2--,y2--; for(int i=0;i<factor.size();i++) { int a;//determine 0 or 1 int f;//factor f=factor[i]; a=x1/f+y1/f; a%=2; b[f][a]++; if(f==N/f) break; if(f==1) continue; f=N/factor[i]; a=x1/f+y1/f; a%=2; b[f][a]++; } } int ans=N*N; for(int i=0;i<factor.size();i++) { int f; f=factor[i];//p->paint幾格 ans=min(p(f),ans); if(f==N/f) break; if(f==1) continue; f=N/f; ans=min(p(f),ans); } printf("%lld\n",ans); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 492 KB | Output is correct |
2 | Correct | 1 ms | 492 KB | Output is correct |
3 | Correct | 1 ms | 492 KB | Output is correct |
4 | Correct | 1 ms | 492 KB | Output is correct |
5 | Correct | 1 ms | 492 KB | Output is correct |
6 | Correct | 1 ms | 492 KB | Output is correct |
7 | Correct | 1 ms | 492 KB | Output is correct |
8 | Correct | 1 ms | 492 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 24 ms | 1004 KB | Output is correct |
2 | Correct | 7 ms | 876 KB | Output is correct |
3 | Correct | 16 ms | 1004 KB | Output is correct |
4 | Correct | 18 ms | 1004 KB | Output is correct |
5 | Correct | 21 ms | 1260 KB | Output is correct |
6 | Correct | 19 ms | 1004 KB | Output is correct |
7 | Correct | 4 ms | 620 KB | Output is correct |
8 | Correct | 14 ms | 876 KB | Output is correct |
9 | Correct | 36 ms | 1260 KB | Output is correct |
10 | Correct | 20 ms | 1260 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 492 KB | Output is correct |
2 | Correct | 1 ms | 492 KB | Output is correct |
3 | Correct | 1 ms | 492 KB | Output is correct |
4 | Correct | 1 ms | 492 KB | Output is correct |
5 | Correct | 1 ms | 492 KB | Output is correct |
6 | Correct | 1 ms | 492 KB | Output is correct |
7 | Correct | 1 ms | 492 KB | Output is correct |
8 | Correct | 1 ms | 492 KB | Output is correct |
9 | Correct | 1 ms | 492 KB | Output is correct |
10 | Correct | 1 ms | 492 KB | Output is correct |
11 | Correct | 1 ms | 492 KB | Output is correct |
12 | Correct | 1 ms | 492 KB | Output is correct |
13 | Correct | 1 ms | 492 KB | Output is correct |
14 | Correct | 1 ms | 492 KB | Output is correct |
15 | Correct | 1 ms | 492 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 492 KB | Output is correct |
2 | Correct | 1 ms | 492 KB | Output is correct |
3 | Correct | 1 ms | 492 KB | Output is correct |
4 | Correct | 1 ms | 492 KB | Output is correct |
5 | Correct | 1 ms | 492 KB | Output is correct |
6 | Correct | 1 ms | 492 KB | Output is correct |
7 | Correct | 1 ms | 492 KB | Output is correct |
8 | Correct | 1 ms | 492 KB | Output is correct |
9 | Correct | 1 ms | 492 KB | Output is correct |
10 | Correct | 1 ms | 492 KB | Output is correct |
11 | Correct | 1 ms | 492 KB | Output is correct |
12 | Correct | 1 ms | 492 KB | Output is correct |
13 | Correct | 1 ms | 492 KB | Output is correct |
14 | Correct | 1 ms | 492 KB | Output is correct |
15 | Correct | 1 ms | 492 KB | Output is correct |
16 | Correct | 11 ms | 876 KB | Output is correct |
17 | Correct | 27 ms | 1260 KB | Output is correct |
18 | Correct | 45 ms | 1260 KB | Output is correct |
19 | Correct | 75 ms | 1260 KB | Output is correct |
20 | Correct | 84 ms | 1260 KB | Output is correct |
21 | Correct | 26 ms | 1260 KB | Output is correct |
22 | Correct | 1 ms | 492 KB | Output is correct |
23 | Correct | 19 ms | 876 KB | Output is correct |
24 | Correct | 32 ms | 1260 KB | Output is correct |
25 | Correct | 4 ms | 620 KB | Output is correct |
26 | Correct | 20 ms | 1004 KB | Output is correct |
27 | Correct | 28 ms | 1260 KB | Output is correct |
28 | Correct | 34 ms | 1388 KB | Output is correct |
29 | Correct | 11 ms | 876 KB | Output is correct |
30 | Correct | 2 ms | 492 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 24 ms | 1004 KB | Output is correct |
2 | Correct | 7 ms | 876 KB | Output is correct |
3 | Correct | 16 ms | 1004 KB | Output is correct |
4 | Correct | 18 ms | 1004 KB | Output is correct |
5 | Correct | 21 ms | 1260 KB | Output is correct |
6 | Correct | 19 ms | 1004 KB | Output is correct |
7 | Correct | 4 ms | 620 KB | Output is correct |
8 | Correct | 14 ms | 876 KB | Output is correct |
9 | Correct | 36 ms | 1260 KB | Output is correct |
10 | Correct | 20 ms | 1260 KB | Output is correct |
11 | Correct | 1 ms | 492 KB | Output is correct |
12 | Correct | 1 ms | 492 KB | Output is correct |
13 | Correct | 1 ms | 492 KB | Output is correct |
14 | Correct | 1 ms | 492 KB | Output is correct |
15 | Correct | 1 ms | 492 KB | Output is correct |
16 | Correct | 1 ms | 492 KB | Output is correct |
17 | Correct | 1 ms | 492 KB | Output is correct |
18 | Correct | 1 ms | 492 KB | Output is correct |
19 | Correct | 1 ms | 492 KB | Output is correct |
20 | Correct | 1 ms | 492 KB | Output is correct |
21 | Correct | 1 ms | 492 KB | Output is correct |
22 | Correct | 1 ms | 492 KB | Output is correct |
23 | Correct | 1 ms | 492 KB | Output is correct |
24 | Correct | 1 ms | 492 KB | Output is correct |
25 | Correct | 1 ms | 492 KB | Output is correct |
26 | Correct | 11 ms | 876 KB | Output is correct |
27 | Correct | 27 ms | 1260 KB | Output is correct |
28 | Correct | 45 ms | 1260 KB | Output is correct |
29 | Correct | 75 ms | 1260 KB | Output is correct |
30 | Correct | 84 ms | 1260 KB | Output is correct |
31 | Correct | 26 ms | 1260 KB | Output is correct |
32 | Correct | 1 ms | 492 KB | Output is correct |
33 | Correct | 19 ms | 876 KB | Output is correct |
34 | Correct | 32 ms | 1260 KB | Output is correct |
35 | Correct | 4 ms | 620 KB | Output is correct |
36 | Correct | 20 ms | 1004 KB | Output is correct |
37 | Correct | 28 ms | 1260 KB | Output is correct |
38 | Correct | 34 ms | 1388 KB | Output is correct |
39 | Correct | 11 ms | 876 KB | Output is correct |
40 | Correct | 2 ms | 492 KB | Output is correct |
41 | Runtime error | 1 ms | 748 KB | Execution killed with signal 11 |
42 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 492 KB | Output is correct |
2 | Correct | 1 ms | 492 KB | Output is correct |
3 | Correct | 1 ms | 492 KB | Output is correct |
4 | Correct | 1 ms | 492 KB | Output is correct |
5 | Correct | 1 ms | 492 KB | Output is correct |
6 | Correct | 1 ms | 492 KB | Output is correct |
7 | Correct | 1 ms | 492 KB | Output is correct |
8 | Correct | 1 ms | 492 KB | Output is correct |
9 | Correct | 24 ms | 1004 KB | Output is correct |
10 | Correct | 7 ms | 876 KB | Output is correct |
11 | Correct | 16 ms | 1004 KB | Output is correct |
12 | Correct | 18 ms | 1004 KB | Output is correct |
13 | Correct | 21 ms | 1260 KB | Output is correct |
14 | Correct | 19 ms | 1004 KB | Output is correct |
15 | Correct | 4 ms | 620 KB | Output is correct |
16 | Correct | 14 ms | 876 KB | Output is correct |
17 | Correct | 36 ms | 1260 KB | Output is correct |
18 | Correct | 20 ms | 1260 KB | Output is correct |
19 | Correct | 1 ms | 492 KB | Output is correct |
20 | Correct | 1 ms | 492 KB | Output is correct |
21 | Correct | 1 ms | 492 KB | Output is correct |
22 | Correct | 1 ms | 492 KB | Output is correct |
23 | Correct | 1 ms | 492 KB | Output is correct |
24 | Correct | 1 ms | 492 KB | Output is correct |
25 | Correct | 1 ms | 492 KB | Output is correct |
26 | Correct | 1 ms | 492 KB | Output is correct |
27 | Correct | 1 ms | 492 KB | Output is correct |
28 | Correct | 1 ms | 492 KB | Output is correct |
29 | Correct | 1 ms | 492 KB | Output is correct |
30 | Correct | 1 ms | 492 KB | Output is correct |
31 | Correct | 1 ms | 492 KB | Output is correct |
32 | Correct | 1 ms | 492 KB | Output is correct |
33 | Correct | 1 ms | 492 KB | Output is correct |
34 | Correct | 11 ms | 876 KB | Output is correct |
35 | Correct | 27 ms | 1260 KB | Output is correct |
36 | Correct | 45 ms | 1260 KB | Output is correct |
37 | Correct | 75 ms | 1260 KB | Output is correct |
38 | Correct | 84 ms | 1260 KB | Output is correct |
39 | Correct | 26 ms | 1260 KB | Output is correct |
40 | Correct | 1 ms | 492 KB | Output is correct |
41 | Correct | 19 ms | 876 KB | Output is correct |
42 | Correct | 32 ms | 1260 KB | Output is correct |
43 | Correct | 4 ms | 620 KB | Output is correct |
44 | Correct | 20 ms | 1004 KB | Output is correct |
45 | Correct | 28 ms | 1260 KB | Output is correct |
46 | Correct | 34 ms | 1388 KB | Output is correct |
47 | Correct | 11 ms | 876 KB | Output is correct |
48 | Correct | 2 ms | 492 KB | Output is correct |
49 | Runtime error | 1 ms | 748 KB | Execution killed with signal 11 |
50 | Halted | 0 ms | 0 KB | - |