제출 #253016

#제출 시각아이디문제언어결과실행 시간메모리
253016infinite_iq원 고르기 (APIO18_circle_selection)C++14
0 / 100
1874 ms56552 KiB
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0) #include <bits/stdc++.h> using namespace std; #define sqr 340 #define mp make_pair #define mid (l+r)/2 #define le node * 2 #define ri node * 2 + 1 #define pb push_back #define ppb pop_back #define fi first #define se second #define lb lower_bound #define ub upper_bound #define ins insert #define era erase #define C continue #define mem(dp,i) memset(dp,i,sizeof(dp)) #define mset multiset #define all(x) x.begin(), x.end() #define gc getchar_unlocked typedef long long ll; typedef short int si; typedef long double ld; typedef pair<int,int> pi; typedef pair<ll,ll> pll; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<pi> vpi; typedef vector<pll> vpll; typedef pair<double,ll>pdi; const ll inf=1e18; const ll mod=987654321; const ld Pi=acos(-1); int n ; int X [300009] , Y [300009] , R [300009] ; int ans [300009] ; set < pi > s1 , s2 , s3 ; int main () { cin >> n ; for ( int i = 0 ; i < n ; i ++ ) { scanf ("%d%d%d", &X [i], &Y [i] , &R [i] ) ; s1 .ins ( { R [i] , n - i } ) ; s2 .ins ( { X [i] - R [i] , i } ) ; s3 .ins ( { X [i] + R [i] , i } ) ; } while ( s1 .size () ) { pi ret = * s1 .rbegin () ; s1 .era ( ( -- s1.end () ) ) ; ret .se = n - ret .se ; int l = X [ret.se] - R [ret.se] , r = X [ret.se] + R [ret.se] ; vi todel ; for ( auto it = s2 .lb ( { l , - 1 } ) ; it != s2 .end () ; it ++ ) { pi crnt = *it ; if ( crnt .fi > r ) break ; todel .pb ( crnt .se ) ; } for ( auto it = s3 .lb ( { l , - 1 } ) ; it != s3 .end () ; it ++ ) { pi crnt = *it ; if ( crnt .fi > r ) break ; todel .pb ( crnt .se ) ; } for ( auto u : todel ) { if ( s1 .find ( { R [u] , u } ) != s1 .end () ) s1 .era ( { R [u] , u } ) ; if ( s2 .find ( { X [u] - R [u] , u } ) != s2 .end () ) s2 .era ( { X [u] - R [u] , u } ) ; if ( s3 .find ( { X [u] + R [u] , u } ) != s3 .end () ) s3 .era ( { X [u] + R [u] , u } ) ; ans [u] = ret .se ; } } for ( int i = 0 ; i < n ; i ++ ) printf ("%d ", ans [i] + 1 ) ; cout << endl ; }

컴파일 시 표준 에러 (stderr) 메시지

circle_selection.cpp: In function 'int main()':
circle_selection.cpp:42:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
                 scanf ("%d%d%d", &X [i], &Y [i] , &R [i] ) ;
                 ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...