QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#832637#504. ChessboardI_love_Banu#31 57ms3852kbC++142.1kb2024-12-26 01:24:562024-12-26 01:24:57

Judging History

This is the latest submission verdict.

  • [2024-12-26 01:24:57]
  • Judged
  • Verdict: 31
  • Time: 57ms
  • Memory: 3852kb
  • [2024-12-26 01:24:56]
  • Submitted

answer

#include"bits/stdc++.h"
using namespace std;
#define FOR(i,a,b)for(int i=(a);i<(b);i++)
#define F0R(i,a)FOR(i,0,a)
#define ROF(i,a,b)for(int i=(b)-1;(a)<=i;i--)
#define R0F(i,a)ROF(i,0,a)
#define rep(a)F0R(_,a)
#define each(a,x)for(auto&a:x)
#define all(a)begin(a),end(a)
#define sz(x)int(size(x))
#define lla(x)rbegin(x),rend(x)
#define SUM(a)accumulate(all(a),0ll)
#define SUMM(a,b)accumulate(a,a+b,0ll)
#define MAX(a)(*max_element(all(a)))
#define MAXX(a,b)(*max_element(a,a+b))
#define MIN(a)(*min_element(all(a)))
#define MINN(a,b)(*min_element(a,a+b))
#define con const int
#ifdef LOCAL
#define print(x)cout<<x
#else
#define print(x)
#endif
using ld=long double;
using ll=long long;
using str=string;
template<class T,class U>ifstream&operator>>(istream&in,pair<T,U>a){return in>>a.first>>a.second;}
void fileset(str a){freopen((a+".in").c_str(),"r",stdin);freopen((a+".out").c_str(),"w",stdout);}

con mxN = 1e2 + 2;

int brd[mxN][mxN];

int main(){
    int N, K;
    cin >> N >> K;

    ll cnt1 = 1ll * (N / 2) * N + N / 2;
    ll cnt2 = cnt1 + 1;

    rep(K){
	int X1, Y1, X2, Y2;
	cin >> Y1 >> X1 >> Y2 >> X2;

	if (100 >= N){
	    brd[Y1][X1] = 1;
	} else {
	    int x = Y1 & 1;
	    int y = X1 & 1;

	    if (x & 1){
		if (y & 1) cnt2 --, cnt1 ++;
		else cnt1 --, cnt2 ++;
	    } else {
		if (y & 1) cnt2 ++, cnt1 --;
		else cnt1 ++, cnt2 --;
	    }
	}
    }

    if (100 < N){
	cout << min(cnt1, cnt2) << endl;
	return 0;
    }

    int ans = N * N;

    FOR(i, 1, N){
	if (0 == N % i){
	    int cnt1 = 0;
	    int cnt2 = 0;

	    FOR(j, 1, N + 1){
		FOR(k, 1, N + 1){
		    int x = (j - 1) / i;
		    int y = (k - 1) / i;
		    if (brd[j][k]){
			if (x & 1){
			    if (y & 1) cnt1 ++;// bad for cnt1
			    else cnt2 ++;
			} else {
			    if (y & 1) cnt2 ++;
			    else cnt1 ++;
			}
		    } else {
			if (x & 1){
			    if (y & 1) cnt2 ++;
			    else cnt1 ++;
			} else {
			    if (y & 1) cnt1 ++;
			    else cnt2 ++;
			}
		    }
		}
	    }

	    ans = min(ans, cnt1);
	    ans = min(ans, cnt2);
	}
    }

    cout << ans << endl;
}

详细

Subtask #1:

score: 8
Accepted

Test #1:

score: 8
Accepted
time: 1ms
memory: 3496kb

input:

100 0

output:

4800

result:

ok single line: '4800'

Test #2:

score: 8
Accepted
time: 1ms
memory: 3528kb

input:

99 0

output:

4356

result:

ok single line: '4356'

Test #3:

score: 8
Accepted
time: 0ms
memory: 3600kb

input:

98 0

output:

4704

result:

ok single line: '4704'

Test #4:

score: 8
Accepted
time: 0ms
memory: 3572kb

input:

97 0

output:

4704

result:

ok single line: '4704'

Test #5:

score: 8
Accepted
time: 1ms
memory: 3532kb

input:

96 0

output:

4096

result:

ok single line: '4096'

