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;
vector<int> r,c;
int h,w;
void give_initial_chart(int hh, int ww,vector<int> rr,vector<int> cc)
{
h=hh,w=ww;
r.resize(h*w);
c.resize(h*w);
r=rr;
c=cc;
}
int swap_seats(int a, int b)
{
swap(r[a],r[b]);
swap(c[a],c[b]);
int ans=1,smin=c[0],smax=c[0],emin=r[0],emax=r[0];
for(int x=1;x<h*w;x++)
{
if(!(c[x]>=smin && c[x]<=smax && r[x]>=emin && r[x]<=emax))
{
smin=min(smin,c[x]);
smax=max(smax,c[x]);
emin=min(emin,r[x]);
emax=max(emax,r[x]);
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... |