# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
135010 | 2019-07-23T14:14:56 Z | Lawliet | 원 고르기 (APIO18_circle_selection) | C++14 | 1407 ms | 59884 KB |
#include <bits/stdc++.h> #define MAX 300010 #define R first.first #define I first.second #define X second.first #define Y second.second using namespace std; typedef long long int lli; typedef pair<lli,lli> pii; typedef pair<pii,pii> circle; int n; int n1, n2, n3; int x[MAX]; int r[MAX]; int removed[MAX]; vector<circle> v; set<pii> points; set<pii>::iterator it; int main() { scanf("%d",&n); memset(removed , -1 , sizeof(removed)); for(int g = 1 ; g <= n ; g++) { scanf("%d %d %d",&n1,&n2,&n3); circle k; k = {{-n3 , g} , {n1 , n2}}; points.insert({n1 - n3 , g}); points.insert({n1 + n3 , g}); x[g] = n1; r[g] = n3; v.push_back( k ); } sort(v.begin() , v.end()); for(int g = 0 ; g < n ; g++) { if(removed[ v[g].I ] != -1) continue; it = points.lower_bound(make_pair(x[v[g].I] - r[v[g].I] , -1)); while(!points.empty()) { if(it == points.end()) break; if(x[v[g].I] + r[v[g].I] < it->first) break; int cur = it->second; points.erase({x[cur] - r[cur] , cur}); points.erase({x[cur] + r[cur] , cur}); removed[cur] = v[g].I; it = points.lower_bound(make_pair(x[v[g].I] - r[v[g].I] , -1)); } } for(int g = 1 ; g <= n ; g++) printf("%d ",removed[g]); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 1528 KB | Output is correct |
2 | Correct | 3 ms | 1528 KB | Output is correct |
3 | Incorrect | 3 ms | 1528 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1233 ms | 53004 KB | Output is correct |
2 | Correct | 1301 ms | 53028 KB | Output is correct |
3 | Correct | 1373 ms | 59480 KB | Output is correct |
4 | Correct | 1407 ms | 59884 KB | Output is correct |
5 | Correct | 1048 ms | 57392 KB | Output is correct |
6 | Correct | 1028 ms | 57588 KB | Output is correct |
7 | Correct | 971 ms | 57660 KB | Output is correct |
8 | Correct | 994 ms | 57544 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 1528 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1008 ms | 52912 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 1528 KB | Output is correct |
2 | Correct | 3 ms | 1528 KB | Output is correct |
3 | Incorrect | 3 ms | 1528 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 1528 KB | Output is correct |
2 | Correct | 3 ms | 1528 KB | Output is correct |
3 | Incorrect | 3 ms | 1528 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |