Submission #580547

#TimeUsernameProblemLanguageResultExecution timeMemory
580547VanillaSeats (IOI18_seats)C++17
11 / 100
4101 ms40752 KiB
#include <bits/stdc++.h> #include "seats.h" typedef long long int64; using namespace std; vector<int> r,c; const int maxn = 1e4 + 2; int n = 0, m = 0; void give_initial_chart(int H, int W, vector<int> R, vector<int> C) { for (int i = 0; i < H * W; i++){ R[i]++; C[i]++; } r = R, c = C, n = H, m = W; } int swap_seats(int a, int b) { swap(r[a], r[b]); swap(c[a], c[b]); int ll = c[0], rr = c[0], uu = r[0], dd = r[0]; int rs = 1; for (int i = 1; i < n * m; i++){ ll = min(ll, c[i]); rr = max(rr, c[i]); uu = min(uu, r[i]); dd = max(dd, r[i]); // cout << i << " " << ll << " " << rr << " " << uu << " " << dd << "\n"; if ((rr - ll + 1) * (dd - uu + 1) == i + 1) rs++; } return rs; }
#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...