Submission #549062

#TimeUsernameProblemLanguageResultExecution timeMemory
549062BelguteiLightning Rod (NOI18_lightningrod)C++17
14 / 100
1383 ms92696 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define ff first #define ss second #define pb push_back #define mk make_pair #define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; int a,b; map<int,int> mp; int mx = -1; int ans; stack<int> s; int main(){ IOS cin >> n; for(int i = 0; i < n; i++){ cin >> a >> b; if(a + b <= mx){ continue; } mx = max(mx,a+b); int val = max(a,b) - min(a,b); while(s.size()>0){ if(s.top() >= val){ s.pop(); } else break; } s.push(val); } cout << s.size(); }
#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...