이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <vector>
using namespace std;
int h,w;
int const N=1e6+10;
struct node
{
int mx,my,mix,miy;
};
pair<int,int>seat[N]={};
// node St[4*N]={};
// node comb(node&a,node& b)
// {
// node c;
// c.mx=max(a.mx,b.mx);
// c.mix=min(a.mix,b.mix);
// c.my=max(a.my,b.my);
// c.miy=min(a.miy,b.miy);
// return c;
// }
// void build(int i,int st,int en)
// {
// if (st==en)
// {
// St[i].mx=St[i].mix=seat[st].first;
// St[i].my=St[i].miy=seat[st].second;
// return;
// }
// int mid=(st+en)/2;
// St[i]=comb(St[i*2],St[i*2+1]);
// }
// void update(int i,int r,int st,int en)
// {
// if (st==en)
// {
// St[i].mx=St[i].mix=seat[st].first;
// St[i].my=St[i].miy=seat[st].second;
// }
// }
void give_initial_chart(int H, int W, vector<int> R, vector<int> C)
{
h=H,w=W;
for (int i=0;i<H*W;i++)
seat[i]={R[i],C[i]};
}
int swap_seats(int a, int b)
{
swap(seat[a],seat[b]);
int ans=1;
int x,mx,y,my;
x=mx=seat[0].first;
y=my=seat[0].second;
for (int k=1;k<h*w;k++)
{
x=max(x,seat[k].first);
mx=min(mx,seat[k].first);
y=max(y,seat[k].second);
my=min(my,seat[k].second);
if ((x-mx+1)*(y-my+1)==k+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... |