Submission #363592

#TimeUsernameProblemLanguageResultExecution timeMemory
363592keta_tsimakuridzeLightning Rod (NOI18_lightningrod)C++14
80 / 100
2041 ms154840 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(){ ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0); 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...