Submission #155201

#TimeUsernameProblemLanguageResultExecution timeMemory
155201dolphingarlicLightning Rod (NOI18_lightningrod)C++14
7 / 100
2074 ms137320 KiB
#include <bits/stdc++.h> using namespace std; #define MAXN 10000000 int pos[MAXN], neg[MAXN]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int N; cin >> N; for (int i = 0; i < N; i++) { int x, y; cin >> x >> y; pos[i] = x + y, neg[i] = x - y; } queue<pair<int, int>> mono; for (int i = N - 1; ~i; i--) { while (mono.size() && pos[i] >= mono.front().first) mono.pop(); if (!mono.size() || mono.front().second > neg[i]) mono.push({pos[i], neg[i]}); } cout << mono.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...