답안 #895266

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
895266 2023-12-29T17:18:47 Z Andrey Chessboard (IZhO18_chessboard) C++14
70 / 100
282 ms 4388 KB
#include<bits/stdc++.h>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    long long n,k,x,y,ans = LLONG_MAX;
    cin >> n >> k;
    vector<pair<long long,long long>> haha(0);
    for(long long i = 0; i < k; i++) {
        cin >> x >> y >> x >> y;
        haha.push_back({x-1,y-1});
    }
    for(long long i = 1; i < n; i++) {
        if(n%i == 0) {
            long long br = (((n/i)*(n/i)+1)/2)*i*i;
            for(long long j = 0; j < k; j++) {
                if((haha[j].first%(2*i) < i) == (haha[j].second%(2*i) < i)) {
                    br--;
                }
                else {
                    br++;
                }
            }
            ans = min(ans,br);
            br = (((n/i)*(n/i))/2)*i*i;
            for(long long j = 0; j < k; j++) {
                if((haha[j].first%(2*i) < i) != (haha[j].second%(2*i) < i)) {
                    br--;
                }
                else {
                    br++;
                }
            }
            ans = min(ans,br);
        }
    }
    cout << ans;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 600 KB Output is correct
4 Correct 0 ms 456 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 452 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 18 ms 3024 KB Output is correct
2 Correct 7 ms 1236 KB Output is correct
3 Correct 12 ms 2404 KB Output is correct
4 Correct 13 ms 2180 KB Output is correct
5 Correct 16 ms 2724 KB Output is correct
6 Correct 11 ms 2272 KB Output is correct
7 Correct 3 ms 836 KB Output is correct
8 Correct 10 ms 2444 KB Output is correct
9 Correct 34 ms 4264 KB Output is correct
10 Correct 14 ms 2524 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 500 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 452 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 464 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 500 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 452 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 464 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 8 ms 1500 KB Output is correct
17 Correct 19 ms 3800 KB Output is correct
18 Correct 26 ms 3800 KB Output is correct
19 Correct 64 ms 3792 KB Output is correct
20 Correct 75 ms 3796 KB Output is correct
21 Correct 18 ms 3800 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 15 ms 2268 KB Output is correct
24 Correct 29 ms 3732 KB Output is correct
25 Correct 4 ms 860 KB Output is correct
26 Correct 15 ms 2360 KB Output is correct
27 Correct 21 ms 3800 KB Output is correct
28 Correct 25 ms 3800 KB Output is correct
29 Correct 8 ms 2008 KB Output is correct
30 Correct 1 ms 600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 18 ms 3024 KB Output is correct
2 Correct 7 ms 1236 KB Output is correct
3 Correct 12 ms 2404 KB Output is correct
4 Correct 13 ms 2180 KB Output is correct
5 Correct 16 ms 2724 KB Output is correct
6 Correct 11 ms 2272 KB Output is correct
7 Correct 3 ms 836 KB Output is correct
8 Correct 10 ms 2444 KB Output is correct
9 Correct 34 ms 4264 KB Output is correct
10 Correct 14 ms 2524 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 500 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 452 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 464 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 8 ms 1500 KB Output is correct
27 Correct 19 ms 3800 KB Output is correct
28 Correct 26 ms 3800 KB Output is correct
29 Correct 64 ms 3792 KB Output is correct
30 Correct 75 ms 3796 KB Output is correct
31 Correct 18 ms 3800 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 15 ms 2268 KB Output is correct
34 Correct 29 ms 3732 KB Output is correct
35 Correct 4 ms 860 KB Output is correct
36 Correct 15 ms 2360 KB Output is correct
37 Correct 21 ms 3800 KB Output is correct
38 Correct 25 ms 3800 KB Output is correct
39 Correct 8 ms 2008 KB Output is correct
40 Correct 1 ms 600 KB Output is correct
41 Correct 63 ms 4312 KB Output is correct
42 Correct 36 ms 4304 KB Output is correct
43 Correct 46 ms 4240 KB Output is correct
44 Correct 30 ms 4304 KB Output is correct
45 Correct 26 ms 4308 KB Output is correct
46 Correct 70 ms 4168 KB Output is correct
47 Correct 24 ms 4300 KB Output is correct
48 Correct 34 ms 4312 KB Output is correct
49 Correct 32 ms 4388 KB Output is correct
50 Correct 258 ms 4308 KB Output is correct
51 Correct 277 ms 4312 KB Output is correct
52 Correct 256 ms 4312 KB Output is correct
53 Correct 273 ms 4312 KB Output is correct
54 Correct 254 ms 4308 KB Output is correct
55 Correct 282 ms 4308 KB Output is correct
56 Correct 244 ms 4308 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 600 KB Output is correct
4 Correct 0 ms 456 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 452 KB Output is correct
9 Correct 18 ms 3024 KB Output is correct
10 Correct 7 ms 1236 KB Output is correct
11 Correct 12 ms 2404 KB Output is correct
12 Correct 13 ms 2180 KB Output is correct
13 Correct 16 ms 2724 KB Output is correct
14 Correct 11 ms 2272 KB Output is correct
15 Correct 3 ms 836 KB Output is correct
16 Correct 10 ms 2444 KB Output is correct
17 Correct 34 ms 4264 KB Output is correct
18 Correct 14 ms 2524 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 1 ms 500 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 452 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 464 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 8 ms 1500 KB Output is correct
35 Correct 19 ms 3800 KB Output is correct
36 Correct 26 ms 3800 KB Output is correct
37 Correct 64 ms 3792 KB Output is correct
38 Correct 75 ms 3796 KB Output is correct
39 Correct 18 ms 3800 KB Output is correct
40 Correct 1 ms 348 KB Output is correct
41 Correct 15 ms 2268 KB Output is correct
42 Correct 29 ms 3732 KB Output is correct
43 Correct 4 ms 860 KB Output is correct
44 Correct 15 ms 2360 KB Output is correct
45 Correct 21 ms 3800 KB Output is correct
46 Correct 25 ms 3800 KB Output is correct
47 Correct 8 ms 2008 KB Output is correct
48 Correct 1 ms 600 KB Output is correct
49 Correct 63 ms 4312 KB Output is correct
50 Correct 36 ms 4304 KB Output is correct
51 Correct 46 ms 4240 KB Output is correct
52 Correct 30 ms 4304 KB Output is correct
53 Correct 26 ms 4308 KB Output is correct
54 Correct 70 ms 4168 KB Output is correct
55 Correct 24 ms 4300 KB Output is correct
56 Correct 34 ms 4312 KB Output is correct
57 Correct 32 ms 4388 KB Output is correct
58 Correct 258 ms 4308 KB Output is correct
59 Correct 277 ms 4312 KB Output is correct
60 Correct 256 ms 4312 KB Output is correct
61 Correct 273 ms 4312 KB Output is correct
62 Correct 254 ms 4308 KB Output is correct
63 Correct 282 ms 4308 KB Output is correct
64 Correct 244 ms 4308 KB Output is correct
65 Correct 0 ms 348 KB Output is correct
66 Incorrect 0 ms 348 KB Output isn't correct
67 Halted 0 ms 0 KB -