답안 #980013

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
980013 2024-05-11T19:16:08 Z TheFuturoma Addk (eJOI21_addk) C++14
36 / 100
2000 ms 5248 KB
#include <cmath>
#include <algorithm>
#include <bitset>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <array>
#include <unordered_map>
#include <unordered_set>

using namespace std;
typedef long long ll;

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	
	int n, k;
    cin>>n>>k;
    if (k > 1) {
        return 0;
    }
    vector<ll> arr(n);
    vector<ll> prefix(1, 0);
    for (int i = 0; i < n; i++) {
        cin>>arr[i];
        prefix.push_back(prefix.back() + arr[i]);
    }
    int q;
    cin>>q;
    for (int test = 0; test < q; test++) {
        int t;
        cin>>t;
        if (t == 1) {
            int curr;
            cin>>curr;
            continue;
        }
        int left, right, m;
        cin>>left>>right>>m;
        left--;
        right--;
        ll res = 0;
        for (int i = left; i <= (right - m + 1); i++) {
            res += prefix[i + m] - prefix[i];
        }
        cout << res << endl;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 3 ms 344 KB Output is correct
3 Correct 5 ms 548 KB Output is correct
4 Correct 6 ms 604 KB Output is correct
5 Correct 9 ms 672 KB Output is correct
6 Correct 13 ms 856 KB Output is correct
7 Correct 17 ms 600 KB Output is correct
8 Correct 21 ms 860 KB Output is correct
9 Correct 36 ms 1032 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 119 ms 1772 KB Output is correct
2 Correct 239 ms 2132 KB Output is correct
3 Correct 419 ms 2516 KB Output is correct
4 Correct 1616 ms 4804 KB Output is correct
5 Execution timed out 2088 ms 5248 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -