# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
378602 | 2021-03-17T02:09:40 Z | LittleCube | Chessboard (IZhO18_chessboard) | C++14 | 77 ms | 2332 KB |
#include <bits/stdc++.h> #define int long long using namespace std; /************************************* * * Without Subtask 4 : 70 points * */ struct point { int x1, y1, x2, y2; }; signed main() { int n, m, k, ans = 1000000000; cin >> n >> k; vector<point> v(k); for (int i = 0; i < k; i++) cin >> v[i].x1 >> v[i].y1 >> v[i].x2 >> v[i].y2; for (int i = 1; i <= sqrt(n); i++) if (n % i == 0) { int l = 0, r = 0; for (auto j : v) if (((j.x1 + i - 1) / i + (j.y1 + i - 1) / i) % 2) r++; else l++; //cout << i << " " << min({(n * n - i * i + 1) / 2 - l + r, (n * n - i * i) / 2 + l - r}) << '\n'; if (n / i % 2) ans = min({ans, (n * n - i * i) / 2 + i * i - l + r, (n * n - i * i) / 2 + l - r}); else ans = min({ans, (n * n) / 2 - l + r, (n * n) / 2 + l - r}); } cout << ans << '\n'; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 364 KB | Output is correct |
2 | Incorrect | 1 ms | 364 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 77 ms | 2332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 364 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 364 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 77 ms | 2332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 364 KB | Output is correct |
2 | Incorrect | 1 ms | 364 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |