제출 #494218

#제출 시각아이디문제언어결과실행 시간메모리
494218nickmet2004Bigger segments (IZhO19_segments)C++11
0 / 100
4 ms324 KiB
#include<bits/stdc++.h> using namespace std; const int N = 5e5 + 5; int n , a[N]; int main (){ ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; for(int i = 1; i<= n;++i)cin >> a[i]; int x = a[1] , i = 2; set<int> s; int ans = 1; while(i <= n){ int y =0; while(x > y + a[i])y+=a[i] , ++i ,s.insert(y); y+=a[i]; //cout << y << " y" << endl; ans++; int z = (y - x)/2; int q = *s.lower_bound(z); s.clear(); y -= z; x = y; ++i; }cout << ans; }

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

segments.cpp: In function 'int main()':
segments.cpp:19:13: warning: unused variable 'q' [-Wunused-variable]
   19 |         int q = *s.lower_bound(z);
      |             ^
#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...