Submission #197442

#TimeUsernameProblemLanguageResultExecution timeMemory
197442quocnguyen1012Lightning Rod (NOI18_lightningrod)C++14
11 / 100
1773 ms192460 KiB
#include <bits/stdc++.h> int hmt() {int x=0;int c=getchar(),n=0;for(;!isdigit(c);c=getchar()) n=(c=='-');for(;isdigit(c);c=getchar()) x=x*10+c-'0';if(n) x=-x;return x;} #define in hmt() #define fi first #define se second #define mp make_pair #define pb push_back using namespace std; typedef long long ll; signed main(void) { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); if (fopen("A.INP", "r")){ freopen("A.INP", "r", stdin); freopen("A.OUT", "w", stdout); } int N = in; deque<pair<int, int>> dq; while (N--){ int x = in, y = in; bool ok = 1; while (dq.size()){ auto now = dq.front(); if (x - now.fi <= now.se - y){ ok = false; break; } else if (x - now.fi <= y - now.se){ dq.pop_front(); } else break; } if (ok){ dq.pb(mp(x, y)); } } cout << (int)dq.size() << '\n'; }

Compilation message (stderr)

lightningrod.cpp: In function 'int main()':
lightningrod.cpp:17:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen("A.INP", "r", stdin);
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
lightningrod.cpp:18:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen("A.OUT", "w", stdout);
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
#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...