제출 #376282

#제출 시각아이디문제언어결과실행 시간메모리
376282HalogenBigger segments (IZhO19_segments)C++14
0 / 100
1 ms364 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int N, presum[500005]; int check(int x) { int ans = 1, curseg = presum[x]; while (x < N) { int nx = lower_bound(presum + 1, presum + N + 1, curseg + presum[x]) - presum; if (presum[nx] - presum[x] - curseg < 0) return 0; curseg = presum[nx] - presum[x]; ans++; x = nx; // printf("%lld\n", x); } return ans; } main() { scanf("%lld", &N); for (int i = 1; i <= N; i++) scanf("%lld", &presum[i]); for (int i = 2; i <= N; i++) presum[i] += presum[i - 1]; int ans = 1; for (int x = 1; x <= N; x++) { ans = max(ans, check(x)); } printf("%lld\n", ans); }

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

segments.cpp:22:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   22 | main() {
      |      ^
segments.cpp: In function 'int main()':
segments.cpp:23:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   23 |     scanf("%lld", &N);
      |     ~~~~~^~~~~~~~~~~~
segments.cpp:24:39: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   24 |     for (int i = 1; i <= N; i++) scanf("%lld", &presum[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...