Submission #1045120

#TimeUsernameProblemLanguageResultExecution timeMemory
1045120NickpapadakAddk (eJOI21_addk)C++14
36 / 100
2059 ms4924 KiB
#include<bits/stdc++.h> using namespace std; const unsigned int MAXN = 1e+5 + 10; #define ll long long ll N, K, Q; ll A[MAXN], ps[MAXN]; ll solveBF(){ ll ans = 0; ll l,r,m; scanf("%lld%lld%lld",&l,&r,&m); // for(ll i = l; i <= l+m-1;++i){ // ans += ps[l+m-1] - ps[i-1]; // // prllf("%d %d: %d\n",i,i+m,ans); // } // ans += (ps[r-m] - ps[l+m-1])*m; // for(ll i = r-m+1; i <= r; ++i){11 // ans += ps[i] - ps[r-m]; // } ll re = l+m-1; while(re <=r){ ans += (ps[re]-ps[l-1]); l++;re++; } return ans; } // int scanBF(){ // int k; // // scanf("%d",&k); // return -1; // } // int BF(int typE){ // if(typE == 1) return scanBF(); // return solveBF(); // } int main(){ scanf("%lld%lld",&N,&K); ps[0] = 0; for(ll i =1;i<=N;++i){ scanf("%lld", &A[i]); ps[i] = ps[i-1] + A[i]; } scanf("%lld", &Q); while(Q--){ ll b; scanf("%lld", &b); if(b == 2){ printf("%lld\n", solveBF()); }else{ int x; scanf("%lld", &x); } } return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:53:23: warning: format '%lld' expects argument of type 'long long int*', but argument 2 has type 'int*' [-Wformat=]
   53 |             scanf("%lld", &x);
      |                    ~~~^   ~~
      |                       |   |
      |                       |   int*
      |                       long long int*
      |                    %d
Main.cpp: In function 'long long int solveBF()':
Main.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     scanf("%lld%lld%lld",&l,&r,&m);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp: In function 'int main()':
Main.cpp:39:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   39 |     scanf("%lld%lld",&N,&K);
      |     ~~~~~^~~~~~~~~~~~~~~~~~
Main.cpp:42:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   42 |         scanf("%lld", &A[i]);
      |         ~~~~~^~~~~~~~~~~~~~~
Main.cpp:45:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   45 |     scanf("%lld", &Q);
      |     ~~~~~^~~~~~~~~~~~
Main.cpp:48:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   48 |         scanf("%lld", &b);
      |         ~~~~~^~~~~~~~~~~~
Main.cpp:53:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   53 |             scanf("%lld", &x);
      |             ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...