제출 #146972

#제출 시각아이디문제언어결과실행 시간메모리
146972gs14004Lightning Rod (NOI18_lightningrod)C++17
66 / 100
2059 ms229448 KiB
#include <bits/stdc++.h> #define sz(v) ((int)(v).size()) using namespace std; typedef long long lint; typedef pair<int, int> pi; const int MAXN = 10000005; int n; pi a[MAXN]; vector<int> stk; bool in(int x, int y){ return a[x].first - a[x].second <= a[y].first - a[y].second && a[y].first + a[y].second <= a[x].first + a[x].second; } int main(){ scanf("%d",&n); for(int i=0; i<n; i++){ scanf("%d %d",&a[i].first,&a[i].second); if(stk.empty()) stk.push_back(i); else{ if(in(stk.back(), i)) continue; while(!stk.empty() && in(i, stk.back())) stk.pop_back(); stk.push_back(i); } } printf("%d\n", sz(stk)); }

컴파일 시 표준 에러 (stderr) 메시지

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