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;
int M,N;
int r[10005],c[10005];
void give_initial_chart(int H, int W, std::vector<int> R, std::vector<int> C) {
M=H,N=W;
for(int i=0;i<M*N;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 ans=0;
int maxr=0,minr=1e9,maxc=0,minc=1e9;
for(int i=0;i<M*N;i++){
maxr=max(maxr,r[i]);
minr=min(minr,r[i]);
maxc=max(maxc,c[i]);
minc=min(minc,c[i]);
if((maxr-minr+1)*(maxc-minc+1)==i+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... |