제출 #376277

#제출 시각아이디문제언어결과실행 시간메모리
376277HalogenBigger 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]; 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 = 0, x = 0; while (x < N) { x = lower_bound(presum + 1, presum + N + 1, presum[x] + presum[x]) - presum; ans++; printf("%lld\n", x); } if (x > N) ans--; printf("%lld\n", ans); }

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

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