Submission #338387

# Submission time Handle Problem Language Result Execution time Memory
338387 2020-12-23T04:56:19 Z boykut Chessboard (IZhO18_chessboard) C++14
16 / 100
32 ms 2412 KB
#include <bits/stdc++.h>

using namespace std;

#define int long long

signed main() {
   ios::sync_with_stdio(0);
   cin.tie(0);
   int n, k;
   cin >> n >> k;
   if (k == 0) {
      int ans = -1;
      for (int i = 2; i <= n; i++) {
         if (n % i == 0) {
            int m = n / i;
            
            int res = ((n*n) / (m*m)) / 2 * (m *m);
            
            if (ans == -1 || ans > res)
               ans = res;
         }
      }
      cout << ans << '\n';
   } else {
      int cnt[] = {0, 0};
      for (int i = 0, x, y; i < k; i++) {
         cin >> x >> y >> x >> y;
         cnt[(x+y)%2]++;
      }
      if (n == 2) {
         cout << 2 - max(cnt[0], cnt[1]);
      } else {
         cout << min(n*n/2+1-cnt[0]+cnt[1], n*n/2-cnt[1]+cnt[0]);
      }
   }
   return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 0 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 364 KB Output is correct
2 Correct 6 ms 748 KB Output is correct
3 Correct 14 ms 1260 KB Output is correct
4 Correct 16 ms 1260 KB Output is correct
5 Correct 24 ms 1644 KB Output is correct
6 Correct 13 ms 1132 KB Output is correct
7 Correct 3 ms 492 KB Output is correct
8 Correct 13 ms 1132 KB Output is correct
9 Correct 32 ms 2412 KB Output is correct
10 Correct 18 ms 1516 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 22 ms 364 KB Output is correct
2 Correct 6 ms 748 KB Output is correct
3 Correct 14 ms 1260 KB Output is correct
4 Correct 16 ms 1260 KB Output is correct
5 Correct 24 ms 1644 KB Output is correct
6 Correct 13 ms 1132 KB Output is correct
7 Correct 3 ms 492 KB Output is correct
8 Correct 13 ms 1132 KB Output is correct
9 Correct 32 ms 2412 KB Output is correct
10 Correct 18 ms 1516 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 0 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 0 ms 364 KB Output is correct
9 Correct 22 ms 364 KB Output is correct
10 Correct 6 ms 748 KB Output is correct
11 Correct 14 ms 1260 KB Output is correct
12 Correct 16 ms 1260 KB Output is correct
13 Correct 24 ms 1644 KB Output is correct
14 Correct 13 ms 1132 KB Output is correct
15 Correct 3 ms 492 KB Output is correct
16 Correct 13 ms 1132 KB Output is correct
17 Correct 32 ms 2412 KB Output is correct
18 Correct 18 ms 1516 KB Output is correct
19 Incorrect 1 ms 364 KB Output isn't correct
20 Halted 0 ms 0 KB -