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 <bits/stdc++.h>
using namespace std;
vector<int> r,c;
int h,w,n;
int get(){
int a = r[0],b=c[0],x= r[0],y=c[0];
int ans = 1;
for(int i=1;i<n;i++){
int le = r[i], ri = c[i];
if(le < a)a = le;
else if(le > x)x = le;
if(ri < b)b = ri;
else if(ri > y)y = ri;
ans += (x-a+1) * (y-b+1) == i+1;
i = max(i,(x-a+1) * (y-b+1)-3);
}
return ans;
}
void give_initial_chart(int H, int W, vector<int> R, vector<int> C) {
h = H,w= W,n = H*W;
r = R;
c = C;
}
int swap_seats(int a, int b) {
swap(r[a],r[b]);
swap(c[a],c[b]);
return get();
}
# | 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... |