# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
938797 | vjudge1 | Toll (BOI17_toll) | C++17 | 132 ms | 8064 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define int long long
#define ff first
#define ss second
using namespace std;
struct Edge {
int x, y, t;
Edge(int xi, int yi, int ti):x(xi),y(yi),t(ti){}
};
int k, n, m, q, x, y, t;
vector<vector<Edge>> graph;
signed main() {
cin >> k >> n >> m >> q;
if(k == 1) {
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";
}
return 0;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |