답안 #684140

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
684140 2023-01-20T14:42:58 Z mychecksedad Chessboard (IZhO18_chessboard) C++17
8 / 100
123 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][y1] = 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 1 ms 300 KB Output is correct
2 Correct 2 ms 212 KB Output is correct
3 Correct 2 ms 212 KB Output is correct
4 Correct 1 ms 300 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 3 ms 300 KB Output is correct
7 Correct 1 ms 300 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 123 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 428 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 428 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 123 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 300 KB Output is correct
2 Correct 2 ms 212 KB Output is correct
3 Correct 2 ms 212 KB Output is correct
4 Correct 1 ms 300 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 3 ms 300 KB Output is correct
7 Correct 1 ms 300 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Runtime error 123 ms 262144 KB Execution killed with signal 9
10 Halted 0 ms 0 KB -