Test #6:

score: 8
Accepted
time: 0ms
memory: 3596kb

input:

95 0

output:

4332

result:

ok single line: '4332'

Test #7:

score: 8
Accepted
time: 0ms
memory: 3456kb

input:

94 0

output:

4416

result:

ok single line: '4416'

Subtask #2:

score: 8
Accepted

Test #8:

score: 8
Accepted
time: 37ms
memory: 3816kb

input:

62119 62603
12553 17025 12553 17025
6889 49271 6889 49271
22523 10778 22523 10778
27058 28538 27058 28538
39696 26638 39696 26638
59348 52344 59348 52344
53272 14810 53272 14810
29522 5148 29522 5148
52527 55935 52527 55935
43346 19863 43346 19863
49934 33407 49934 33407
57492 27016 57492 27016
7355...

output:

1929384918

result:

ok single line: '1929384918'

Test #9:

score: 8
Accepted
time: 10ms
memory: 3524kb

input:

13553 16567
10214 777 10214 777
1372 7931 1372 7931
2222 8015 2222 8015
12573 8712 12573 8712
11772 7517 11772 7517
13462 5796 13462 5796
11421 3259 11421 3259
259 7736 259 7736
7391 3520 7391 3520
9568 7552 9568 7552
10914 2655 10914 2655
915 11734 915 11734
7211 10475 7211 10475
2350 9168 2350 916...

output:

91841677

result:

ok single line: '91841677'

Test #10:

score: 8
Accepted
time: 25ms
memory: 3600kb

input:

83311 39346
17169 55690 17169 55690
44097 70844 44097 70844
21463 68879 21463 68879
65027 22685 65027 22685
24591 56773 24591 56773
47003 22668 47003 22668
43456 35367 43456 35367
38682 41848 38682 41848
22547 25019 22547 25019
32120 57672 32120 57672
35244 51896 35244 51896
27588 18334 27588 18334
...

output:

3470361291

result:

ok single line: '3470361291'

Test #11:

score: 8
Accepted
time: 25ms
memory: 3816kb

input:

2593 45808
734 225 734 225
2097 527 2097 527
1970 1389 1970 1389
1595 164 1595 164
535 2519 535 2519
945 1570 945 1570
1155 1379 1155 1379
1805 1711 1805 1711
1722 1785 1722 1785
1875 2530 1875 2530
1258 665 1258 665
1671 2481 1671 2481
702 2358 702 2358
2207 127 2207 127
2420 1000 2420 1000
703 91 ...

output:

3361728

result:

ok single line: '3361728'

Test #12:

score: 8
Accepted
time: 35ms
memory: 3540kb

input:

56393 54508
31316 8221 31316 8221
28261 551 28261 551
56373 14562 56373 14562
30770 1992 30770 1992
26181 47974 26181 47974
20906 48883 20906 48883
30498 40114 30498 40114
42754 10090 42754 10090
17359 14718 17359 14718
39687 20578 39687 20578
38086 21607 38086 21607
46774 54122 46774 54122
15651 11...

output:

1590085022

result:

ok single line: '1590085022'

Test #13:

score: 8
Accepted
time: 22ms
memory: 3752kb

input:

48313 34790
25246 25140 25246 25140
27687 40566 27687 40566
29723 14480 29723 14480
8105 11104 8105 11104
26980 34212 26980 34212
24319 34779 24319 34779
28496 2921 28496 2921
41606 19546 41606 19546
4871 1373 4871 1373
38836 24241 38836 24241
7112 32587 7112 32587
40232 32604 40232 32604
31909 4077...

output:

1167072972

result:

ok single line: '1167072972'

Test #14:

score: 8
Accepted
time: 5ms
memory: 3504kb

input:

22369 7369
8903 15030 8903 15030
21789 2148 21789 2148
20232 1605 20232 1605
18493 16645 18493 16645
7899 17751 7899 17751
20641 6627 20641 6627
8533 4787 8533 4787
17994 79 17994 79
3380 10157 3380 10157
3032 3571 3032 3571
13692 13531 13692 13531
13475 10046 13475 10046
5445 17435 5445 17435
6393 ...

output:

250186080

result:

ok single line: '250186080'

Test #15:

score: 8
Accepted
time: 22ms
memory: 3468kb

input:

