Submission #938793

# Submission time Handle Problem Language Result Execution time Memory
938793 2024-03-05T14:28:31 Z vjudge1 Toll (BOI17_toll) C++17
7 / 100
70 ms 1500 KB
#include <bits/stdc++.h>
#define int long long

using namespace std;

int k, n, m, q, x, y, t;

signed main() {
    cin >> k >> n >> m >> q;
    vector<int> a(n, 1e10), prefix(n);
    for(int i = 0; i < m; i++) {
        cin >> x >> y >> t;
        a[x] = t;
    }
    for(int i = 0; i < n; i++) prefix[i] = a[i] + (i == 0 ? 0 : prefix[i - 1]);
    while(q--) {
        cin >> x >> y;
        if(prefix[y - 1] - (x == 0 ? 0 : prefix[x - 1]) >= 1e10) cout << "-1\n";
        else cout << (prefix[y - 1] - (x == 0 ? 0 : prefix[x - 1])) << "\n";
    }
}
# Verdict Execution time Memory Grader output
1 Correct 43 ms 1116 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 4 ms 500 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 2 ms 348 KB Output is correct
8 Correct 43 ms 1500 KB Output is correct
9 Correct 41 ms 1112 KB Output is correct
10 Correct 19 ms 1116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 70 ms 1220 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 43 ms 1116 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 4 ms 500 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 2 ms 348 KB Output is correct
8 Correct 43 ms 1500 KB Output is correct
9 Correct 41 ms 1112 KB Output is correct
10 Correct 19 ms 1116 KB Output is correct
11 Incorrect 70 ms 1220 KB Output isn't correct
12 Halted 0 ms 0 KB -