Submission #219594

#TimeUsernameProblemLanguageResultExecution timeMemory
219594GioChkhaidzeLightning Rod (NOI18_lightningrod)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; const int N=1e7+7; bool f[N]; register int c; int n,x,y,X[N],Y[N],st[N],sts; int getn() { char ch = getchar_unlocked(); int ans = 0; while(!isdigit(ch)) { ch = getchar_unlocked(); } while(isdigit(ch)) { ans = ans * 10 + ch - '0'; ch = getchar_unlocked(); } return ans; } main () { n=getn(); for (int i=1; i<=n; i++) { x=getn(); y=getn(); X[i]=x-y; Y[i]=x+y; } for (int i=1; i<=n; i++) { if (sts) { while (sts && X[st[sts]]>=X[i]) { f[st[sts]]=1; --sts; } } st[++sts]=i; } sts=0; for (int i=n; i>=1; i--) { if (f[i]) continue; if (sts) { while (sts && Y[st[sts]]<=Y[i]) { --sts; } } st[++sts]=i; } cout<<sts; }

Compilation message (stderr)

lightningrod.cpp:22:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main () {
       ^
lightningrod.cpp:5:14: error: register name not specified for 'c'
 register int c; 
              ^