# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
403595 | tqbfjotld | 레이저 센서 (KOI16_laser) | C++14 | 1 ms | 332 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
vector<pair<int,pair<int,int> > > points;
vector<int> ans[1005];
int main(){
int n;
scanf("%d",&n);
for (int x = 0;x<n; x++){
int a,b;
scanf("%d%d",&a,&b);
points.push_back({a,{x,0}});
}
for (int x = 0; x<2*n; x++){
int a,b;
scanf("%d%d",&a,&b);
points.push_back({a,{x,1}});
}
sort(points.begin(),points.end());
vector<pair<int,int> > red;
vector<pair<int,int> > b;
for (auto x : points){
if (x.second.second){
if (!b.empty()){
ans[b.back().second].push_back(x.second.first);
b.pop_back();
}
else{
red.push_back({x.first,x.second.first});
}
}
else{
for (int k = 0; k<2; k++){
if (!red.empty()){
ans[x.second.first].push_back(red.back().second);
red.pop_back();
}
else{
b.push_back({x.first,x.second.first});
}
}
}
}
for (int x = 0; x<n; x++){
printf("%d %d\n",ans[x][0]+1,ans[x][1]+1);
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |