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 "bits/stdc++.h"
using namespace std;
vector<int> r,c;
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++){
r.push_back(R[i]);
c.push_back(C[i]);
}
}
int swap_seats(int a, int b){
swap(r[a],r[b]);
swap(c[a],c[b]);
int mnx = 1e9 , mxx = -1e9 , mny = 1e9 , mxy = -1e9;
int ans = 0;
for(int i = 0;i<h*w;i++){
mnx = min(mnx,r[i]);
mxx = max(mxx,r[i]);
mny = min(mny,c[i]);
mxy = max(mxy,c[i]);
if(i+1==(mxx-mnx+1)*(mxy-mny+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... |