# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
488078 | nickmet2004 | Chessboard (IZhO18_chessboard) | C++11 | 197 ms | 5704 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>
#define int long long
using namespace std;
const int N= 1e5 + 5;
int n , k;
int A[N] , B[N] , C[N] , D[N];
int cnt[2];
int ans = 1e18;
void q(int x){
int sz = n / x;
for(int i = 0; i < k; ++i){
cnt[(B[i] /x + A[i] / x) % 2]++;
}
int bk = ((n*n / (x * x)) / 2) * x * x ,ok = 0;
if(sz % 2 == 1) ok = 1;
int Y = bk - cnt[1] + cnt[0];
ans = min(ans , Y);
bk = (((n * n) / (x * x)) - ((n*n / (x * x)) / 2)) * x * x;
Y = bk - cnt[0] + cnt[1];
ans = min(ans, Y);
cnt[0]=cnt[1]=0;
//cout << endl;
}
main (){
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> n >> k;
for(int i = 0; i < k; ++i){
cin >> A[i] >> B[i] >> C[i] >> D[i];
--A[i] , --B[i] , --C[i] , --D[i];
}//cout << endl;
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... |