Submission #51507

# Submission time Handle Problem Language Result Execution time Memory
51507 2018-06-18T04:47:50 Z gaming0d Foehn Phenomena (JOI17_foehn_phenomena) C++11
30 / 100
1000 ms 2204 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int   N = 2e5 + 5;

int n, q, s, t;
int l, r, x;
int a[N];

void solve(int l, int r, int x)
{
    a[l-1] += x;
    a[r] -= x;
    int res = 0;
    for (int i = 0;i < n;++i) {
        res += (a[i] > 0 ? -s * a[i] : -t * a[i]);
    }
    cout << res << "\n";
    return;
}

signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    cin >> n >> q >> s >> t;
    int prev, nex; cin >> prev;
    for (int i = 0;i < n;++i) {
        cin >> nex;
        a[i] = nex - prev;
        prev = nex;
    }

    for (int i = 0;i < q;++i) {
        cin >> l >> r >> x;
        solve(l, r, x);
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 9 ms 416 KB Output is correct
2 Correct 9 ms 500 KB Output is correct
3 Correct 10 ms 604 KB Output is correct
4 Correct 11 ms 604 KB Output is correct
5 Correct 9 ms 604 KB Output is correct
6 Correct 10 ms 792 KB Output is correct
7 Correct 13 ms 792 KB Output is correct
8 Correct 9 ms 792 KB Output is correct
9 Correct 9 ms 792 KB Output is correct
10 Correct 9 ms 792 KB Output is correct
11 Correct 9 ms 792 KB Output is correct
12 Correct 8 ms 792 KB Output is correct
13 Correct 10 ms 792 KB Output is correct
14 Correct 8 ms 792 KB Output is correct
15 Correct 8 ms 792 KB Output is correct
16 Correct 7 ms 792 KB Output is correct
17 Correct 7 ms 792 KB Output is correct
18 Correct 7 ms 792 KB Output is correct
19 Correct 2 ms 792 KB Output is correct
20 Correct 2 ms 792 KB Output is correct
21 Correct 2 ms 792 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 2204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 ms 416 KB Output is correct
2 Correct 9 ms 500 KB Output is correct
3 Correct 10 ms 604 KB Output is correct
4 Correct 11 ms 604 KB Output is correct
5 Correct 9 ms 604 KB Output is correct
6 Correct 10 ms 792 KB Output is correct
7 Correct 13 ms 792 KB Output is correct
8 Correct 9 ms 792 KB Output is correct
9 Correct 9 ms 792 KB Output is correct
10 Correct 9 ms 792 KB Output is correct
11 Correct 9 ms 792 KB Output is correct
12 Correct 8 ms 792 KB Output is correct
13 Correct 10 ms 792 KB Output is correct
14 Correct 8 ms 792 KB Output is correct
15 Correct 8 ms 792 KB Output is correct
16 Correct 7 ms 792 KB Output is correct
17 Correct 7 ms 792 KB Output is correct
18 Correct 7 ms 792 KB Output is correct
19 Correct 2 ms 792 KB Output is correct
20 Correct 2 ms 792 KB Output is correct
21 Correct 2 ms 792 KB Output is correct
22 Execution timed out 1086 ms 2204 KB Time limit exceeded
23 Halted 0 ms 0 KB -