답안 #398170

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
398170 2021-05-03T20:43:12 Z 1zaid1 Foehn Phenomena (JOI17_foehn_phenomena) C++14
30 / 100
1000 ms 3444 KB
#include <bits/stdc++.h>
using namespace std;

#define rall(v) v.rbegin(), v.rend()
#define all(v) v.begin(), v.end()
#define mp(a, b) make_pair(a, b)
#define pb(a) push_back(a)
#define endl '\n'
#define f first
#define s second

#define PI 3.14159265358979323846
#define ll128 __ll128_t

typedef pair<int, int> pi;
typedef vector<int> vi;
typedef long long ll;

const int INF = (1<<30), M = 5*1e5+7, MOD = 1000000007;
ll a[M], tmp[M], n, q, s, t;

ll calc() {
    for (int i = 0; i < n; i++) {
        tmp[i+1] = tmp[i];
        if (a[i] < a[i+1]) tmp[i+1] -= abs(a[i]-a[i+1])*s;
        else tmp[i+1] += abs(a[i]-a[i+1])*t;
    } return a[n];
}

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    srand(time(0));
    
    cin >> n >> q >> s >> t;

    for (int i = 0; i <= n; i++) {
        cin >> a[i];
    } calc();

    while (q--) {
        int l, r, x;
        cin >> l >> r >> x;

        for (int i = l; i <= r; i++) a[i] += x;
        calc();
        cout << tmp[n] << endl;
    }

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 332 KB Output is correct
2 Correct 9 ms 332 KB Output is correct
3 Correct 10 ms 392 KB Output is correct
4 Correct 12 ms 388 KB Output is correct
5 Correct 11 ms 332 KB Output is correct
6 Correct 10 ms 332 KB Output is correct
7 Correct 10 ms 368 KB Output is correct
8 Correct 10 ms 380 KB Output is correct
9 Correct 10 ms 332 KB Output is correct
10 Correct 9 ms 332 KB Output is correct
11 Correct 9 ms 332 KB Output is correct
12 Correct 9 ms 364 KB Output is correct
13 Correct 10 ms 388 KB Output is correct
14 Correct 9 ms 332 KB Output is correct
15 Correct 9 ms 336 KB Output is correct
16 Correct 6 ms 332 KB Output is correct
17 Correct 10 ms 332 KB Output is correct
18 Correct 8 ms 392 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1095 ms 3444 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 332 KB Output is correct
2 Correct 9 ms 332 KB Output is correct
3 Correct 10 ms 392 KB Output is correct
4 Correct 12 ms 388 KB Output is correct
5 Correct 11 ms 332 KB Output is correct
6 Correct 10 ms 332 KB Output is correct
7 Correct 10 ms 368 KB Output is correct
8 Correct 10 ms 380 KB Output is correct
9 Correct 10 ms 332 KB Output is correct
10 Correct 9 ms 332 KB Output is correct
11 Correct 9 ms 332 KB Output is correct
12 Correct 9 ms 364 KB Output is correct
13 Correct 10 ms 388 KB Output is correct
14 Correct 9 ms 332 KB Output is correct
15 Correct 9 ms 336 KB Output is correct
16 Correct 6 ms 332 KB Output is correct
17 Correct 10 ms 332 KB Output is correct
18 Correct 8 ms 392 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Execution timed out 1095 ms 3444 KB Time limit exceeded
23 Halted 0 ms 0 KB -