49177 34976
20242 3416 20242 3416
29831 41358 29831 41358
44096 23812 44096 23812
38772 41358 38772 41358
15408 24508 15408 24508
12918 43262 12918 43262
14923 13241 14923 13241
24245 1273 24245 1273
15496 17569 15496 17569
18827 48604 18827 48604
24179 10086 24179 10086
39151 33628 39151 33628
3046...

output:

1209188651

result:

ok single line: '1209188651'

Test #16:

score: 8
Accepted
time: 57ms
memory: 3588kb

input:

30517 90160
1148 29295 1148 29295
4742 14556 4742 14556
13369 19072 13369 19072
3570 26309 3570 26309
27652 20912 27652 20912
23698 22199 23698 22199
23527 10525 23527 10525
25304 2904 25304 2904
28108 27338 28108 27338
6120 14668 6120 14668
15168 15380 15168 15380
19202 13390 19202 13390
24498 1460...

output:

465643354

result:

ok single line: '465643354'

Test #17:

score: 8
Accepted
time: 33ms
memory: 3792kb

input:

37853 50195
37739 14089 37739 14089
13677 29088 13677 29088
21276 27518 21276 27518
14263 24397 14263 24397
19814 30961 19814 30961
6565 8097 6565 8097
3121 28314 3121 28314
21858 19175 21858 19175
17886 27128 17886 27128
19921 26743 19921 26743
20268 5870 20268 5870
18988 19478 18988 19478
12130 25...

output:

716424803

result:

ok single line: '716424803'

Subtask #3:

score: 15
Accepted

Test #18:

score: 15
Accepted
time: 1ms
memory: 3620kb

input:

78 280
55 71 55 71
22 73 22 73
60 30 60 30
28 11 28 11
51 39 51 39
21 33 21 33
25 32 25 32
42 54 42 54
62 71 62 71
23 31 23 31
75 1 75 1
56 76 56 76
33 9 33 9
9 76 9 76
77 67 77 67
68 21 68 21
62 24 62 24
32 70 32 70
41 2 41 2
58 58 58 58
65 14 65 14
66 72 66 72
72 21 72 21
71 63 71 63
13 18 13 18
6...

output:

2732

result:

ok single line: '2732'

Test #19:

score: 15
Accepted
time: 0ms
memory: 3620kb

input:

66 47
28 26 28 26
40 19 40 19
6 14 6 14
32 53 32 53
20 1 20 1
26 52 26 52
65 63 65 63
53 65 53 65
16 36 16 36
1 44 1 44
50 24 50 24
54 61 54 61
24 15 24 15
41 30 41 30
31 42 31 42
3 21 3 21
48 4 48 4
7 44 7 44
20 9 20 9
9 40 9 40
53 20 53 20
27 50 27 50
14 39 14 39
48 37 48 37
48 1 48 1
22 63 22 63
...

output:

1941

result:

ok single line: '1941'

Test #20:

score: 15
Accepted
time: 0ms
memory: 3596kb

input:

80 192
6 44 6 44
5 11 5 11
60 63 60 63
13 7 13 7
38 49 38 49
75 48 75 48
21 18 21 18
57 1 57 1
12 9 12 9
22 58 22 58
38 62 38 62
53 62 53 62
62 49 62 49
28 37 28 37
20 50 20 50
22 27 22 27
63 38 63 38
33 63 33 63
22 57 22 57
1 5 1 5
22 22 22 22
43 5 43 5
79 1 79 1
75 41 75 41
71 46 71 46
30 51 30 51...

output:

3096

result:

ok single line: '3096'

Test #21:

score: 15
Accepted
time: 1ms
memory: 3528kb

input:

78 980
6 3 6 3
26 55 26 55
56 50 56 50
74 1 74 1
63 32 63 32
27 49 27 49
7 37 7 37
43 42 43 42
60 37 60 37
14 53 14 53
41 27 41 27
62 49 62 49
67 7 67 7
21 44 21 44
74 60 74 60
69 51 69 51
17 41 17 41
15 7 15 7
49 20 49 20
13 64 13 64
78 8 78 8
75 47 75 47
38 31 38 31
32 23 32 23
47 51 47 51
39 33 3...

output:

2820

result:

ok single line: '2820'

Test #22:

score: 15
Accepted
time: 1ms
memory: 3852kb

input:

77 854
21 27 21 27
51 59 51 59
24 42 24 42
31 31 31 31
45 17 45 17
28 47 28 47
58 68 58 68
11 17 11 17
76 58 76 58
75 11 75 11
61 17 61 17
50 5 50 5
49 37 49 37
77 55 77 55
38 60 38 60
1 26 1 26
60 9 60 9
38 3 38 3
45 20 45 20
1 65 1 65
16 36 16 36
64 74 64 74
39 47 39 47
43 2 43 2
65 28 65 28
45 45...

output:

2926

result:

ok single line: '2926'

Test #23:

score: 15
Accepted
time: 1ms
memory: 3564kb

input:

76 376
36 4 36 4
71 16 71 16
44 55 44 55
9 38 9 38
57 45 57 45
49 53 49 53
72 18 72 18
8 33 8 33
10 59 10 59
41 64 41 64
26 46 26 46
27 76 27 76
29 57 29 57
55 5 55 5
65 19 65 19
28 13 28 13
34 52 34 52
57 2 57 2
76 36 76 36
58 15 58 15
3 20 3 20
59 23 59 23
65 37 65 37
55 41 55 41
31 14 31 14
35 2 ...

output:

2862

result:

ok single line: '2862'

Test #24:

score: 15
Accepted
time: 1ms
memory: 3600kb

input:

87 898
30 50 30 50
9 39 9 39
26 12 26 12
6 62 6 62
85 51 85 51
72 15 72 15
8 78 8 78
29 36 29 36
68 24 68 24
13 56 13 56
1 39 1 39
4 51 4 51
79 14 79 14
14 85 14 85
59 54 59 54
57 86 57 86
26 54 26 54
14 22 14 22
86 46 86 46
47 34 47 34
75 42 75 42
15 22 15 22
87 79 87 79
7 61 7 61
84 76 84 76
28 85...

output:

3468

result:

ok single line: '3468'

Test #25:

score: 15
Accepted
time: 1ms
memory: 3624kb

input:

63 680
36 4 36 4
62 16 62 16
17 62 17 62
55 58 55 58
38 50 38 50
30 25 30 25
57 38 57 38
38 62 38 62
8 3 8 3
7 38 7 38
9 51 9 51
33 5 33 5
6 6 6 6
22 28 22 28
62 14 62 14
55 29 55 29
17 40 17 40
54 38 54 38
50 30 50 30
2 58 2 58
58 13 58 13
48 27 48 27
12 24 12 24
24 54 24 54
10 37 10 37
46 11 46 11...

output:

1854

result:

ok single line: '1854'

Test #26:

score: 15
Accepted
time: 1ms
memory: 3828kb

input:

94 392
10 77 10 77
77 51 77 51
44 52 44 52
52 51 52 51
65 90 65 90
80 9 80 9
50 27 50 27
26 57 26 57
90 49 90 49
94 14 94 14
24 6 24 6
19 80 19 80
13 77 13 77
33 73 33 73
45 83 45 83
48 73 48 73
67 12 67 12
36 28 36 28
82 18 82 18
10 80 10 80
66 33 66 33
16 34 16 34
88 13 88 13
7 29 7 29
41 65 41 65...

output:

4388

result:

ok single line: '4388'

Test #27:

score: 15
Accepted
time: 0ms
memory: 3836kb

input:

67 130
38 38 38 38
12 6 12 6
55 13 55 13
24 29 24 29
21 38 21 38
65 6 65 6
36 58 36 58
61 47 61 47
56 7 56 7
43 67 43 67
10 1 10 1
7 50 7 50
57 60 57 60
23 42 23 42
51 27 51 27
20 26 20 26
33 29 33 29
8 48 8 48
58 15 58 15
62 1 62 1
55 28 55 28
24 5 24 5
46 66 46 66
24 28 24 28
58 25 58 25
8 46 8 46...

output:

2238

result:

ok single line: '2238'

Test #28:

score: 15
Accepted
time: 1ms
memory: 3844kb

input:

65 620
19 61 19 61
52 63 52 63
46 11 46 11
17 11 17 11
32 9 32 9
21 55 21 55
14 44 14 44
53 51 53 51
28 25 28 25
27 59 27 59
14 34 14 34
62 23 62 23
24 56 24 56
64 51 64 51
42 43 42 43
48 46 48 46
51 46 51 46
45 22 45 22
23 36 23 36
33 1 33 1
4 36 4 36
27 1 27 1
57 19 57 19
49 1 49 1
61 2 61 2
63 50...

