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>
#ifndef SKY
#include "seats.h"
#endif // SKY
using namespace std;
#define N 1000010
#define ll long long
#define fs first
#define sc second
#define ii pair<int,int>
#define pb push_back
int n,m;
ii pos[N];
int solve()
{
int top=pos[0].fs,bot=pos[0].fs,lef=pos[0].sc,righ=pos[0].sc,res=1;
for(int i=1;i<n*m;i++)
{
top=min(top,pos[i].fs);
bot=max(bot,pos[i].fs);
lef=min(lef,pos[i].sc);
righ=max(righ,pos[i].sc);
if((bot-top+1)*(righ-lef+1)==i+1)
res++;
}
return res;
}
int swap_seats(int a, int b)
{
swap(pos[a],pos[b]);
return solve();
}
void give_initial_chart(int NNN, int MMM, std::vector<int> R, std::vector<int> C)
{
n=NNN;
m=MMM;
for(int i=0;i<n*m;i++)
pos[i]={R[i],C[i]};
}
#ifdef SKY
int main()
{
freopen("A.inp","r",stdin);
freopen("A.out","w",stdout);
ios::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
return 0;
}
#endif
# | 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... |