Submission #75482

#TimeUsernameProblemLanguageResultExecution timeMemory
75482C_SUNSHINESeats (IOI18_seats)C++14
11 / 100
4042 ms24524 KiB
#include <cstdio> #include <cstring> #include <cstdlib> #include <iostream> #include <algorithm> #include <vector> #include "seats.h" using namespace std; int H,W,NUM; vector<int> R,C; void give_initial_chart(int H, int W, std::vector<int> R, std::vector<int> C) { ::H=H; ::W=W; NUM=H*W; ::R.assign(NUM,0); ::C.assign(NUM,0); for(int i=0;i<NUM;i++) { ::R[i]=R[i]; ::C[i]=C[i]; } } int swap_seats(int a, int b) { swap(R[a],R[b]); swap(C[a],C[b]); int xl=R[0],xr=R[0]; int yl=C[0],yr=C[0]; int cnt=0; for(int i=0;i<NUM;i++) { xl=min(xl,R[i]); xr=max(xr,R[i]); yl=min(yl,C[i]); yr=max(yr,C[i]); if((xr-xl+1)*(yr-yl+1)==i+1) 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...