Submission #131243

#TimeUsernameProblemLanguageResultExecution timeMemory
131243FedericoSLightning Rod (NOI18_lightningrod)C++14
40 / 100
2053 ms50772 KiB
#include <iostream> #include <algorithm> using namespace std; int N; int X[10000007]; int Y[10000007]; int B[10000007]; int V[10000007]; int ans; bool comp(int a, int b){ return Y[a]>Y[b]; } int main(){ cin>>N; for(int i=0;i<N;i++){ cin>>X[i]>>Y[i]; V[i]=i; } sort(V,V+N,comp); for(int a=0;a<N;a++){ int i=V[a]; for(int j=0;j<N;j++) if(B[j] and abs(X[i]-X[j])<=Y[j]-Y[i]) B[i]=true; if(B[i]) continue; B[i]=true; ans++; } cout<<ans; }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...