Submission #495172

#TimeUsernameProblemLanguageResultExecution timeMemory
495172MukhitaliChessboard (IZhO18_chessboard)C++17
0 / 100
25 ms1092 KiB
//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; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...