This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |