# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
403595 | 2021-05-13T09:54:33 Z | tqbfjotld | None (KOI16_laser) | C++14 | 1 ms | 332 KB |
#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); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 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 | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 1 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 | 332 KB | Output is correct |
12 | Correct | 1 ms | 332 KB | Output is correct |
13 | Correct | 1 ms | 204 KB | Output is correct |
14 | Correct | 1 ms | 332 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |