# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
645621 | Kiarat | Chessboard (IZhO18_chessboard) | C++17 | 62 ms | 212 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[100001 * 4];
int main()
{
ll n,k;
cin >> n >> k;
ll oo = 0;
ll qwe = 0;
if(n % 2 == 0)
oo = n / 2 * n;
else if(n % 2 == 1)
qwe = n / 2 * n + (n/2);
if(k == 0)
{
if(n % 2 == 0)
cout << n / 2 * n;
else if(n % 2 == 1)
cout << n / 2 * n + (n/2);
}
else
{
ll ans = 0,sum = 0,cnt = 0,ss = 0,ww = 0;
ll x = k;
while(k--)
{
ll x1,y1,x2,y2;
cin >> x1 >> y1 >> x2 >> y2;
if(x1 == x2 && y1 == y2)
{
if(x1 % 2 == 1 && x1 % 2 == y1 % 2)
ss++;
else if(x1 % 2 == 0 && x1 % 2 == y1 % 2)
{
ss++;
}
}
}
ww = x - ss;
ans = oo - ss + ww;
sum = qwe - ww + ss;
cout << min(ans,sum);
}
}
/// cout << fixes << serprecision(x) << " "
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |