Submission #798393

#TimeUsernameProblemLanguageResultExecution timeMemory
798393TheSahibSeats (IOI18_seats)C++14
0 / 100
167 ms49728 KiB
#include "seats.h" #include <bits/stdc++.h> #define ll long long #define pii pair<int, int> using namespace std; const int MAX = 1e5 + 5; const int oo = 1e9 + 9; int n; int h, w; pii mp[MAX]; void give_initial_chart(int H, int W, std::vector<int> R, std::vector<int> C) { n = R.size(); h = H; w = W; for (int i = 0; i < n; i++) { mp[i] = {R[i], C[i]}; } } int swap_seats(int a, int b) { swap(mp[a], mp[b]); int mnR = oo, mxR = -1, mnC = oo, mxC = -1; int ans = 0; for (int i = 0; i < n; i++) { max(mxR, mp[i].first); max(mxC, mp[i].second); min(mnR, mp[i].first); min(mnC, mp[i].second); int r = mxR - mnR + 1; int c = mxC - mnC + 1; if(r * c == i + 1){ ans++; } } return ans; }
#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...