# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
404247 | 2021-05-14T02:41:39 Z | joelau | 레이저 센서 (KOI16_laser) | C++14 | 2 ms | 300 KB |
#include <bits/stdc++.h> using namespace std; int N; pair<int,int> ans[1000]; tuple<int,int,int> lst[3000]; vector< pair<int,int> > v; int main() { scanf("%d", &N); for (int i = 0; i < N; ++i) { int x,y; scanf("%d %d", &x, &y); lst[i] = make_tuple(x,0,i); } for (int i = 0; i < N*2; ++i) { int x,y; scanf("%d %d", &x, &y); lst[i+N] = make_tuple(x,1,i+1); } sort(lst,lst+N*3); for (int i = 0; i < N*3; ++i) { if (v.size() >= 2 && get<1>(lst[i]) + v.back().first + v[v.size()-2].first == 2) { if (get<1>(lst[i]) == 0) ans[get<2>(lst[i])] = make_pair(v.back().second, v[v.size()-2].second); if (v.back().first == 0) ans[v.back().second] = make_pair(get<2>(lst[i]), v[v.size()-2].second); if (v[v.size()-2].first == 0) ans[v[v.size()-2].second] = make_pair(get<2>(lst[i]), v.back().second); v.pop_back(); v.pop_back(); } else v.emplace_back(get<1>(lst[i]),get<2>(lst[i])); } if (!v.empty()) printf("-1"); else { for (int i = 0; i < N; ++i) printf("%d %d\n", ans[i].first, ans[i].second); } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 296 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 2 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 1 ms | 204 KB | Output is correct |
11 | Correct | 1 ms | 204 KB | Output is correct |
12 | Correct | 1 ms | 204 KB | Output is correct |
13 | Correct | 1 ms | 204 KB | Output is correct |
14 | Correct | 2 ms | 300 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |