| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 758726 | boyliguanhan | Toll (BOI17_toll) | C++17 | 1687 ms | 4856 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
int k, n, m, o, x, y, z, i, j, cost[50010][5], ans[50010];
int main() {
cin.sync_with_stdio(false);
cin.tie(nullptr);
memset(cost, 63, sizeof cost);
cin >> k >> n >> m >> o;
while(m--) {
cin >> x >> y >> z;
cost[x][y%k] = z;
}
while(o--) {
cin >> x >> y;
for(i = x; i <= y; ++i) ans[i] = 1e9; ans[x] = 0;
for(i = x; i < y/k*k; i++) for(j = 0; j < k; j++)
ans[i/k*k+k+j] = min(ans[i] + cost[i][j], ans[i/k*k+k+j]);
cout << (ans[y]==1e9?-1:ans[y]) << '\n';
}
}컴파일 시 표준 에러 (stderr) 메시지
| # | 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... | ||||
