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;
void chmin(int& a,int b){a=min(a,b);}
void chmax(int& a,int b){a=max(a,b);}
vector<int> r,c;
int h,w;
void give_initial_chart(int H, int W, std::vector<int> R, std::vector<int> C) {
r=R;
c=C;
h=H;
w=W;
}
int swap_seats(int a, int b) {
swap(r[a],r[b]);
swap(c[a],c[b]);
int xmi=c[0],xma=c[0],ymi=r[0],yma=r[0];
int res=0;
for(int i=0;i<h*w;i++){
chmin(xmi,c[i]);
chmin(ymi,r[i]);
chmax(xma,c[i]);
chmax(yma,r[i]);
if((xma-xmi+1)*(yma-ymi+1)==i+1){
res++;
}
}
return res;
}
# | 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... |