Submission #1045048

#TimeUsernameProblemLanguageResultExecution timeMemory
1045048NickpapadakAddk (eJOI21_addk)C++14
0 / 100
545 ms2388 KiB
#include<bits/stdc++.h> using namespace std; const unsigned int MAXN = 1e+5 + 10; int N, K, Q; int A[MAXN], ps[MAXN]; int solveBF(){ int ans = 0; int l,r,m; scanf("%d%d%d",&l,&r,&m); for(int i = l; i+m-1 <= r;++i){ ans += ps[i+m-1] - ps[i-1]; // printf("%d %d: %d\n",i,i+m,ans); } return ans; } int scanBF(){ int k; for(int i = 1; i<=K;++i){ scanf("%d",&k); } return -1; } int BF(int typE){ if(typE == 1) return scanBF(); return solveBF(); } int main(){ scanf("%d%d",&N,&K); ps[0] = 0; for(int i =1;i<=N;++i){ scanf("%d", &A[i]); ps[i] = ps[i-1] + A[i]; } scanf("%d", &Q); while(Q--){ int b; scanf("%d", &b); b = BF(b); if(b != -1) printf("%d\n", b); } return 0; }

Compilation message (stderr)

Main.cpp: In function 'int solveBF()':
Main.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     scanf("%d%d%d",&l,&r,&m);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~
Main.cpp: In function 'int scanBF()':
Main.cpp:21:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |         scanf("%d",&k);
      |         ~~~~~^~~~~~~~~
Main.cpp: In function 'int main()':
Main.cpp:32:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |     scanf("%d%d",&N,&K);
      |     ~~~~~^~~~~~~~~~~~~~
Main.cpp:35:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   35 |         scanf("%d", &A[i]);
      |         ~~~~~^~~~~~~~~~~~~
Main.cpp:38:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   38 |     scanf("%d", &Q);
      |     ~~~~~^~~~~~~~~~
Main.cpp:41:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   41 |         scanf("%d", &b);
      |         ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...