답안 #632440

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
632440 2022-08-20T04:25:19 Z pragmatist Addk (eJOI21_addk) C++17
36 / 100
2000 ms 1396 KB
#include<bits/stdc++.h>
 
#define ll long long
#define nl "\n"
 
using namespace std;
 
const int N = (int)1e5 + 7;
 
int n, k, q, a[N];
 
int main() {
	ios_base::sync_with_stdio(NULL);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> k;
	for(int i = 1; i <= n; ++i) cin >> a[i];
	cin >> q;
	while(q--) {
		char tp;
		cin >> tp;
		if(tp == '1') {
			vector<int> v(k);
			for(auto &x : v) cin >> x;
			continue;
			int o = a[v[0]];
			for(int i = 0; i < k - 1; ++i) a[v[i]] = a[v[i + 1]];
			a[v.back()] = o;
		} else {
			int l, r, m;
			cin >> l >> r >> m;
			ll sum = 0, ans = 0;
			for(int i = l; i <= l + m - 1; ++i) sum += a[i];
			ans += sum;
			for(int i = l + m; i <= r; ++i) {
				sum += a[i];
				sum -= a[i - m];
				ans += sum;
			}    
			cout << ans << nl;
		}
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 6 ms 356 KB Output is correct
5 Correct 9 ms 340 KB Output is correct
6 Correct 15 ms 360 KB Output is correct
7 Correct 24 ms 340 KB Output is correct
8 Correct 37 ms 412 KB Output is correct
9 Correct 53 ms 428 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 200 ms 616 KB Output is correct
2 Correct 447 ms 848 KB Output is correct
3 Correct 807 ms 1152 KB Output is correct
4 Execution timed out 2075 ms 1396 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 994 ms 1128 KB Output isn't correct
2 Halted 0 ms 0 KB -