Submission #684151

# Submission time Handle Problem Language Result Execution time Memory
684151 2023-01-20T14:53:47 Z mychecksedad Chessboard (IZhO18_chessboard) C++17
0 / 100
89 ms 816 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<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});
	}
	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 j = 0; j < k; ++j){
					bool type = (v[j].first / i + v[j].second / i) % 2;
					c -= type ^ rep;
				}
				ans = min(ans, c + (rep ? n*n/2 : n*n/2+1));
			}

		}
	}
	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;
      |      ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 89 ms 816 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 89 ms 816 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -