#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using ull = uint64_t;
using uint = uint32_t;
using ld = long double;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const ll LINF = 2e18;
const double EPS = 1e-9;
#define EMT ios::sync_with_stdio(0); cin.tie(0);
bool prime_test(int n) {
for(int i = 2; i < n; i++)
if(n % i == 0)
return false;
return true;
}
void solve(int n) {
int k;
cin >> k;
}
void solve_2(int n) {
int cnt[2] = {0}, k;
cin >> k;
for(int i = 0, a, b, c, d; i < k; i++) {
cin >> a >> b >> c >> d;
cnt[(a + b) % 2]++;
}
ll a = 1LL * n * n / 2, b = 1LL * n * n - a;
cout << min(cnt[1] + b - cnt[0], cnt[0] + a - cnt[1]) << '\n';
}
signed main() { EMT
int n;
cin >> n;
if(prime_test(n))
solve_2(n);
else
solve(n);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
364 KB |
Output is correct |
2 |
Correct |
9 ms |
492 KB |
Output is correct |
3 |
Correct |
15 ms |
620 KB |
Output is correct |
4 |
Correct |
16 ms |
492 KB |
Output is correct |
5 |
Correct |
22 ms |
620 KB |
Output is correct |
6 |
Correct |
13 ms |
492 KB |
Output is correct |
7 |
Correct |
4 ms |
492 KB |
Output is correct |
8 |
Correct |
13 ms |
492 KB |
Output is correct |
9 |
Correct |
32 ms |
536 KB |
Output is correct |
10 |
Correct |
20 ms |
620 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
364 KB |
Output is correct |
2 |
Correct |
9 ms |
492 KB |
Output is correct |
3 |
Correct |
15 ms |
620 KB |
Output is correct |
4 |
Correct |
16 ms |
492 KB |
Output is correct |
5 |
Correct |
22 ms |
620 KB |
Output is correct |
6 |
Correct |
13 ms |
492 KB |
Output is correct |
7 |
Correct |
4 ms |
492 KB |
Output is correct |
8 |
Correct |
13 ms |
492 KB |
Output is correct |
9 |
Correct |
32 ms |
536 KB |
Output is correct |
10 |
Correct |
20 ms |
620 KB |
Output is correct |
11 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |