Submission #378574

# Submission time Handle Problem Language Result Execution time Memory
378574 2021-03-17T01:53:25 Z LittleCube Chessboard (IZhO18_chessboard) C++14
16 / 100
102 ms 492 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;

/*************************************
 * 
 *  Subtask 1 : 8 points
 *  Subtask 2 : 8 points
 * 
 */

signed main()
{
    int n, m, k;
    vector<int> v;
    cin >> n >> k;
    if (k == 0) // Subtask 1
    {
        m = n;
        for (int i : {3, 5, 7, 11, 13, 17, 19, 23, 27, 29, 31, 37, 41, 43, 47, 53, 57, 61, 67, 71, 73, 79, 83, 89, 97})
            while (m % i == 0)
                v.emplace_back(i), m /= i;
        if (m > 1)
            v.emplace_back(m);

        if (n == (n & -n))
            cout << n * n / 2 << '\n';
        else
            cout << (n * n - (n / v[0]) * (n / v[0])) / 2;
    }
    else // Subtask 2
    {
        int l = 0, r = 0;
        for (int i = 1; i <= k; i++)
        {
            int x1, y1, x2, y2;
            cin >> x1 >> y1 >> x2 >> y2;
            if ((x1 + y1) % 2)
                r++;
            else
                l++;
        }
        cout << min((n * n + 1) / 2 - l + r, (n * n) / 2 - r + l) << '\n';
        
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 0 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 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 73 ms 492 KB Output is correct
2 Correct 18 ms 364 KB Output is correct
3 Correct 46 ms 492 KB Output is correct
4 Correct 46 ms 364 KB Output is correct
5 Correct 67 ms 368 KB Output is correct
6 Correct 50 ms 364 KB Output is correct
7 Correct 9 ms 364 KB Output is correct
8 Correct 40 ms 364 KB Output is correct
9 Correct 102 ms 364 KB Output is correct
10 Correct 66 ms 364 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 73 ms 492 KB Output is correct
2 Correct 18 ms 364 KB Output is correct
3 Correct 46 ms 492 KB Output is correct
4 Correct 46 ms 364 KB Output is correct
5 Correct 67 ms 368 KB Output is correct
6 Correct 50 ms 364 KB Output is correct
7 Correct 9 ms 364 KB Output is correct
8 Correct 40 ms 364 KB Output is correct
9 Correct 102 ms 364 KB Output is correct
10 Correct 66 ms 364 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 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 0 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 1 ms 364 KB Output is correct
9 Correct 73 ms 492 KB Output is correct
10 Correct 18 ms 364 KB Output is correct
11 Correct 46 ms 492 KB Output is correct
12 Correct 46 ms 364 KB Output is correct
13 Correct 67 ms 368 KB Output is correct
14 Correct 50 ms 364 KB Output is correct
15 Correct 9 ms 364 KB Output is correct
16 Correct 40 ms 364 KB Output is correct
17 Correct 102 ms 364 KB Output is correct
18 Correct 66 ms 364 KB Output is correct
19 Incorrect 1 ms 364 KB Output isn't correct
20 Halted 0 ms 0 KB -