Submission #768791

#TimeUsernameProblemLanguageResultExecution timeMemory
768791BaytoroSeats (IOI18_seats)C++17
11 / 100
4101 ms26524 KiB
#include "seats.h" //#include "grader.cpp" #include <bits/stdc++.h> #define fr first #define sc second using namespace std; const int N=1e6+5; pair<int,int> A[N]; int h,w; void give_initial_chart(int H, int W, vector<int> R, vector<int> C) { h=H,w=W; for(int i=0;i<H*W;i++) A[i]={R[i],C[i]}; } int swap_seats(int a, int b) { swap(A[a],A[b]); int ans=1; int l=A[0].fr,r=A[0].fr; int u=A[0].sc,d=A[0].sc; for(int i=1;i<h*w;i++){ l=min(l,A[i].fr); r=max(r,A[i].fr); d=min(d,A[i].sc); u=max(u,A[i].sc); if(i+1==(r-l+1)*(u-d+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...