제출 #1282302

#제출 시각아이디문제언어결과실행 시간메모리
1282302austinAddk (eJOI21_addk)C++20
36 / 100
2094 ms2908 KiB
#include <bits/stdc++.h> using namespace std; int main() { int16_t type; long long temp, counter=0; int n, k, q, l, r, m, i, j, s; scanf("%d %d", &n, &k); vector<long long> v(n+1); vector<int> operations(k); for (i=1; i<=n; i++) { scanf("%lld", &v[i]); } scanf("%d", &q); for (i=0; i<q; i++) { scanf("%hd", &type); if (type == 1) { for (j=0; j<k; j++) { scanf("%d", &operations[j]); } temp = v[operations[0]]; for (j=1; j<k; j++) { v[operations[j-1]] = v[operations[j]]; } v[operations[k-1]] = temp; } else { scanf("%d %d %d", &l, &r, &m); vector<long long> prefix(n+1, 0); for (j = 1; j <= n; j++) { prefix[j] = prefix[j-1] + v[j]; } counter = 0; for (s = l; s + m - 1 <= r; s++) { counter += prefix[s + m - 1] - prefix[s - 1]; } printf("%lld\n", counter); } } }

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

Main.cpp: In function 'int main()':
Main.cpp:7:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |   scanf("%d %d", &n, &k);
      |   ~~~~~^~~~~~~~~~~~~~~~~
Main.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     scanf("%lld", &v[i]);
      |     ~~~~~^~~~~~~~~~~~~~~
Main.cpp:13:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |   scanf("%d", &q);
      |   ~~~~~^~~~~~~~~~
Main.cpp:15:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |     scanf("%hd", &type);
      |     ~~~~~^~~~~~~~~~~~~~
Main.cpp:18:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |         scanf("%d", &operations[j]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~
Main.cpp:26:12: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |       scanf("%d %d %d", &l, &r, &m);
      |       ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...