제출 #1290012

#제출 시각아이디문제언어결과실행 시간메모리
1290012austinAddk (eJOI21_addk)C++20
36 / 100
2094 ms4560 KiB
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC taget("avx2") using namespace std; int main() { int16_t type; long long temp, counter = 0, window; 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); window = 0; counter = 0; for (j=l; j<l+m; j++) { window += v[j]; } counter += window; for (j=l+m; j<=r; j++) { window += v[j] - v[j-m]; counter += window; } printf("%lld\n", counter); } } }

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

Main.cpp: In function 'int main()':
Main.cpp:9:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |   scanf("%d %d", &n, &k);
      |   ~~~~~^~~~~~~~~~~~~~~~~
Main.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     scanf("%lld", &v[i]);
      |     ~~~~~^~~~~~~~~~~~~~~
Main.cpp:15:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |   scanf("%d", &q);
      |   ~~~~~^~~~~~~~~~
Main.cpp:17:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |     scanf("%hd", &type);
      |     ~~~~~^~~~~~~~~~~~~~
Main.cpp:20:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |         scanf("%d", &operations[j]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~
Main.cpp:28:12: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   28 |       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...