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;
vector<int>r, c;
int h, w;
void give_initial_chart(int H, int W, vector<int>R, vector<int>C)
{
h=H;w=W;r=R;c=C;
}
int swap_seats(int a, int b)
{
swap(r[a], r[b]);
swap(c[a], c[b]);
int minr=h+1, maxr=-1, minw=w+1, maxw=-1, ans=0;
for(int i=0;i<h*w;i++)
{
minr=min(minr, r[i]);
maxr=max(maxr, r[i]);
minw=min(minw, c[i]);
maxw=max(maxw, c[i]);
if((maxr-minr+1)*(maxw-minw+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... |