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, num;
int h, w;
bool vis[10005][10005];
void give_initial_chart(int H, int W, vector<int> R, vector<int> C) {
h=H;
w=W;
r=R;
c=C;
}
int swap_seats(int a, int b){
for (int i=0;i<h;i++)for (int j=0;j<w;j++)vis[i][j]=0;
swap(r[a], r[b]);
swap(c[a], c[b]);
int mnr=h, mxr=0, mnc=w, mxc=0, ans=0;
for (int i=0;i<h*w;i++){
vis[r[i]][c[i]]=1;
mnr=min(mnr, r[i]);
mxr=max(mxr, r[i]);
mnc=min(mnc, c[i]);
mxc=max(mxc, c[i]);
if ((mxr-mnr+1)*(mxc-mnc+1)==i+1 && vis[mxr][mxc] && vis[mnr][mnc])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... |