Submission #791278

#TimeUsernameProblemLanguageResultExecution timeMemory
791278Mouad_oujSeats (IOI18_seats)C++17
0 / 100
4085 ms39740 KiB
#include<bits/stdc++.h> #include "seats.h" using namespace std; vector<int> r,c; int h,w; void give_initial_chart(int hh, int ww,vector<int> rr,vector<int> cc) { h=hh,w=ww; r.resize(h*w); c.resize(h*w); r=rr; c=cc; } int swap_seats(int a, int b) { swap(r[a],r[b]); swap(c[a],c[b]); int ans=1,smin=c[0],smax=c[0],emin=r[0],emax=r[0]; for(int x=1;x<h*w;x++) { if(!(c[x]>=smin && c[x]<=smax && r[x]>=emin && r[x]<=emax)) { smin=min(smin,c[x]); smax=max(smax,c[x]); emin=min(emin,r[x]); emax=max(emax,r[x]); 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...