제출 #1045051

#제출 시각아이디문제언어결과실행 시간메모리
1045051NickpapadakAddk (eJOI21_addk)C++14
0 / 100
184 ms1112 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 <= l+m-1;++i){ ans += ps[l+m-1] - ps[i-1]; // printf("%d %d: %d\n",i,i+m,ans); } ans += (ps[r-m] - ps[l+m-1])*m; for(int i = r-m+1; i <= r; ++i){ ans += ps[i] - ps[r-m]; } 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; }

컴파일 시 표준 에러 (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:24:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |         scanf("%d",&k);
      |         ~~~~~^~~~~~~~~
Main.cpp: In function 'int main()':
Main.cpp:35:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   35 |     scanf("%d%d",&N,&K);
      |     ~~~~~^~~~~~~~~~~~~~
Main.cpp:38:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   38 |         scanf("%d", &A[i]);
      |         ~~~~~^~~~~~~~~~~~~
Main.cpp:41:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   41 |     scanf("%d", &Q);
      |     ~~~~~^~~~~~~~~~
Main.cpp:44:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   44 |         scanf("%d", &b);
      |         ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...