Submission #855831

#TimeUsernameProblemLanguageResultExecution timeMemory
855831Trisanu_DasChessboard (IZhO18_chessboard)C++17
Compilation error
0 ms0 KiB
#include <iostream> #include <algorithm> using namespace std; #define int long long int n, k, tot, x1[100000], x2[100000], y1[100000], y2[100000]; signed main(){ cin >> n >> k; for(int i = 0; i < n; i++){ cin >> x1[i] >> y1[i] >> x2[i] >> y2[i]; x1[i]--; x2[i]--; y2[i]--; y1[i]--; tot += (x2[i] - x1[i] + 1) * (y2[i] - y1[i] + 1); } int ans = LLONG_MAX; for(int i = 0; i < n; i++){ if(n % i == 0){ int alt1 = ((n / i) * (n / i)) / (2 * i * i), alt2 = ((n / i) * (n / i + 1)) / (2 * i * i), t = 0; for(int j = 0; j < k; j++) if(((x1[j] / i) & 1) == ((y1[j] / i) & 1)) t++; ans = min(ans, min((a - t) + (s-t), (b - (s-t)) + t)); } } cout << ans << '\n'; }

Compilation message (stderr)

chessboard.cpp: In function 'int main()':
chessboard.cpp:15:13: error: 'LLONG_MAX' was not declared in this scope
   15 |   int ans = LLONG_MAX;
      |             ^~~~~~~~~
chessboard.cpp:3:1: note: 'LLONG_MAX' is defined in header '<climits>'; did you forget to '#include <climits>'?
    2 | #include <algorithm>
  +++ |+#include <climits>
    3 | using namespace std;
chessboard.cpp:20:27: error: 'a' was not declared in this scope
   20 |       ans = min(ans, min((a - t) + (s-t), (b - (s-t)) + t));
      |                           ^
chessboard.cpp:20:37: error: 's' was not declared in this scope
   20 |       ans = min(ans, min((a - t) + (s-t), (b - (s-t)) + t));
      |                                     ^
chessboard.cpp:20:44: error: 'b' was not declared in this scope
   20 |       ans = min(ans, min((a - t) + (s-t), (b - (s-t)) + t));
      |                                            ^
chessboard.cpp:18:11: warning: unused variable 'alt1' [-Wunused-variable]
   18 |       int alt1 = ((n / i) * (n / i)) / (2 * i * i), alt2 = ((n / i) * (n / i + 1)) / (2 * i * i), t = 0;
      |           ^~~~
chessboard.cpp:18:53: warning: unused variable 'alt2' [-Wunused-variable]
   18 |       int alt1 = ((n / i) * (n / i)) / (2 * i * i), alt2 = ((n / i) * (n / i + 1)) / (2 * i * i), t = 0;
      |                                                     ^~~~