Submission #151519

#TimeUsernameProblemLanguageResultExecution timeMemory
151519nvmdavaChessboard (IZhO18_chessboard)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define N 200002 #define ff first #define ss second #define ll long long vector<ll> di; ll dif[200005], res = 0x3f3f3f3f3f3f3f3f; inline ll get(ll x, ll d){ return x / (2 * d) * d + min(t, x % (2 * d)); } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); ll n, k, x1, x2, y1, y2, ex, ey, ox, oy; cin>>n>>k; for(int i = 1; i * i <= n; i++) if(n % i == 0){ di.push_back(i); if(i * i != n) di.push_back(n / i); } for(int i = 0; i < di.size(); i++) dif[i] = n * n - n * n / (di[i] * di[i]) / 2 * (di[i] * di[i]); while(k--){ cin>>x1>>y1>>x2>>y2; for(int i = 0; i < di.size(); i++){ ex = get(x2, di[i]) - get(x1 - 1, di[i]); ox = x2 - x1 + 1 - ex; ey = get(y2, di[i]) - get(y1 - 1, di[i]); oy = y2 - y1 + 1 - ey; dif[i] -= ex * ey + ox * oy; dif[i] += ex * oy + ey * ox; } } for(int i = 0; i < di.size(); i++) res = min(res, min(dif[i], n * n - dif[i])); cout<<res; }

Compilation message (stderr)

chessboard.cpp: In function 'long long int get(long long int, long long int)':
chessboard.cpp:13:31: error: 't' was not declared in this scope
  return x / (2 * d) * d + min(t, x % (2 * d));
                               ^
chessboard.cpp: In function 'int main()':
chessboard.cpp:33:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < di.size(); i++)
                 ~~^~~~~~~~~~~
chessboard.cpp:38:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i = 0; i < di.size(); i++){
                  ~~^~~~~~~~~~~
chessboard.cpp:48:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < di.size(); i++)
                 ~~^~~~~~~~~~~