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>
#include "seats.h"
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()
int n,h,w;
vector<int>r,c;
void give_initial_chart(int H,int W,vector<int>R,vector<int>C){//len HW
h=H,w=W,r=R,c=C,n=H*W;
}
int swap_seats(int a,int b){
swap(r[a],r[b]);
swap(c[a],c[b]);
int ans=0,r1=h,r2=0,c1=w,c2=0;
for(int i=0;i<n;i++){
r1=min(r1,r[i]);
r2=max(r2,r[i]);
c1=min(c1,c[i]);
c2=max(c2,c[i]);
if((r2-r1+1)*(c2-c1+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... |