제출 #1045116

#제출 시각아이디문제언어결과실행 시간메모리
1045116NickpapadakAddk (eJOI21_addk)C++14
0 / 100
8 ms1116 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("%d%d%d",&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("%d%d",&N,&K); ps[0] = 0; for(ll i =1;i<=N;++i){ scanf("%d", &A[i]); ps[i] = ps[i-1] + A[i]; } scanf("%d", &Q); while(Q--){ ll b; scanf("%d", &b); if(b == 2){ printf("%d\n", solveBF()); }else{ int x; scanf("%d", &x); } } return 0; }

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

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