ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#211818 | #2118. 网吧 | djxqwq | Judgement Failed | / | / | C++ | 957b | 2024-10-06 15:24:35 | 2024-10-06 15:24:39 |
answer
#define lowbit(x) ((x)&(-x))
#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<deque>
using namespace std;
typedef long long LL; const LL N = 10005;
struct dd {
LL a[N], t[N];LL n;
}d[N];
inline LL read() {
LL x = 0, f = 1; char ch = getchar();
while (ch < '0' || ch>'9') { if (ch == '-')f = -1; ch = getchar(); }
while (ch >= '0' && ch <= '9') { x = (x << 1) + (x << 3) + ch - '0'; ch = getchar(); }
return f * x;
}LL sum = 0x3f3f3f;
void cmp(dd d[], LL a, LL b, LL sum1) {
for (int i = 0; i < d[b].n; i++) {
if (d[b].a[i] == a) {
sum=min(sum,sum1 + d[b].t[i]);
}
else {
cmp(d, a, d[b].a[i],sum1+d[b].t[i]);
}
}
}
int main() {
LL x12, m; cin >> x12 >> m;
while (m--) {
LL a, b, t;
a = read(); b = read(); t = read();
d[b].a[d[b].n] = a; d[b].t[d[b].n] = t; d[b].n++;
}
LL x, y; x = read(); y = read();
cmp(d, x, y, 0);
cout << sum;
}
详细
Failed to show details