#include<bits/stdc++.h>
#include "seats.h"
using namespace std;
vector<int> r,c;
int h,w;
void give_initial_chart(int hh, int ww,vector<int> rr,vector<int> cc)
{
h=hh,w=ww;
r.resize(h*w);
c.resize(h*w);
r=rr;
c=cc;
}
int swap_seats(int a, int b)
{
swap(r[a],r[b]);
swap(c[a],c[b]);
int ans=1,smin=c[0],smax=c[0],emin=r[0],emax=r[0];
for(int x=1;x<h*w;x++)
{
if(!(c[x]>=smin && c[x]<=smax && r[x]>=emin && r[x]<=emax))
{
smin=min(smin,c[x]);
smax=max(smax,c[x]);
emin=min(emin,r[x]);
emax=max(emax,r[x]);
ans++;
}
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
468 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
468 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
4085 ms |
39740 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
73 ms |
748 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
2000 KB |
Output is correct |
2 |
Incorrect |
13 ms |
1992 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
468 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |