제출 #273052

#제출 시각아이디문제언어결과실행 시간메모리
273052T0p_지구 온난화 (NOI13_gw)C++14
6 / 40
282 ms17532 KiB
#include<bits/stdc++.h> using namespace std; int n; long long h[1001000]; int solve(long long x) { bool ch = x < h[1]; int ret = 0; for(int i=2 ; i<=n ; i++) { if(x < h[i]) ch = true; else { if(ch) { ch = false; ret++; } } } if(ch) ret++; return ret; } int main() { scanf(" %d",&n); for(int i=1 ; i<=n ; i++) scanf(" %lld",&h[i]); long long l = 0, r = 2e9; while(l != r) { long long mid = (l+r)>>1; (solve(mid) >= solve(mid+1)) ? r = mid : l = mid+1; } printf("%d\n",solve(l)); return 0; }

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

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