Submission #363594

#TimeUsernameProblemLanguageResultExecution timeMemory
363594keta_tsimakuridzeLightning Rod (NOI18_lightningrod)C++14
80 / 100
2041 ms157328 KiB
#include<bits/stdc++.h> #define f first #define s second using namespace std; const int N=1e7+5; int t,x,y,n; stack<pair<int,int> > s; main(){ ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0); cin>>n; for(int i=1;i<=n;i++){ cin>>x>>y; int a1=x-y; while(s.size() && s.top().f>=a1) s.pop(); int a2=x+y; if(s.size()==0 || s.top().s<a2) s.push({a1,a2}); } cout<<s.size(); }

Compilation message (stderr)

lightningrod.cpp:8:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    8 |  main(){
      |       ^
#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...