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>
#define ll long long
using namespace std;
ll n, k, cnt, x, y, xx, yy;
ll a[3][3];
void subt2()
{
ll c1, c2;
c1 = c2 = 0;
for ( int i = 1; i <= k; i ++ ) {
cin >> x >> y >> xx >> yy;
a[x%2][y%2] ++;
}
c1 = (n*n)/2;
c2 = c1 + 1;
c1 = c1 - ( a[1][0] + a[0][1] );
c1 = c1 + ( a[1][1] + a[0][0] );
c2 = c2 - ( a[1][1] + a[0][0] );
c2 = c2 + ( a[1][0] + a[0][1] );
cout << min( c1, c2 );
exit(0);
}
int main()
{
cin >> n >> k;
for ( int i = 1; i <= n; i ++ ) {
if ( n % i == 0 ) cnt ++;
}
if ( cnt == 2 ) subt2();
cout << (n*n)/2;
}
# | 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... |