output:

2030

result:

ok single line: '2030'

Test #29:

score: 15
Accepted
time: 1ms
memory: 3552kb

input:

53 538
30 25 30 25
17 23 17 23
42 10 42 10
32 19 32 19
42 6 42 6
7 9 7 9
5 30 5 30
10 51 10 51
22 9 22 9
36 45 36 45
5 39 5 39
40 33 40 33
21 8 21 8
22 40 22 40
20 17 20 17
43 4 43 4
14 30 14 30
14 3 14 3
43 23 43 23
43 36 43 36
22 46 22 46
51 16 51 16
46 6 46 6
33 19 33 19
31 24 31 24
36 20 36 20
2...

output:

1402

result:

ok single line: '1402'

Test #30:

score: 15
Accepted
time: 1ms
memory: 3780kb

input:

66 833
54 9 54 9
9 58 9 58
40 38 40 38
66 40 66 40
56 2 56 2
49 9 49 9
49 32 49 32
18 23 18 23
5 51 5 51
58 48 58 48
39 27 39 27
50 62 50 62
22 32 22 32
49 48 49 48
35 31 35 31
26 15 26 15
62 52 62 52
33 14 33 14
3 17 3 17
1 22 1 22
29 57 29 57
60 19 60 19
35 25 35 25
36 15 36 15
58 39 58 39
29 10 2...

output:

2031

result:

ok single line: '2031'

Test #31:

score: 15
Accepted
time: 1ms
memory: 3560kb

input:

76 942
8 17 8 17
45 67 45 67
49 7 49 7
63 31 63 31
8 47 8 47
68 3 68 3
66 26 66 26
31 47 31 47
42 43 42 43
54 51 54 51
54 50 54 50
30 30 30 30
58 22 58 22
51 3 51 3
47 16 47 16
9 15 9 15
21 2 21 2
50 41 50 41
30 29 30 29
5 69 5 69
13 47 13 47
40 33 40 33
71 17 71 17
18 19 18 19
37 14 37 14
31 49 31 ...

output:

2818

result:

ok single line: '2818'

Test #32:

score: 15
Accepted
time: 1ms
memory: 3616kb

input:

51 996
39 14 39 14
15 41 15 41
7 26 7 26
47 28 47 28
38 12 38 12
13 49 13 49
7 38 7 38
48 29 48 29
28 33 28 33
16 16 16 16
17 49 17 49
16 35 16 35
13 30 13 30
41 26 41 26
1 4 1 4
27 40 27 40
40 11 40 11
37 48 37 48
12 9 12 9
14 1 14 1
1 37 1 37
36 7 36 7
47 12 47 12
28 2 28 2
12 8 12 8
23 12 23 12
2...

output:

1234

result:

ok single line: '1234'

Subtask #4:

score: 0
Wrong Answer

Dependency #2:

100%
Accepted

Test #33:

score: 0
Wrong Answer
time: 14ms
memory: 3816kb

input:

951 27387
498 551 498 551
473 607 473 607
34 412 34 412
235 309 235 309
669 533 669 533
326 206 326 206
820 566 820 566
708 684 708 684
765 192 765 192
437 719 437 719
640 241 640 241
752 327 752 327
677 433 677 433
227 769 227 769
561 182 561 182
813 480 813 480
486 108 486 108
930 705 930 705
473 ...

output:

452084

result:

wrong answer 1st lines differ - expected: '404957', found: '452084'

Subtask #5:

score: 0
Wrong Answer

Test #48:

score: 0
Wrong Answer
time: 50ms
memory: 3480kb

input:

99774 82706
29912 70150 29912 70150
93471 873 93471 873
64978 14740 64978 14740
57016 16856 57016 16856
93392 19170 93392 19170
28713 63187 28713 63187
65553 40025 65553 40025
97816 38346 97816 38346
4184 36771 4184 36771
63515 21172 63515 21172
39860 95092 39860 95092
62818 96699 62818 96699
74942 ...

output:

4977475346

result:

wrong answer 1st lines differ - expected: '4424387268', found: '4977475346'

Subtask #6:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

0%