QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#832636#504. ChessboardI_love_Banu#23 1ms3844kbC++141.7kb2024-12-26 01:14:242024-12-26 01:14:24

Judging History

你现在查看的是最新测评结果

  • [2024-12-26 01:14:24]
  • 评测
  • 测评结果:23
  • 用时:1ms
  • 内存:3844kb
  • [2024-12-26 01:14:24]
  • 提交

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;

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

	brd[Y1][X1] = 1;
    }

    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: 3504kb

input:

100 0

output:

4800

result:

ok single line: '4800'

Test #2:

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

input:

99 0

output:

4356

result:

ok single line: '4356'

Test #3:

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

input:

98 0

output:

4704

result:

ok single line: '4704'

Test #4:

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

input:

97 0

output:

4704

result:

ok single line: '4704'

Test #5:

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

input:

96 0

output:

4096

result:

ok single line: '4096'

Test #6:

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

input:

95 0

output:

4332

result:

ok single line: '4332'

Test #7:

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

input:

94 0

output:

4416

result:

ok single line: '4416'

Subtask #2:

score: 0
Runtime Error

Test #8:

score: 0
Runtime Error

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:


result:


Subtask #3:

score: 15
Accepted

Test #18:

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

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: 3844kb

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: 3616kb

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: 3624kb

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: 3620kb

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: 3552kb

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: 3620kb

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: 0ms
memory: 3616kb

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: 0ms
memory: 3628kb

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: 3496kb

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: 3616kb

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: 3608kb

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: 3500kb

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: 3616kb

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: 3524kb

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
Skipped

Dependency #2:

0%

Subtask #5:

score: 0
Runtime Error

Test #48:

score: 0
Runtime Error

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:


result:


Subtask #6:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%