제출 #545403

#제출 시각아이디문제언어결과실행 시간메모리
545403krit3379Bigger segments (IZhO19_segments)C++17
0 / 100
1 ms212 KiB
#include<bits/stdc++.h> using namespace std; #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #define N 500005 int ans; long long a[N],now,pos,val; int main(){ int n,i; scanf("%d",&n); for(i=1;i<=n;i++)scanf("%lld",&a[i]),a[i]+=a[i-1]; now=0; val=0; while(now<n){ ans++; pos=lower_bound(a+1,a+n+1,a[now]+val)-a; val=a[pos]-a[now]; now=pos; } if(now==n+1)ans--; printf("%d",ans); return 0; }

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

segments.cpp: In function 'int main()':
segments.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     scanf("%d",&n);
      |     ~~~~~^~~~~~~~~
segments.cpp:13:27: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     for(i=1;i<=n;i++)scanf("%lld",&a[i]),a[i]+=a[i-1];
      |                      ~~~~~^~~~~~~~~~~~~~
#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...