Submission #93136

#TimeUsernameProblemLanguageResultExecution timeMemory
93136MakhsudChessboard (IZhO18_chessboard)C++17
8 / 100
70 ms1080 KiB
#include <bits/stdc++.h> #define ll long long using namespace std; ll n, k, cnt, x, y, xx, yy; ll a[3][3]; ll di[50005][5][5]; vector <ll> d; void subt_3_4_5() { ll mn = INT_MAX, a1, a2; for ( int i = 1; i < n; i ++ ){ if ( n % i == 0 ) { d.push_back( i ); } } for ( int i = 1; i <= k; i ++ ){ cin >> x >> y >> xx >> yy; for ( auto e: d ) { ll r, c; r = (x/e) + ( (x%e) && 1 ); c = (y/e) + ( (y%e) && 1 ); //di[e][r%2][c%2] ++; } } for ( auto e: d ) { a1 = a2 = 0; for ( int i = 1; i <= (n/e); i ++ ) { if ( i % 2 ) { a1 += (e*e) * ((n/e)/2); a2 += (e*e) * (((n/e)+1)/2); } else { a2 += (e*e) * ((n/e)/2); a1 += (e*e) * (((n/e)+1)/2); } } a1 -= di[e][1][0] + di[e][0][1]; a1 += di[e][0][0] + di[e][1][1]; a2 += di[e][1][0] + di[e][0][1]; a2 -= di[e][0][0] + di[e][1][1]; mn = min ( mn, min ( a1, a2 ) ); } cout << mn; exit(0); } int main() { cin >> n >> k; subt_3_4_5(); }

Compilation message (stderr)

chessboard.cpp: In function 'void subt_3_4_5()':
chessboard.cpp:21:7: warning: variable 'r' set but not used [-Wunused-but-set-variable]
    ll r, c;
       ^
chessboard.cpp:21:10: warning: variable 'c' set but not used [-Wunused-but-set-variable]
    ll r, c;
          ^
#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...