답안 #851337

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
851337 2023-09-19T16:19:26 Z vjudge1 Chessboard (IZhO18_chessboard) C++17
70 / 100
161 ms 3616 KB
#include <bits/stdc++.h>
using namespace std;

int32_t main() {
        ios_base::sync_with_stdio(0);
        cin.tie(0);
        int n, k;
        cin >> n >> k;
        vector<int> a(k), b(k);
        for (int i = 0; i < k; i++) {
                cin >> a[i], a[i]--;
                cin >> b[i], b[i]--;
                int _;
                cin >> _;
                cin >> _;
        }

        int64_t res = 1ll * n * n;
        vector<int64_t> cntb(2, 0);
        vector<int64_t> need(2, 0);
        for (int i = 1; i < n; i++) {
                if (n % i) continue;

                vector<int64_t> cntb(2, 0);
                vector<int64_t> need(2, 0);

                need[0] = 1ll * (n / i) * (n / i);
                need[1] = need[0] / 2;
                need[0] -= need[1];
                need[0] *= 1ll * i * i;
                need[1] *= 1ll * i * i;

                for (int j = 0; j < k; j++) {
                        int x = a[j] / i;
                        int y = b[j] / i;
                        cntb[(x ^ y) & 1]++;
                }

                /// (0, 0) white
                res = min(res, cntb[0] + need[1] - cntb[1]);
                res = min(res, need[0] - cntb[0] + cntb[1]);
        }

        cout << res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 2396 KB Output is correct
2 Correct 5 ms 860 KB Output is correct
3 Correct 12 ms 1720 KB Output is correct
4 Correct 12 ms 1628 KB Output is correct
5 Correct 15 ms 2040 KB Output is correct
6 Correct 11 ms 1484 KB Output is correct
7 Correct 2 ms 620 KB Output is correct
8 Correct 11 ms 1492 KB Output is correct
9 Correct 25 ms 3160 KB Output is correct
10 Correct 13 ms 1884 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 352 KB Output is correct
2 Correct 0 ms 604 KB Output is correct
3 Correct 0 ms 356 KB Output is correct
4 Correct 1 ms 356 KB Output is correct
5 Correct 1 ms 608 KB Output is correct
6 Correct 1 ms 352 KB Output is correct
7 Correct 1 ms 512 KB Output is correct
8 Correct 1 ms 356 KB Output is correct
9 Correct 0 ms 356 KB Output is correct
10 Correct 1 ms 356 KB Output is correct
11 Correct 0 ms 356 KB Output is correct
12 Correct 1 ms 608 KB Output is correct
13 Correct 1 ms 504 KB Output is correct
14 Correct 1 ms 356 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 352 KB Output is correct
2 Correct 0 ms 604 KB Output is correct
3 Correct 0 ms 356 KB Output is correct
4 Correct 1 ms 356 KB Output is correct
5 Correct 1 ms 608 KB Output is correct
6 Correct 1 ms 352 KB Output is correct
7 Correct 1 ms 512 KB Output is correct
8 Correct 1 ms 356 KB Output is correct
9 Correct 0 ms 356 KB Output is correct
10 Correct 1 ms 356 KB Output is correct
11 Correct 0 ms 356 KB Output is correct
12 Correct 1 ms 608 KB Output is correct
13 Correct 1 ms 504 KB Output is correct
14 Correct 1 ms 356 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 7 ms 856 KB Output is correct
17 Correct 27 ms 2392 KB Output is correct
18 Correct 23 ms 2652 KB Output is correct
19 Correct 46 ms 2384 KB Output is correct
20 Correct 45 ms 2820 KB Output is correct
21 Correct 17 ms 2244 KB Output is correct
22 Correct 0 ms 452 KB Output is correct
23 Correct 11 ms 1368 KB Output is correct
24 Correct 20 ms 2392 KB Output is correct
25 Correct 3 ms 600 KB Output is correct
26 Correct 13 ms 1624 KB Output is correct
27 Correct 22 ms 1880 KB Output is correct
28 Correct 23 ms 2644 KB Output is correct
29 Correct 8 ms 1112 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 2396 KB Output is correct
2 Correct 5 ms 860 KB Output is correct
3 Correct 12 ms 1720 KB Output is correct
4 Correct 12 ms 1628 KB Output is correct
5 Correct 15 ms 2040 KB Output is correct
6 Correct 11 ms 1484 KB Output is correct
7 Correct 2 ms 620 KB Output is correct
8 Correct 11 ms 1492 KB Output is correct
9 Correct 25 ms 3160 KB Output is correct
10 Correct 13 ms 1884 KB Output is correct
11 Correct 1 ms 352 KB Output is correct
12 Correct 0 ms 604 KB Output is correct
13 Correct 0 ms 356 KB Output is correct
14 Correct 1 ms 356 KB Output is correct
15 Correct 1 ms 608 KB Output is correct
16 Correct 1 ms 352 KB Output is correct
17 Correct 1 ms 512 KB Output is correct
18 Correct 1 ms 356 KB Output is correct
19 Correct 0 ms 356 KB Output is correct
20 Correct 1 ms 356 KB Output is correct
21 Correct 0 ms 356 KB Output is correct
22 Correct 1 ms 608 KB Output is correct
23 Correct 1 ms 504 KB Output is correct
24 Correct 1 ms 356 KB Output is correct
25 Correct 1 ms 344 KB Output is correct
26 Correct 7 ms 856 KB Output is correct
27 Correct 27 ms 2392 KB Output is correct
28 Correct 23 ms 2652 KB Output is correct
29 Correct 46 ms 2384 KB Output is correct
30 Correct 45 ms 2820 KB Output is correct
31 Correct 17 ms 2244 KB Output is correct
32 Correct 0 ms 452 KB Output is correct
33 Correct 11 ms 1368 KB Output is correct
34 Correct 20 ms 2392 KB Output is correct
35 Correct 3 ms 600 KB Output is correct
36 Correct 13 ms 1624 KB Output is correct
37 Correct 22 ms 1880 KB Output is correct
38 Correct 23 ms 2644 KB Output is correct
39 Correct 8 ms 1112 KB Output is correct
40 Correct 1 ms 348 KB Output is correct
41 Correct 40 ms 2896 KB Output is correct
42 Correct 26 ms 3440 KB Output is correct
43 Correct 31 ms 2904 KB Output is correct
44 Correct 26 ms 3160 KB Output is correct
45 Correct 25 ms 3408 KB Output is correct
46 Correct 48 ms 3476 KB Output is correct
47 Correct 22 ms 3280 KB Output is correct
48 Correct 32 ms 3040 KB Output is correct
49 Correct 23 ms 2916 KB Output is correct
50 Correct 143 ms 3152 KB Output is correct
51 Correct 152 ms 3412 KB Output is correct
52 Correct 143 ms 3304 KB Output is correct
53 Correct 151 ms 3416 KB Output is correct
54 Correct 146 ms 3356 KB Output is correct
55 Correct 161 ms 3616 KB Output is correct
56 Correct 136 ms 3184 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 16 ms 2396 KB Output is correct
10 Correct 5 ms 860 KB Output is correct
11 Correct 12 ms 1720 KB Output is correct
12 Correct 12 ms 1628 KB Output is correct
13 Correct 15 ms 2040 KB Output is correct
14 Correct 11 ms 1484 KB Output is correct
15 Correct 2 ms 620 KB Output is correct
16 Correct 11 ms 1492 KB Output is correct
17 Correct 25 ms 3160 KB Output is correct
18 Correct 13 ms 1884 KB Output is correct
19 Correct 1 ms 352 KB Output is correct
20 Correct 0 ms 604 KB Output is correct
21 Correct 0 ms 356 KB Output is correct
22 Correct 1 ms 356 KB Output is correct
23 Correct 1 ms 608 KB Output is correct
24 Correct 1 ms 352 KB Output is correct
25 Correct 1 ms 512 KB Output is correct
26 Correct 1 ms 356 KB Output is correct
27 Correct 0 ms 356 KB Output is correct
28 Correct 1 ms 356 KB Output is correct
29 Correct 0 ms 356 KB Output is correct
30 Correct 1 ms 608 KB Output is correct
31 Correct 1 ms 504 KB Output is correct
32 Correct 1 ms 356 KB Output is correct
33 Correct 1 ms 344 KB Output is correct
34 Correct 7 ms 856 KB Output is correct
35 Correct 27 ms 2392 KB Output is correct
36 Correct 23 ms 2652 KB Output is correct
37 Correct 46 ms 2384 KB Output is correct
38 Correct 45 ms 2820 KB Output is correct
39 Correct 17 ms 2244 KB Output is correct
40 Correct 0 ms 452 KB Output is correct
41 Correct 11 ms 1368 KB Output is correct
42 Correct 20 ms 2392 KB Output is correct
43 Correct 3 ms 600 KB Output is correct
44 Correct 13 ms 1624 KB Output is correct
45 Correct 22 ms 1880 KB Output is correct
46 Correct 23 ms 2644 KB Output is correct
47 Correct 8 ms 1112 KB Output is correct
48 Correct 1 ms 348 KB Output is correct
49 Correct 40 ms 2896 KB Output is correct
50 Correct 26 ms 3440 KB Output is correct
51 Correct 31 ms 2904 KB Output is correct
52 Correct 26 ms 3160 KB Output is correct
53 Correct 25 ms 3408 KB Output is correct
54 Correct 48 ms 3476 KB Output is correct
55 Correct 22 ms 3280 KB Output is correct
56 Correct 32 ms 3040 KB Output is correct
57 Correct 23 ms 2916 KB Output is correct
58 Correct 143 ms 3152 KB Output is correct
59 Correct 152 ms 3412 KB Output is correct
60 Correct 143 ms 3304 KB Output is correct
61 Correct 151 ms 3416 KB Output is correct
62 Correct 146 ms 3356 KB Output is correct
63 Correct 161 ms 3616 KB Output is correct
64 Correct 136 ms 3184 KB Output is correct
65 Correct 1 ms 344 KB Output is correct
66 Incorrect 0 ms 344 KB Output isn't correct
67 Halted 0 ms 0 KB -