Submission #808113

#TimeUsernameProblemLanguageResultExecution timeMemory
808113ShithilaSeats (IOI18_seats)C++14
11 / 100
4081 ms24152 KiB
#include "seats.h" #include<bits/stdc++.h> using namespace std; std::vector<int> r; std::vector<int> c; int h; int w; 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) { swap(r[a], r[b]); swap(c[a], c[b]); int hi=r[0]; int hj=r[0]; int cj=c[0]; int ci=c[0]; int ans=1; for(int i=1;i<h*w;i++) { if(hi>r[i]) { hi=r[i]; } if(hj<r[i]) { hj=r[i]; } if(ci>c[i]) { ci=c[i]; } if(cj<c[i]) { cj=c[i]; } if(((cj-ci+1)*(hj-hi+1))==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...