Submission #1054874

#TimeUsernameProblemLanguageResultExecution timeMemory
1054874MinaRagy06Seats (IOI18_seats)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "seats.h" #ifdef MINA #include "grader.cpp" #endif using namespace std; #define ll long long #define SZ(x) (int) x.size() const int N = 1'000'005; int gud[N], cnt = 0; int n, m; vector<int> r, c; void give_initial_chart(int _n, int _m, vector<int> _r, vector<int> _c) { n = _n, m = _m; r = _r, c = _c; mnr[0] = 1e9; mxr[0] = -1; mnc[0] = 1e9; mxc[0] = -1; for (int i = 0; i < n * m; i++) { mnr[i + 1] = min(mnr[i], r[i]); mxr[i + 1] = max(mxr[i], r[i]); mnc[i + 1] = min(mnc[i], c[i]); mxc[i + 1] = max(mxc[i], c[i]); gud[i] = (mxr[i + 1] - mnr[i + 1] + 1) * (mxc[i + 1] - mnc[i + 1] + 1) == i + 1; cnt += gud[i]; } } int swap_seats(int x, int y) { if (x > y) swap(x, y); for (int i = x; i <= y; i++) { cnt -= gud[i]; gud[i] = 0; } swap(r[x], r[y]); swap(c[x], c[y]); for (int i = x; i <= y; i++) { mnr[i + 1] = min(mnr[i], r[i]); mxr[i + 1] = max(mxr[i], r[i]); mnc[i + 1] = min(mnc[i], c[i]); mxc[i + 1] = max(mxc[i], c[i]); gud[i] = (mxr[i + 1] - mnr[i + 1] + 1) * (mxc[i + 1] - mnc[i + 1] + 1) == i + 1; cnt += gud[i]; } return cnt; }

Compilation message (stderr)

seats.cpp: In function 'void give_initial_chart(int, int, std::vector<int>, std::vector<int>)':
seats.cpp:17:2: error: 'mnr' was not declared in this scope
   17 |  mnr[0] = 1e9;
      |  ^~~
seats.cpp:18:2: error: 'mxr' was not declared in this scope
   18 |  mxr[0] = -1;
      |  ^~~
seats.cpp:19:2: error: 'mnc' was not declared in this scope
   19 |  mnc[0] = 1e9;
      |  ^~~
seats.cpp:20:2: error: 'mxc' was not declared in this scope
   20 |  mxc[0] = -1;
      |  ^~~
seats.cpp: In function 'int swap_seats(int, int)':
seats.cpp:41:3: error: 'mnr' was not declared in this scope
   41 |   mnr[i + 1] = min(mnr[i], r[i]);
      |   ^~~
seats.cpp:42:3: error: 'mxr' was not declared in this scope
   42 |   mxr[i + 1] = max(mxr[i], r[i]);
      |   ^~~
seats.cpp:44:3: error: 'mnc' was not declared in this scope
   44 |   mnc[i + 1] = min(mnc[i], c[i]);
      |   ^~~
seats.cpp:45:3: error: 'mxc' was not declared in this scope
   45 |   mxc[i + 1] = max(mxc[i], c[i]);
      |   ^~~