Submission #265318

#TimeUsernameProblemLanguageResultExecution timeMemory
265318T0p_Lightning Rod (NOI18_lightningrod)C++14
0 / 100
2077 ms61596 KiB
#include<bits/stdc++.h> using namespace std; pair<int, int> arr[10000005]; int main() { int n, now = 0; scanf(" %d",&n); while(n--) { int x, y; scanf(" %d %d",&x,&y); if(now == 0) arr[++now] = {x, y}; else { int h = arr[now].second - x + arr[now].first; if(h >= y) continue ; int l = 1, r = now; while(l != r) { int mid = (l+r+1)>>1; int h = y - x + arr[mid].first; if(h >= arr[mid].second) r = mid-1; else l = mid; } now = l; arr[++now] = {x, y}; } } printf("%d\n",now); return 0; }

Compilation message (stderr)

lightningrod.cpp: In function 'int main()':
lightningrod.cpp:9:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    9 |  scanf(" %d",&n);
      |  ~~~~~^~~~~~~~~~
lightningrod.cpp:13:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   13 |   scanf(" %d %d",&x,&y);
      |   ~~~~~^~~~~~~~~~~~~~~~
#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...