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 s=0, n;
void give_initial_chart(int H, int W, vector<int> R, vector<int> C) {
r=R;
c=C;
n=H*W;
return;
}
int swap_seats(int a, int b) {
if(a>b)swap(a, b);
swap(r[a], r[b]);
swap(c[b], c[a]);
int u=r[0], d=r[0], l=c[0], r1=c[0];
s=1;
for(int i=1; i<n; i++){
u=max(u, r[i]);
r1=max(r1, c[i]);
d=min(d, r[i]);
l=min(l, c[i]);
if((r1-l+1)*(u-d+1)==i+1)s++;
}
return s;
}
# | 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... |