답안 #684167

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
684167 2023-01-20T15:06:06 Z mychecksedad Chessboard (IZhO18_chessboard) C++17
39 / 100
136 ms 1440 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define all(x) x.begin() x.end()
#define MOD (1e9+7)
const int N = 1e6;

ll n, k, ans = MOD;
vector<pair<int, int>> v;
void solve(){
	cin >> n >> k;
	int a = 0;
	for(int i = 0; i < k; ++i){
		int x1, x2, y1, y2; cin >> x1 >> y1 >> x2 >> y2;
		v.pb({x1-1,y1-1});
	}
	for(int i = 1; i < n; ++i){
		if(n % i == 0){
			for(int rep = 0; rep < 2; ++rep){
				int c = 0;
				for(int j = 0; j < k; ++j){
					bool type = (v[j].first / i + v[j].second / i) % 2;
					if((type ^ rep) == 0) c--;
					else c++;
				}
				ans = min(ans, c + (rep ? (n/i)*(n/i)/2*i*i : ((n/i)*(n/i) + 1)/2*i*i));
			}

		}
	}
	cout << ans;
}

int main(){
	solve();
	return 0;
}

Compilation message

chessboard.cpp: In function 'void solve()':
chessboard.cpp:13:6: warning: unused variable 'a' [-Wunused-variable]
   13 |  int a = 0;
      |      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 75 ms 880 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 2 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 2 ms 296 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 2 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 2 ms 296 KB Output is correct
16 Correct 26 ms 656 KB Output is correct
17 Correct 84 ms 1408 KB Output is correct
18 Correct 88 ms 1440 KB Output is correct
19 Correct 126 ms 1360 KB Output is correct
20 Correct 136 ms 1388 KB Output is correct
21 Correct 84 ms 1416 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 40 ms 848 KB Output is correct
24 Correct 77 ms 1348 KB Output is correct
25 Correct 8 ms 468 KB Output is correct
26 Correct 48 ms 884 KB Output is correct
27 Correct 63 ms 1332 KB Output is correct
28 Correct 84 ms 1412 KB Output is correct
29 Correct 28 ms 884 KB Output is correct
30 Correct 3 ms 324 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 75 ms 880 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Incorrect 75 ms 880 KB Output isn't correct
10 Halted 0 ms 0 KB -