10013 | 2024-03-24 09:17:47 | 111 | Autópálya infláció | cpp17 | Wrong answer 15/100 | 68ms | 9520 KiB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N,M;
cin>>N>>M;
vector<vector<pair<int,int>>>g(N);
for(int i=0;i<M;i++){
int a,b,c;
cin>>a>>b>>c;
a--,b--;
g[a].emplace_back(b,c);
g[b].emplace_back(a,c);
}
vector<array<double,2>>dp(N,{INFINITY,INFINITY});
dp[0][0]=0;
for(int i=0;i+1<N;i++){
vector<int>v;
for(int j=0;j<N;j++){
if(i>0&&dp[j][i&1]>=dp[j][i&1^1]){
dp[j][i&1]=dp[j][i&1^1];
continue;
}
v.push_back(j);
}
for(int j:v){
for(auto[k,w]:g[j]){
dp[k][i&1^1]=min(dp[k][i&1^1],dp[j][i&1]+w*pow(2,i));
}
}
}
for(int i=1;i<N;i++){
cout<<fixed<<setprecision(0)<<fmod(*min_element(dp[i].begin(),dp[i].end()),1000000007)<<'\n';
}
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1892 KiB | ||||
2 | Wrong answer | 64ms | 3456 KiB | ||||
subtask2 | 0/8 | ||||||
3 | Accepted | 59ms | 3528 KiB | ||||
4 | Wrong answer | 61ms | 3544 KiB | ||||
5 | Wrong answer | 61ms | 3868 KiB | ||||
6 | Accepted | 61ms | 3852 KiB | ||||
7 | Wrong answer | 59ms | 3828 KiB | ||||
subtask3 | 15/15 | ||||||
8 | Accepted | 3ms | 3132 KiB | ||||
9 | Accepted | 3ms | 3228 KiB | ||||
10 | Accepted | 3ms | 3272 KiB | ||||
11 | Accepted | 3ms | 3484 KiB | ||||
12 | Accepted | 3ms | 3584 KiB | ||||
13 | Accepted | 3ms | 3584 KiB | ||||
14 | Accepted | 3ms | 3808 KiB | ||||
15 | Accepted | 3ms | 4024 KiB | ||||
16 | Accepted | 3ms | 4124 KiB | ||||
17 | Accepted | 3ms | 4336 KiB | ||||
18 | Accepted | 3ms | 4344 KiB | ||||
subtask4 | 0/34 | ||||||
19 | Accepted | 63ms | 5652 KiB | ||||
20 | Wrong answer | 64ms | 5840 KiB | ||||
21 | Wrong answer | 64ms | 5880 KiB | ||||
22 | Accepted | 64ms | 6200 KiB | ||||
23 | Accepted | 63ms | 6360 KiB | ||||
24 | Wrong answer | 64ms | 6428 KiB | ||||
25 | Accepted | 61ms | 6272 KiB | ||||
26 | Accepted | 61ms | 6188 KiB | ||||
27 | Wrong answer | 64ms | 6344 KiB | ||||
28 | Wrong answer | 61ms | 6220 KiB | ||||
29 | Wrong answer | 61ms | 6268 KiB | ||||
30 | Wrong answer | 54ms | 6280 KiB | ||||
31 | Wrong answer | 61ms | 6332 KiB | ||||
32 | Wrong answer | 64ms | 6740 KiB | ||||
33 | Wrong answer | 64ms | 6764 KiB | ||||
subtask5 | 0/21 | ||||||
34 | Wrong answer | 6ms | 6032 KiB | ||||
35 | Accepted | 7ms | 6452 KiB | ||||
36 | Accepted | 7ms | 6524 KiB | ||||
37 | Accepted | 7ms | 6768 KiB | ||||
38 | Accepted | 7ms | 6744 KiB | ||||
39 | Accepted | 7ms | 6828 KiB | ||||
40 | Wrong answer | 8ms | 6836 KiB | ||||
41 | Wrong answer | 7ms | 6868 KiB | ||||
42 | Wrong answer | 4ms | 6800 KiB | ||||
43 | Wrong answer | 4ms | 6728 KiB | ||||
44 | Wrong answer | 4ms | 6876 KiB | ||||
45 | Wrong answer | 4ms | 6820 KiB | ||||
46 | Wrong answer | 4ms | 6720 KiB | ||||
47 | Wrong answer | 4ms | 6728 KiB | ||||
48 | Wrong answer | 6ms | 6892 KiB | ||||
49 | Wrong answer | 4ms | 6912 KiB | ||||
subtask6 | 0/22 | ||||||
50 | Wrong answer | 64ms | 8020 KiB | ||||
51 | Wrong answer | 64ms | 8064 KiB | ||||
52 | Accepted | 64ms | 8172 KiB | ||||
53 | Accepted | 64ms | 8296 KiB | ||||
54 | Accepted | 64ms | 8592 KiB | ||||
55 | Accepted | 64ms | 8656 KiB | ||||
56 | Wrong answer | 68ms | 8736 KiB | ||||
57 | Wrong answer | 67ms | 8824 KiB | ||||
58 | Wrong answer | 10ms | 8180 KiB | ||||
59 | Wrong answer | 61ms | 8668 KiB | ||||
60 | Wrong answer | 61ms | 8732 KiB | ||||
61 | Wrong answer | 61ms | 8700 KiB | ||||
62 | Wrong answer | 61ms | 8756 KiB | ||||
63 | Wrong answer | 61ms | 8812 KiB | ||||
64 | Wrong answer | 64ms | 9268 KiB | ||||
65 | Wrong answer | 64ms | 9444 KiB | ||||
66 | Wrong answer | 64ms | 9520 KiB |