Submission #55525196
Source Code Expand
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <bits/stdc++.h>
using namespace std;
using ui = unsigned;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define rep(i,l,r) for(int i=(l);i<=(r);++i)
#define per(i,l,r) for(int i=(l);i>=(r);--i)
#define repn(i,n) for(int i=0;i<(n);++i)
#define sizc(x) ((int)(x).size())
#define allc(x) (x).begin(),(x).end()
#define fir first
#define sec second
constexpr int N = 2e5+5;
int n,m;
ll a[N];
vector<pair<int,ll>> G[N];
ll dis[N];
bool vis[N];
signed main(){
#ifndef ONLINE_JUDGE
freopen("sample.in","r",stdin);
freopen("sample.out","w",stdout);
#endif
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin>>n>>m;
rep(i,1,n)cin>>a[i];
rep(i,1,m){
int u,v;ll w;
cin>>u>>v>>w;
G[u].emplace_back(v,w+a[v]);
G[v].emplace_back(u,w+a[u]);
}
rep(i,1,n)dis[i]=1e18;
priority_queue<pair<ll,int>,vector<pair<ll,int>>,greater<pair<ll,int>>> q;
q.emplace(dis[1]=a[1],1);
while(!q.empty()){
int u=q.top().sec;q.pop();
if(vis[u])continue;vis[u]=1;
for(auto p:G[u]){
int v=p.fir;ll w=p.sec;
if(dis[v]>dis[u]+w)q.emplace(dis[v]=dis[u]+w,v);
}
}
rep(i,2,n)cout<<dis[i]<<' ';cout<<'\n';
}
Submission Info
Submission Time
2024-07-13 12:11:37
Task
D - Shortest Path 3
User
KnownError_
Language
C++ 20 (gcc 12.2)
Score
425
Code Size
1192 Byte
Status
AC
Exec Time
189 ms
Memory
26444 KB
Compile Error
Main.cpp: In function ‘int main()’:
Main.cpp:43:17: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
43 | if(vis[u])continue;vis[u]=1;
| ^~
Main.cpp:43:36: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
43 | if(vis[u])continue;vis[u]=1;
| ^~~
Main.cpp:8:20: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
8 | #define rep(i,l,r) for(int i=(l);i<=(r);++i)
| ^~~
Main.cpp:49:9: note: in expansion of macro ‘rep’
49 | rep(i,2,n)cout<<dis[i]<<' ';cout<<'\n';
| ^~~
Main.cpp:49:37: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
49 | rep(i,2,n)cout<<dis[i]<<' ';cout<<'\n';
| ^~~~
Judge Result
Set Name
Sample
All
Score / Max Score
0 / 0
425 / 425
Status
Set Name
Test Cases
Sample
00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All
00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_random-small_01.txt, 01_random-small_02.txt, 01_random-small_03.txt, 01_random-small_04.txt, 01_random-small_05.txt, 01_random-small_06.txt, 01_random-small_07.txt, 01_random-small_08.txt, 01_random-small_09.txt, 01_random-small_10.txt, 01_random-small_11.txt, 01_random-small_12.txt, 01_random-small_13.txt, 01_random-small_14.txt, 01_random-small_15.txt, 02_random-large_01.txt, 02_random-large_02.txt, 02_random-large_03.txt, 02_random-large_04.txt, 02_random-large_05.txt, 02_random-large_06.txt, 02_random-large_07.txt, 02_random-large_08.txt, 02_random-large_09.txt, 02_random-large_10.txt, 02_random-large_11.txt, 02_random-large_12.txt, 02_random-large_13.txt, 02_random-large_14.txt, 02_random-large_15.txt, 03_handmade_01.txt, 03_handmade_02.txt, 03_handmade_03.txt, 03_handmade_04.txt, 03_handmade_05.txt, 03_handmade_06.txt, 03_handmade_07.txt, 03_handmade_08.txt
Case Name
Status
Exec Time
Memory
00_sample_01.txt
AC
2 ms
3472 KB
00_sample_02.txt
AC
2 ms
3620 KB
00_sample_03.txt
AC
2 ms
3436 KB
01_random-small_01.txt
AC
2 ms
3656 KB
01_random-small_02.txt
AC
2 ms
3588 KB
01_random-small_03.txt
AC
2 ms
3556 KB
01_random-small_04.txt
AC
2 ms
3596 KB
01_random-small_05.txt
AC
32 ms
13104 KB
01_random-small_06.txt
AC
8 ms
5476 KB
01_random-small_07.txt
AC
6 ms
4480 KB
01_random-small_08.txt
AC
26 ms
10892 KB
01_random-small_09.txt
AC
2 ms
3544 KB
01_random-small_10.txt
AC
13 ms
6232 KB
01_random-small_11.txt
AC
4 ms
4136 KB
01_random-small_12.txt
AC
8 ms
5540 KB
01_random-small_13.txt
AC
34 ms
12152 KB
01_random-small_14.txt
AC
2 ms
3680 KB
01_random-small_15.txt
AC
11 ms
5924 KB
02_random-large_01.txt
AC
91 ms
13672 KB
02_random-large_02.txt
AC
177 ms
21944 KB
02_random-large_03.txt
AC
6 ms
4496 KB
02_random-large_04.txt
AC
186 ms
22000 KB
02_random-large_05.txt
AC
114 ms
16344 KB
02_random-large_06.txt
AC
189 ms
22028 KB
02_random-large_07.txt
AC
136 ms
18032 KB
02_random-large_08.txt
AC
180 ms
22088 KB
02_random-large_09.txt
AC
77 ms
13044 KB
02_random-large_10.txt
AC
177 ms
21804 KB
02_random-large_11.txt
AC
166 ms
21132 KB
02_random-large_12.txt
AC
177 ms
22032 KB
02_random-large_13.txt
AC
147 ms
19544 KB
02_random-large_14.txt
AC
182 ms
21940 KB
02_random-large_15.txt
AC
75 ms
14668 KB
03_handmade_01.txt
AC
178 ms
22000 KB
03_handmade_02.txt
AC
151 ms
21896 KB
03_handmade_03.txt
AC
144 ms
26444 KB
03_handmade_04.txt
AC
40 ms
13928 KB
03_handmade_05.txt
AC
117 ms
18380 KB
03_handmade_06.txt
AC
117 ms
17968 KB
03_handmade_07.txt
AC
2 ms
3504 KB
03_handmade_08.txt
AC
2 ms
3632 KB