Submission #297338

#TimeUsernameProblemLanguageResultExecution timeMemory
297338TangentSeats (IOI18_seats)C++17
11 / 100
4043 ms26352 KiB
#include "seats.h" #include <bits/stdc++.h> using namespace std; //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; // typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; // find_by_order(), order_of_key() typedef long long ll; typedef long double dd; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<dd, dd> pdd; typedef vector<int> vii; typedef vector<ll> vll; typedef vector<dd> vdd; typedef vector<pii> vpii; typedef vector<pll> vpll; typedef vector<pdd> vpdd; typedef vector<vii> vvii; typedef vector<vll> vvll; typedef vector<vdd> vvdd; typedef vector<vpii> vvpii; typedef vector<vpll> vvpll; typedef vector<vpdd> vvpdd; typedef vector<bool> vb; const int inf = 1 << 30; #define rep(i, n) for (ll i = 0; i < n; i++) #define ffor(i, a, b) for(ll i = a; i < b; i++) #define forin(x, a) for (auto &x: a) #define all(x) x.begin(), x.end() #ifdef TEST #define dbg(x) cout << #x << ": " << x << '\n'; #define dbgc(x) cout << #x << ":"; forin(a, x) { cout << " " << a; } cout << endl; #define tassert(x) assert(x); #else #define dbg(x) #define dbgc(x) #define tassert(x) #endif std::vector<int> r, c; void give_initial_chart(int H, int W, std::vector<int> R, std::vector<int> C) { r = move(R); c = move(C); } int swap_seats(int a, int b) { swap(r[a], r[b]); swap(c[a], c[b]); int minr = r[0], minc = c[0], maxr = r[0], maxc = c[0]; int res = 1; ffor(i, 1, r.size()) { minr = min(minr, r[i]); maxr = max(maxr, r[i]); minc = min(minc, c[i]); maxc = max(maxc, c[i]); if ((maxr - minr + 1) * (maxc - minc + 1) == i + 1) { res++; } } return res; }

Compilation message (stderr)

seats.cpp: In function 'int swap_seats(int, int)':
seats.cpp:34:39: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 | #define ffor(i, a, b) for(ll i = a; i < b; i++)
......
   60 |   ffor(i, 1, r.size()) {
      |        ~~~~~~~~~~~~~~                  
seats.cpp:60:3: note: in expansion of macro 'ffor'
   60 |   ffor(i, 1, r.size()) {
      |   ^~~~
#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...