# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
334375 | 2020-12-09T05:26:34 Z | juggernaut | Chessboard (IZhO18_chessboard) | C++14 | 471 ms | 3564 KB |
#include<bits/stdc++.h> using namespace std; typedef long long ll; struct Rect{ ll x,y,x2,y2; void _minus(){ x--,y--,x2--,y2--; } }rect[100005]; ll n,m; ll solve(ll side,bool color){ ll sz=n/side; if(color){ ll wh=0,bl=side*side*((sz*sz+1)>>1); for(ll i=0;i<m;i++){ ll block_x=rect[i].x/side; ll block_y=rect[i].y/side; if((block_x+block_y)&1)wh++; else bl--; } return wh+bl; }else{ ll wh=0,bl=side*side*((sz*sz)>>1); for(ll i=0;i<m;i++){ bool cl; ll block_x=rect[i].x/side; ll block_y=rect[i].y/side; if((block_x+block_y)&1)bl--; else wh++; } return wh+bl; } } int main(){ scanf("%lld%lld",&n,&m); for(ll i=0;i<m;i++)scanf("%lld%lld%lld%lld",&rect[i].x,&rect[i].y,&rect[i].x2,&rect[i].y2),rect[i]._minus(); ll res=min(solve(1,0),solve(1,1)); for(ll i=2;i*i<=n;i++)if(n%i==0)res=min(res,min(min(solve(i,0),solve(n/i,0)),min(solve(i,1),solve(n/i,1)))); printf("%lld",res); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 512 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 0 ms | 364 KB | Output is correct |
6 | Correct | 0 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 25 ms | 2284 KB | Output is correct |
2 | Correct | 7 ms | 876 KB | Output is correct |
3 | Correct | 16 ms | 1516 KB | Output is correct |
4 | Correct | 18 ms | 1772 KB | Output is correct |
5 | Correct | 23 ms | 2028 KB | Output is correct |
6 | Correct | 15 ms | 1516 KB | Output is correct |
7 | Correct | 4 ms | 492 KB | Output is correct |
8 | Correct | 15 ms | 1388 KB | Output is correct |
9 | Correct | 52 ms | 3180 KB | Output is correct |
10 | Correct | 21 ms | 1900 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 2 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 364 KB | Output is correct |
15 | Correct | 1 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 2 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 364 KB | Output is correct |
15 | Correct | 1 ms | 364 KB | Output is correct |
16 | Correct | 12 ms | 1132 KB | Output is correct |
17 | Correct | 30 ms | 2924 KB | Output is correct |
18 | Correct | 40 ms | 3436 KB | Output is correct |
19 | Correct | 103 ms | 3200 KB | Output is correct |
20 | Correct | 115 ms | 3436 KB | Output is correct |
21 | Correct | 28 ms | 2796 KB | Output is correct |
22 | Correct | 1 ms | 364 KB | Output is correct |
23 | Correct | 30 ms | 1644 KB | Output is correct |
24 | Correct | 38 ms | 3196 KB | Output is correct |
25 | Correct | 5 ms | 620 KB | Output is correct |
26 | Correct | 23 ms | 2028 KB | Output is correct |
27 | Correct | 37 ms | 2412 KB | Output is correct |
28 | Correct | 42 ms | 3264 KB | Output is correct |
29 | Correct | 12 ms | 1388 KB | Output is correct |
30 | Correct | 2 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 25 ms | 2284 KB | Output is correct |
2 | Correct | 7 ms | 876 KB | Output is correct |
3 | Correct | 16 ms | 1516 KB | Output is correct |
4 | Correct | 18 ms | 1772 KB | Output is correct |
5 | Correct | 23 ms | 2028 KB | Output is correct |
6 | Correct | 15 ms | 1516 KB | Output is correct |
7 | Correct | 4 ms | 492 KB | Output is correct |
8 | Correct | 15 ms | 1388 KB | Output is correct |
9 | Correct | 52 ms | 3180 KB | Output is correct |
10 | Correct | 21 ms | 1900 KB | Output is correct |
11 | Correct | 1 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 2 ms | 364 KB | Output is correct |
15 | Correct | 1 ms | 364 KB | Output is correct |
16 | Correct | 1 ms | 364 KB | Output is correct |
17 | Correct | 1 ms | 364 KB | Output is correct |
18 | Correct | 1 ms | 364 KB | Output is correct |
19 | Correct | 1 ms | 364 KB | Output is correct |
20 | Correct | 1 ms | 364 KB | Output is correct |
21 | Correct | 1 ms | 364 KB | Output is correct |
22 | Correct | 1 ms | 364 KB | Output is correct |
23 | Correct | 1 ms | 364 KB | Output is correct |
24 | Correct | 1 ms | 364 KB | Output is correct |
25 | Correct | 1 ms | 364 KB | Output is correct |
26 | Correct | 12 ms | 1132 KB | Output is correct |
27 | Correct | 30 ms | 2924 KB | Output is correct |
28 | Correct | 40 ms | 3436 KB | Output is correct |
29 | Correct | 103 ms | 3200 KB | Output is correct |
30 | Correct | 115 ms | 3436 KB | Output is correct |
31 | Correct | 28 ms | 2796 KB | Output is correct |
32 | Correct | 1 ms | 364 KB | Output is correct |
33 | Correct | 30 ms | 1644 KB | Output is correct |
34 | Correct | 38 ms | 3196 KB | Output is correct |
35 | Correct | 5 ms | 620 KB | Output is correct |
36 | Correct | 23 ms | 2028 KB | Output is correct |
37 | Correct | 37 ms | 2412 KB | Output is correct |
38 | Correct | 42 ms | 3264 KB | Output is correct |
39 | Correct | 12 ms | 1388 KB | Output is correct |
40 | Correct | 2 ms | 364 KB | Output is correct |
41 | Correct | 94 ms | 2968 KB | Output is correct |
42 | Correct | 44 ms | 3308 KB | Output is correct |
43 | Correct | 62 ms | 2944 KB | Output is correct |
44 | Correct | 42 ms | 3180 KB | Output is correct |
45 | Correct | 40 ms | 3436 KB | Output is correct |
46 | Correct | 108 ms | 3180 KB | Output is correct |
47 | Correct | 34 ms | 3052 KB | Output is correct |
48 | Correct | 53 ms | 3052 KB | Output is correct |
49 | Correct | 40 ms | 2924 KB | Output is correct |
50 | Correct | 423 ms | 3308 KB | Output is correct |
51 | Correct | 454 ms | 3436 KB | Output is correct |
52 | Correct | 424 ms | 3180 KB | Output is correct |
53 | Correct | 448 ms | 3308 KB | Output is correct |
54 | Correct | 417 ms | 3308 KB | Output is correct |
55 | Correct | 471 ms | 3564 KB | Output is correct |
56 | Correct | 406 ms | 3180 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 512 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 0 ms | 364 KB | Output is correct |
6 | Correct | 0 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 25 ms | 2284 KB | Output is correct |
10 | Correct | 7 ms | 876 KB | Output is correct |
11 | Correct | 16 ms | 1516 KB | Output is correct |
12 | Correct | 18 ms | 1772 KB | Output is correct |
13 | Correct | 23 ms | 2028 KB | Output is correct |
14 | Correct | 15 ms | 1516 KB | Output is correct |
15 | Correct | 4 ms | 492 KB | Output is correct |
16 | Correct | 15 ms | 1388 KB | Output is correct |
17 | Correct | 52 ms | 3180 KB | Output is correct |
18 | Correct | 21 ms | 1900 KB | Output is correct |
19 | Correct | 1 ms | 364 KB | Output is correct |
20 | Correct | 1 ms | 364 KB | Output is correct |
21 | Correct | 1 ms | 364 KB | Output is correct |
22 | Correct | 2 ms | 364 KB | Output is correct |
23 | Correct | 1 ms | 364 KB | Output is correct |
24 | Correct | 1 ms | 364 KB | Output is correct |
25 | Correct | 1 ms | 364 KB | Output is correct |
26 | Correct | 1 ms | 364 KB | Output is correct |
27 | Correct | 1 ms | 364 KB | Output is correct |
28 | Correct | 1 ms | 364 KB | Output is correct |
29 | Correct | 1 ms | 364 KB | Output is correct |
30 | Correct | 1 ms | 364 KB | Output is correct |
31 | Correct | 1 ms | 364 KB | Output is correct |
32 | Correct | 1 ms | 364 KB | Output is correct |
33 | Correct | 1 ms | 364 KB | Output is correct |
34 | Correct | 12 ms | 1132 KB | Output is correct |
35 | Correct | 30 ms | 2924 KB | Output is correct |
36 | Correct | 40 ms | 3436 KB | Output is correct |
37 | Correct | 103 ms | 3200 KB | Output is correct |
38 | Correct | 115 ms | 3436 KB | Output is correct |
39 | Correct | 28 ms | 2796 KB | Output is correct |
40 | Correct | 1 ms | 364 KB | Output is correct |
41 | Correct | 30 ms | 1644 KB | Output is correct |
42 | Correct | 38 ms | 3196 KB | Output is correct |
43 | Correct | 5 ms | 620 KB | Output is correct |
44 | Correct | 23 ms | 2028 KB | Output is correct |
45 | Correct | 37 ms | 2412 KB | Output is correct |
46 | Correct | 42 ms | 3264 KB | Output is correct |
47 | Correct | 12 ms | 1388 KB | Output is correct |
48 | Correct | 2 ms | 364 KB | Output is correct |
49 | Correct | 94 ms | 2968 KB | Output is correct |
50 | Correct | 44 ms | 3308 KB | Output is correct |
51 | Correct | 62 ms | 2944 KB | Output is correct |
52 | Correct | 42 ms | 3180 KB | Output is correct |
53 | Correct | 40 ms | 3436 KB | Output is correct |
54 | Correct | 108 ms | 3180 KB | Output is correct |
55 | Correct | 34 ms | 3052 KB | Output is correct |
56 | Correct | 53 ms | 3052 KB | Output is correct |
57 | Correct | 40 ms | 2924 KB | Output is correct |
58 | Correct | 423 ms | 3308 KB | Output is correct |
59 | Correct | 454 ms | 3436 KB | Output is correct |
60 | Correct | 424 ms | 3180 KB | Output is correct |
61 | Correct | 448 ms | 3308 KB | Output is correct |
62 | Correct | 417 ms | 3308 KB | Output is correct |
63 | Correct | 471 ms | 3564 KB | Output is correct |
64 | Correct | 406 ms | 3180 KB | Output is correct |
65 | Correct | 1 ms | 364 KB | Output is correct |
66 | Incorrect | 1 ms | 364 KB | Output isn't correct |
67 | Halted | 0 ms | 0 KB | - |