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>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
static int h,w;
static vector<int>v;
static vector<int>r,c;
void give_initial_chart(int H, int W, std::vector<int> R, std::vector<int> C) {
h=H;w=W;
r=R;c=C;
v=vector<int>(h*w);
rep(i,h*w){
v[R[i]*w+C[i]]=i;
}
}
int swap_seats(int a, int b) {
swap(r[a],r[b]);
swap(c[a],c[b]);
int cnt=0;
int rmin,rmax,cmin,cmax;
rmin=rmax=r[0];
cmin=cmax=c[0];
rep(i,h*w){
rmin=min(rmin,r[i]);
rmax=max(rmax,r[i]);
cmin=min(cmin,c[i]);
cmax=max(cmax,c[i]);
if((rmax-rmin+1)*(cmax-cmin+1)==i+1)cnt++;
}
return cnt;
}
# | 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... |