Skip to content

Commit f7352a9

Browse files
authored
Merge pull request #1039 from AlgorithmWithGod/khj20006
[20251004] BOJ / G4 / 끝나지 않는 파티 / 권혁준
2 parents 6c96c5b + e07a4d6 commit f7352a9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
```cpp
2+
#include <bits/stdc++.h>
3+
using namespace std;
4+
5+
int N, M, c[501][501]{};
6+
7+
int main(){
8+
cin.tie(0)->sync_with_stdio(0);
9+
10+
cin>>N>>M;
11+
for(int i=1;i<=N;i++) for(int j=1;j<=N;j++) cin>>c[i][j];
12+
for(int i=1;i<=N;i++) for(int j=1;j<=N;j++) for(int k=1;k<=N;k++) c[j][k] = min(c[j][k], c[j][i] + c[i][k]);
13+
for(int a,b,C;M--;cout<<(c[a][b]<=C ? "Enjoy other party\n" : "Stay here\n")) cin>>a>>b>>C;
14+
15+
}
16+
```

0 commit comments

Comments
 (0)