Submission #197939

#TimeUsernameProblemLanguageResultExecution timeMemory
197939popovicirobertLightning Rod (NOI18_lightningrod)C++14
0 / 100
2025 ms203908 KiB
#include <bits/stdc++.h> #define ll long long #define ull unsigned long long #define lsb(x) (x & (-x)) #define uint unsigned int using namespace std; const int MAXN = (int) 1e7; int x[MAXN + 1], y[MAXN + 1]; int stk[MAXN + 1]; int main() { #ifdef HOME ifstream cin("A.in"); //ofstream cout("A.out"); #endif int i, n; ios::sync_with_stdio(false); cin.tie(0), cout.tie(0); cin >> n; for(i = 1; i <= n; i++) { cin >> x[i] >> y[i]; } int sz = 0; for(i = 1; i <= n; i++) { while(sz > 0 && x[i] - x[stk[sz]] <= y[i] - y[stk[sz]]) { sz--; } stk[++sz] = i; } cout << sz; return 0; }
#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...