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;
std::vector<int> r;
std::vector<int> c;
int h;
int 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 hi=r[0];
int hj=r[0];
int cj=c[0];
int ci=c[0];
int ans=1;
for(int i=1;i<h*w;i++)
{
if(hi>r[i])
{
hi=r[i];
}
if(hj<r[i])
{
hj=r[i];
}
if(ci>c[i])
{
ci=c[i];
}
if(cj<c[i])
{
cj=c[i];
}
if(((cj-ci+1)*(hj-hi+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... |