답안 #341349

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
341349 2020-12-29T14:17:51 Z Tosic Chessboard (IZhO18_chessboard) C++14
70 / 100
369 ms 4464 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;

int n, k;
long long ans;
vector<pair<int, int> > allW;

void tryFor(int d){
	if(d == n){
		return;
	}
	// 0 0 is black
	long long blArea = 1LL*d*d*(((n/d)*(n/d)+1)/2);
	for(auto i : allW){
		if( (i.first/d + i.second/d)%2 ){
			blArea++;
		} else {
			blArea--;
		}
	}
	ans = min(ans, blArea);
	// 0 0 is BUANA
	blArea = 1ll*d*d*(((n/d)*(n/d))/2);
	for(auto i : allW){
		//cerr << i.first/d + i.second/d << '\n';
		if( (i.first/d + i.second/d)%2 ){
			blArea--;
		} else {
			blArea++;
		}
	}
	ans = min(ans, blArea);
	return;
}

signed main(){
	ios_base::sync_with_stdio(0);
	cout.tie(0);
	cin.tie(0);
	cin >> n >> k;
	ans = 1e10;
	for(int i = 0; i < k; ++i){
		int x, y;
		cin >> x >> y;
		cin >> x >> y;
		--x,--y;
		allW.push_back({x,y});
	}
	for(int i = 1; i*i <= n; ++i){
		if(n%i == 0){
			tryFor(n/i);
			tryFor(i);
		}
	}
	cout<<ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 1516 KB Output is correct
2 Correct 7 ms 1392 KB Output is correct
3 Correct 17 ms 2444 KB Output is correct
4 Correct 18 ms 2284 KB Output is correct
5 Correct 25 ms 2664 KB Output is correct
6 Correct 15 ms 2284 KB Output is correct
7 Correct 5 ms 748 KB Output is correct
8 Correct 15 ms 2284 KB Output is correct
9 Correct 38 ms 4200 KB Output is correct
10 Correct 21 ms 2540 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 512 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 512 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 11 ms 1008 KB Output is correct
17 Correct 29 ms 2536 KB Output is correct
18 Correct 47 ms 2556 KB Output is correct
19 Correct 87 ms 2536 KB Output is correct
20 Correct 98 ms 2536 KB Output is correct
21 Correct 28 ms 2536 KB Output is correct
22 Correct 1 ms 364 KB Output is correct
23 Correct 21 ms 1516 KB Output is correct
24 Correct 35 ms 2536 KB Output is correct
25 Correct 5 ms 748 KB Output is correct
26 Correct 23 ms 1516 KB Output is correct
27 Correct 30 ms 2536 KB Output is correct
28 Correct 38 ms 2536 KB Output is correct
29 Correct 15 ms 1516 KB Output is correct
30 Correct 2 ms 492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 1516 KB Output is correct
2 Correct 7 ms 1392 KB Output is correct
3 Correct 17 ms 2444 KB Output is correct
4 Correct 18 ms 2284 KB Output is correct
5 Correct 25 ms 2664 KB Output is correct
6 Correct 15 ms 2284 KB Output is correct
7 Correct 5 ms 748 KB Output is correct
8 Correct 15 ms 2284 KB Output is correct
9 Correct 38 ms 4200 KB Output is correct
10 Correct 21 ms 2540 KB Output is correct
11 Correct 1 ms 512 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 512 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 1 ms 364 KB Output is correct
23 Correct 1 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 1 ms 364 KB Output is correct
26 Correct 11 ms 1008 KB Output is correct
27 Correct 29 ms 2536 KB Output is correct
28 Correct 47 ms 2556 KB Output is correct
29 Correct 87 ms 2536 KB Output is correct
30 Correct 98 ms 2536 KB Output is correct
31 Correct 28 ms 2536 KB Output is correct
32 Correct 1 ms 364 KB Output is correct
33 Correct 21 ms 1516 KB Output is correct
34 Correct 35 ms 2536 KB Output is correct
35 Correct 5 ms 748 KB Output is correct
36 Correct 23 ms 1516 KB Output is correct
37 Correct 30 ms 2536 KB Output is correct
38 Correct 38 ms 2536 KB Output is correct
39 Correct 15 ms 1516 KB Output is correct
40 Correct 2 ms 492 KB Output is correct
41 Correct 81 ms 4248 KB Output is correct
42 Correct 43 ms 4328 KB Output is correct
43 Correct 55 ms 4328 KB Output is correct
44 Correct 42 ms 4328 KB Output is correct
45 Correct 40 ms 4464 KB Output is correct
46 Correct 96 ms 4328 KB Output is correct
47 Correct 36 ms 4328 KB Output is correct
48 Correct 52 ms 4328 KB Output is correct
49 Correct 39 ms 4328 KB Output is correct
50 Correct 331 ms 4328 KB Output is correct
51 Correct 354 ms 4328 KB Output is correct
52 Correct 330 ms 4328 KB Output is correct
53 Correct 351 ms 4328 KB Output is correct
54 Correct 333 ms 4328 KB Output is correct
55 Correct 369 ms 4452 KB Output is correct
56 Correct 318 ms 4328 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 25 ms 1516 KB Output is correct
10 Correct 7 ms 1392 KB Output is correct
11 Correct 17 ms 2444 KB Output is correct
12 Correct 18 ms 2284 KB Output is correct
13 Correct 25 ms 2664 KB Output is correct
14 Correct 15 ms 2284 KB Output is correct
15 Correct 5 ms 748 KB Output is correct
16 Correct 15 ms 2284 KB Output is correct
17 Correct 38 ms 4200 KB Output is correct
18 Correct 21 ms 2540 KB Output is correct
19 Correct 1 ms 512 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 1 ms 364 KB Output is correct
23 Correct 1 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 1 ms 364 KB Output is correct
26 Correct 1 ms 364 KB Output is correct
27 Correct 1 ms 512 KB Output is correct
28 Correct 1 ms 364 KB Output is correct
29 Correct 1 ms 364 KB Output is correct
30 Correct 1 ms 364 KB Output is correct
31 Correct 1 ms 364 KB Output is correct
32 Correct 1 ms 364 KB Output is correct
33 Correct 1 ms 364 KB Output is correct
34 Correct 11 ms 1008 KB Output is correct
35 Correct 29 ms 2536 KB Output is correct
36 Correct 47 ms 2556 KB Output is correct
37 Correct 87 ms 2536 KB Output is correct
38 Correct 98 ms 2536 KB Output is correct
39 Correct 28 ms 2536 KB Output is correct
40 Correct 1 ms 364 KB Output is correct
41 Correct 21 ms 1516 KB Output is correct
42 Correct 35 ms 2536 KB Output is correct
43 Correct 5 ms 748 KB Output is correct
44 Correct 23 ms 1516 KB Output is correct
45 Correct 30 ms 2536 KB Output is correct
46 Correct 38 ms 2536 KB Output is correct
47 Correct 15 ms 1516 KB Output is correct
48 Correct 2 ms 492 KB Output is correct
49 Correct 81 ms 4248 KB Output is correct
50 Correct 43 ms 4328 KB Output is correct
51 Correct 55 ms 4328 KB Output is correct
52 Correct 42 ms 4328 KB Output is correct
53 Correct 40 ms 4464 KB Output is correct
54 Correct 96 ms 4328 KB Output is correct
55 Correct 36 ms 4328 KB Output is correct
56 Correct 52 ms 4328 KB Output is correct
57 Correct 39 ms 4328 KB Output is correct
58 Correct 331 ms 4328 KB Output is correct
59 Correct 354 ms 4328 KB Output is correct
60 Correct 330 ms 4328 KB Output is correct
61 Correct 351 ms 4328 KB Output is correct
62 Correct 333 ms 4328 KB Output is correct
63 Correct 369 ms 4452 KB Output is correct
64 Correct 318 ms 4328 KB Output is correct
65 Correct 1 ms 364 KB Output is correct
66 Incorrect 1 ms 364 KB Output isn't correct
67 Halted 0 ms 0 KB -