Submission #395112

#TimeUsernameProblemLanguageResultExecution timeMemory
395112Daniel123Lightning Rod (NOI18_lightningrod)C++14
80 / 100
2088 ms236472 KiB
#include <iostream> #include <vector> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; int* x = new int[n]; int* y = new int[n]; vector<int> s; for (int i = 0; i < n; i++) { cin >> x[i] >> y[i]; while (!s.empty() && x[i] - x[s.back()] <= y[i] - y[s.back()]) { s.pop_back(); } if (s.empty() || x[i] - x[s.back()] > y[s.back()] - y[i]) { s.push_back(i); } } cout << s.size() << endl; cin >> 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...