답안 #684143

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
684143 2023-01-20T14:43:58 Z mychecksedad Chessboard (IZhO18_chessboard) C++17
39 / 100
333 ms 262144 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;

int n, k;
vector<vector<bool>> v;
void solve(){
	cin >> n >> k;
	v.resize(n);
	for(int i = 0; i < n; ++i) v[i].resize(n);
	for(int i = 0; i < k; ++i){
		int x1, x2, y1, y2; cin >> x1 >> y1 >> x2 >> y2;
		v[x1 - 1][y1 - 1] = 1;
	}
	int ans = MOD;
	for(int i = 1; i < n; ++i){
		if(n % i == 0){
			for(int rep = 0; rep < 2; ++rep){
				int c = 0;
				for(int jx = 0; jx < n; ++jx){
					for(int jy = 0; jy < n; ++jy){
						int val = jx/i + jy/i;
						c += (val%2)^rep^v[jx][jy];
					}
				}
				ans = min(ans, c);
			}

		}
	}
	cout << ans;
}

int main(){
	solve();
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 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 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 122 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 1 ms 304 KB Output is correct
4 Correct 1 ms 304 KB Output is correct
5 Correct 2 ms 304 KB Output is correct
6 Correct 1 ms 304 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 312 KB Output is correct
14 Correct 1 ms 304 KB Output is correct
15 Correct 1 ms 312 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 1 ms 304 KB Output is correct
4 Correct 1 ms 304 KB Output is correct
5 Correct 2 ms 304 KB Output is correct
6 Correct 1 ms 304 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 312 KB Output is correct
14 Correct 1 ms 304 KB Output is correct
15 Correct 1 ms 312 KB Output is correct
16 Correct 51 ms 888 KB Output is correct
17 Correct 88 ms 1728 KB Output is correct
18 Correct 111 ms 2052 KB Output is correct
19 Correct 333 ms 1740 KB Output is correct
20 Correct 332 ms 2028 KB Output is correct
21 Correct 73 ms 1728 KB Output is correct
22 Correct 158 ms 480 KB Output is correct
23 Correct 112 ms 1076 KB Output is correct
24 Correct 101 ms 1824 KB Output is correct
25 Correct 74 ms 584 KB Output is correct
26 Correct 84 ms 1324 KB Output is correct
27 Correct 109 ms 1456 KB Output is correct
28 Correct 103 ms 1972 KB Output is correct
29 Correct 37 ms 960 KB Output is correct
30 Correct 35 ms 556 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 122 ms 262144 KB Execution killed with signal 9
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 1 ms 212 KB Output is correct
4 Correct 1 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 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Runtime error 122 ms 262144 KB Execution killed with signal 9
10 Halted 0 ms 0 KB -