Submission #865352

#TimeUsernameProblemLanguageResultExecution timeMemory
865352Trisanu_DasLightning Rod (NOI18_lightningrod)C++17
0 / 100
2032 ms28804 KiB
#include <bits/stdc++.h> using namespace std; int dp[10000005], n, mx; stack<int> s; int main(){ cin >> n; for(int i = 0; i < n; i++){ int x, y; cin >> x >> y; if(i == 0){ mx = x + y; s.push(x - y); }else if(mx < x + y){ while(!s.empty() && s.top() >= (x - y)) s.pop(); s.push(x - y); mx = x + y; } cout << s.size() << '\n'; } }
#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...