QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#750760 | #504. Chessboard | Bucketsmith | 8 | 26ms | 3844kb | C++20 | 753b | 2024-11-15 15:49:20 | 2024-11-15 15:49:21 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using pii = pair<int, int>;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, k;
cin >> n >> k;
vector<pii> v(k);
for(auto &[x, y] : v) {
int t1, t2;
cin >> x >> y >> t1 >> t2;
x --;
y --;
}
i64 ans = n * (i64)n;
for(int i = 1; i < n; i ++) {
if(n % i) continue;
i64 b = (n / i * (i64)(n / i) / 2 + (n / i) % 2) * (i64)i * i, w = (i64)n * n - b;
for(auto &[x, y] : v) {
if(((x / i) ^ (y / i)) & 1) w --;
else b --;
}
if(b < ans) ans = b;
if(w < ans) ans = w;
}
cout << ans << "\n";
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 8
Accepted
Test #1:
score: 8
Accepted
time: 0ms
memory: 3844kb
input:
100 0
output:
4800
result:
ok single line: '4800'
Test #2:
score: 8
Accepted
time: 0ms
memory: 3492kb
input:
99 0
output:
4356
result:
ok single line: '4356'
Test #3:
score: 8
Accepted
time: 0ms
memory: 3844kb
input:
98 0
output:
4704
result:
ok single line: '4704'
Test #4:
score: 8
Accepted
time: 0ms
memory: 3812kb
input:
97 0
output:
4704
result:
ok single line: '4704'
Test #5:
score: 8
Accepted
time: 0ms
memory: 3552kb
input:
96 0
output:
4096
result:
ok single line: '4096'
Test #6:
score: 8
Accepted
time: 0ms
memory: 3592kb
input:
95 0
output:
4332
result:
ok single line: '4332'
Test #7:
score: 8
Accepted
time: 0ms
memory: 3816kb
input:
94 0
output:
4416
result:
ok single line: '4416'
Subtask #2:
score: 0
Wrong Answer
Test #8:
score: 0
Wrong Answer
time: 12ms
memory: 3604kb
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:
1929353698
result:
wrong answer 1st lines differ - expected: '1929384918', found: '1929353698'
Subtask #3:
score: 0
Wrong Answer
Test #18:
score: 0
Wrong Answer
time: 0ms
memory: 3608kb
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:
2578
result:
wrong answer 1st lines differ - expected: '2732', found: '2578'
Subtask #4:
score: 0
Skipped
Dependency #2:
0%
Subtask #5:
score: 0
Wrong Answer
Test #48:
score: 0
Wrong Answer
time: 26ms
memory: 3792kb
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:
4424341409
result:
wrong answer 1st lines differ - expected: '4424387268', found: '4424341409'
Subtask #6:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%