# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
431430 | Bench0310 | Seats (IOI18_seats) | C++17 | 0 ms | 0 KiB |
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;
typedef long long ll;
int n,h,w;
vector<array<int,2>> v;
void give_initial_chart(int nh,int nw,vector<int> r,vector<int> c)
{
h=nh;
w=nw;
n=h*w;
for(int i=0;i<n;i++) v[i]={r[i],c[i]};
}
int swap_seats(int a,int b)
{
swap(v[a],v[b]);
int ar=v[0][0];
int br=v[0][0];
int ac=v[0][1];
int bc=v[0][1];
int res=0;
for(int i=0;i<n;i++)
{
ar=min(ar,v[i][0]);
br=max(br,v[i][0]);
ac=min(ac,v[i][1]);
bc=max(bc,v[i][1]);
res+=((br-ar+1)*(bc-ac+1)==i+1);
}
return res;
}
int main()
{
return 0;
}