Submission #152992

#TimeUsernameProblemLanguageResultExecution timeMemory
152992PyqeIce Hockey World Championship (CEOI15_bobek)C++14
100 / 100
404 ms16888 KiB
#include <bits/stdc++.h> using namespace std; long long n,d,nn[2],a[2][69],z[2][1048576],sz[2],zzz=0; int main() { long long i,it,k,j; scanf("%lld%lld",&n,&d); nn[0]=(n-1)/2+1; nn[1]=n/2; for(it=0;it<2;it++) { sz[it]++; for(i=0;i<nn[it];i++) { scanf("%lld",&a[it][i]); k=sz[it]; for(j=0;j<k;j++) { z[it][sz[it]]=z[it][j]+a[it][i]; sz[it]++; } } } sort(z[0],z[0]+sz[0]); for(i=0;i<sz[1];i++) { k=d-z[1][i]; if(k>=0) { zzz+=upper_bound(z[0],z[0]+sz[0],k)-z[0]; } } printf("%lld\n",zzz); }

Compilation message (stderr)

bobek.cpp: In function 'int main()':
bobek.cpp:11:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld%lld",&n,&d);
  ~~~~~^~~~~~~~~~~~~~~~~~
bobek.cpp:19:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%lld",&a[it][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...
#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...