답안 #495172

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
495172 2021-12-18T06:00:41 Z Mukhitali Chessboard (IZhO18_chessboard) C++17
0 / 100
25 ms 1092 KB
//bit chass 1
#include <bits/stdc++.h>

#define x first
#define y second
#define el "\n"
#define ll long long
#define pb push_back
#define pll pair <ll, ll>
#define pii pair <int, int>
#define all(x) x.begin(), x.end()
#define lca(x,y) x * y / __gcd(x, y)
#define ibase ios_base::sync_with_stdio(0), cin.tie(0)

using namespace std;

const int N = 2e5 + 5, inf = 1e9 + 7, M = 2e6, MM = 2e6 + 5, K = 300;
const ll MI = 2e18;
const double P = 3.14;


void solve() {
	int n, k;
	cin >> n >> k;
	if (k == 0) {
		cout << n * (n / 2) + (n % 2) * (n / 2);
	}
	else {
		int k1 = 0, k2 = 0;
		for (int i = 1; i <= k; i++) {
			int x1, y1, x2, y2;
			cin >> x1 >> y1 >> x2 >> y2;
			if ((x1 + y1) % 2)
				k1++;
			else 
				k2++;
		}
		if (n % 2) {
			cout << min(((n + 1) * (n / 2)) + k2 - k1, ((n + 1) * (n / 2) + 1) + k1 - k2);
		}
		else {
			cout << min((n * (n / 2)) + k1 -k2, (n * (n / 2)) + k2 - k1);
		}
	} 
		

}

int main() {
	ibase;
	int T = 1;
//	cin >> T;
	for (int i = 1; i <= T; i++) {
//		cout << "Case " << i << ": ";
		solve();
		cout << el;
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 1092 KB Output is correct
2 Correct 6 ms 572 KB Output is correct
3 Incorrect 13 ms 960 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 1092 KB Output is correct
2 Correct 6 ms 572 KB Output is correct
3 Incorrect 13 ms 960 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -