Submission #495274

# Submission time Handle Problem Language Result Execution time Memory
495274 2021-12-18T08:22:32 Z Nuraly_Serikbay Chessboard (IZhO18_chessboard) C++14
0 / 100
64 ms 204 KB
#include <bits/stdc++.h>
  
#define endl "\n"
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define sz size()
#define rep(i,k,n) for(int i = k ; i <= n ; ++i)
#define per(i,k,n) for(int i = k ; i >= n ; --i)
#define Zymraq() ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define all(x) x.begin(),x.end()
#define fr(x) freopen(x".in","r",stdin),freopen(x".out","w",stdout)
#define toqta return 0
#define PERMUTE next_permutation
#define no cout<<"No"<<endl;
#define yes cout<<"Yes"<<endl;
#define a() a + 1, a + n + 1  
 
  
using namespace std;
   
typedef long long ll;
typedef unsigned long long ull;
typedef string S;
typedef double ld;
typedef long double lld;
   
const int N = 1e6 + 17;
const int modd = 1e9 + 7;
const int INF = 1e9 - 19;
const int P = 37;
const ll NN = 1e7 + 17;
const ld eps = 1e-19;
const double pi = 3.141592653589793238462643383279 ;
   
 
bool sortbysec(const pair<int,int> &a, const pair<int,int> &b){
    return (a.second < b.second);
}
 
void pre (ll a) {
    cout << fixed << setprecision(a);
    return;
} 
 
ll n, m;
 
ll odd, even;
 
int main () {
	cin >> n >> m;
	ll cur = n;
	if (m == 0) {
		
		if (n % 3 == 0) {
			cout << (n / 3) * (n / 3) * 4;
			return 0;
		}
		if (n % 5 == 0) {
			cout << (n / 5) * (n / 5) * 12;
			return 0;
		}
		if (n % 7 == 0) {
			cout << (n / 7) * (n / 7) * 24;
			return 0;
		}
		if (n % 13 == 0) {
			cout << (n / 13) * (n / 13) * 84;
			return 0;
		}
		cout << n * n / 2;
		return 0;
	}
	while (m --) {
		ll x, y, xx, yy;
		cin >> x >> y >> xx >> yy;
		if ((x + y) % 2 == 0) even ++;
		else odd ++;
	}
	ll needeven = (n * n / 2 + ((n % 2) * (n / 2 + (n % 2)))) - even;
	ll needodd = (n * n / 2 + (n % 2) * (n / 2)) - odd;
	cout << min (needeven + odd, needodd + even);
	return 0;
}

Compilation message

chessboard.cpp: In function 'int main()':
chessboard.cpp:53:5: warning: unused variable 'cur' [-Wunused-variable]
   53 |  ll cur = n;
      |     ^~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Incorrect 1 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 64 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 64 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Incorrect 1 ms 204 KB Output isn't correct