Submission #138938

#TimeUsernameProblemLanguageResultExecution timeMemory
138938thebesLightning Rod (NOI18_lightningrod)C++14
80 / 100
2050 ms76356 KiB
#pragma GCC target("avx2") #pragma GCC optimization("O3") #pragma GCC optimization("unroll-loops") #include <bits/stdc++.h> using namespace std; #define scan(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0) char _; int n, i, x, y, f, a, b, sz=-1, X[10000005], Y[10000005]; int main(){ scan(n); for(i=1;i<=n;i++){ scan(x); scan(y); f=0; while(sz!=-1){ if(x-X[sz]<=Y[sz]-y) break; else if(y-Y[sz]>=x-X[sz]) sz--; else{f=1; break;} } if(sz==-1||f){ ++sz; X[sz] = x; Y[sz] = y; } } printf("%d\n",sz+1); return 0; }

Compilation message (stderr)

lightningrod.cpp:2:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization("O3")
 
lightningrod.cpp:3:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization("unroll-loops")
#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...