#include "seats.h"
#include "bits/stdc++.h"
using namespace std;
vector<pair<int,int>>v;
int ans;
int slv(int in){
pair<pair<int,int>,pair<int,int>>pr={{v[in].first,v[in].first},{v[in].second,v[in].second}};
for(int i=in;i>=0;i--){
pr.first.first=min(pr.first.first,v[i].first);
pr.first.second=max(pr.first.second,v[i].first);
pr.second.first=min(pr.second.first,v[i].second);
pr.second.second=max(pr.second.second,v[i].second);
}
return (in+1==(pr.second.second-pr.second.first)*(pr.first.second-pr.first.first));
}
void give_initial_chart(int H, int W, std::vector<int> R, std::vector<int> C) {
v.resize(H*W);
for(int i=0;i<H*W;i++){
v[i]={R[i],C[i]};
}
for(int i=0;i<H*W;i++)ans+=slv(i);
}
int swap_seats(int a, int b){
ans-=slv(a)+slv(b);
swap(v[a],v[b]);
ans+=slv(a)+slv(b);
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
4043 ms |
39720 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
169 ms |
856 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
12 ms |
2260 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |