Submission #363591

#TimeUsernameProblemLanguageResultExecution timeMemory
363591keta_tsimakuridzeLightning Rod (NOI18_lightningrod)C++14
66 / 100
2074 ms53612 KiB
#include<bits/stdc++.h> #define f first #define s second using namespace std; const int N=1e7+5,mod=1e9+7; int t,x[N],y[N],n; stack<int> s; main(){ t=1; // cin >> t; while(t--){ cin>>n; for(int i=1;i<=n;i++){ cin>>x[i]>>y[i]; while(s.size() && x[s.top()]-y[s.top()]>=x[i]-y[i]) s.pop(); if(!s.size() || x[s.top()]+y[s.top()]<x[i]+y[i]) s.push(i); } 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...