Submission #431431

#TimeUsernameProblemLanguageResultExecution timeMemory
431431Bench0310Seats (IOI18_seats)C++17
0 / 100
332 ms48172 KiB
#include <bits/stdc++.h> #include "seats.h" using namespace std; typedef long long ll; int n,h,w; vector<array<int,2>> v; void give_initial_chart(int nh,int nw,vector<int> r,vector<int> c) { h=nh; w=nw; n=h*w; for(int i=0;i<n;i++) v[i]={r[i],c[i]}; } int swap_seats(int a,int b) { swap(v[a],v[b]); int ar=v[0][0]; int br=v[0][0]; int ac=v[0][1]; int bc=v[0][1]; int res=0; for(int i=0;i<n;i++) { ar=min(ar,v[i][0]); br=max(br,v[i][0]); ac=min(ac,v[i][1]); bc=max(bc,v[i][1]); res+=((br-ar+1)*(bc-ac+1)==i+1); } return res; } //int main() //{ // // return 0; //}
#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...