Submission #904842

#TimeUsernameProblemLanguageResultExecution timeMemory
904842Trisanu_DasSeats (IOI18_seats)C++17
5 / 100
4077 ms94624 KiB
#include "seats.h" #include <bits/stdc++.h> using namespace std; vector<int> r, c; int mr, mc, mmc, mmr, h, w; map<pair<int,int>,bool> st; bool check(int l){ for(int i = mr; i <= mmr; i++) for(int j = mc; j <= mmc; j++) if(!st[{i,j}]) return false; return true; } void give_initial_chart(int H, int W, std::vector<int> R, std::vector<int> C) { r = R; c = C; h = H; w = W; } int swap_seats(int a, int b) { mr = 1e9; mc = 1e9; mmc = 0; mmr = 0; st.clear(); swap(r[a],r[b]); swap(c[a],c[b] ); int cnt = 0; for(int i = 0; i <= h * w - 1; i++) { mr = min(mr, r[i]); mmr = max(mmr, r[i]); mc = min(mc, c[i]); mmc = max(mmc, c[i]); st[{r[i],c[i]}] = 1; if(check(i)) cnt++; } return cnt; }
#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...