Submission #488078

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
4880782021-11-17 15:38:26nickmet2004Chessboard (IZhO18_chessboard)C++11
70 / 100
197 ms5704 KiB
#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;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

chessboard.cpp: In function 'void q(long long int)':
chessboard.cpp:14:45: warning: variable 'ok' set but not used [-Wunused-but-set-variable]
   14 |     int bk = ((n*n / (x * x)) / 2) * x * x ,ok = 0;
      |                                             ^~
chessboard.cpp: At global scope:
chessboard.cpp:24:2: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   24 |  main (){
      |  ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...