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 <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <vector>
#include "seats.h"
using namespace std;
int H,W,NUM;
vector<int> R,C;
void give_initial_chart(int H, int W, std::vector<int> R, std::vector<int> C)
{
::H=H;
::W=W;
NUM=H*W;
::R.assign(NUM,0);
::C.assign(NUM,0);
for(int i=0;i<NUM;i++)
{
::R[i]=R[i];
::C[i]=C[i];
}
}
int swap_seats(int a, int b)
{
swap(R[a],R[b]);
swap(C[a],C[b]);
int xl=R[0],xr=R[0];
int yl=C[0],yr=C[0];
int cnt=0;
for(int i=0;i<NUM;i++)
{
xl=min(xl,R[i]);
xr=max(xr,R[i]);
yl=min(yl,C[i]);
yr=max(yr,C[i]);
if((xr-xl+1)*(yr-yl+1)==i+1)
cnt++;
}
return cnt;
}
# | 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... |