제출 #897168

#제출 시각아이디문제언어결과실행 시간메모리
897168duckindogCommuter Pass (JOI18_commuter_pass)C++14
24 / 100
32 ms1884 KiB
// from duckindog wth depression #include<bits/stdc++.h> using namespace std; #define int long long using pii = pair<int, int>; using T = tuple<int, int, int>; const int N = 300 + 10; int n, m; int s, t, u, v; int f[N][N]; int32_t main() { cin.tie(0)->sync_with_stdio(0); if (fopen("duck.inp", "r")) { freopen("duck.inp", "r", stdin); freopen("duck.out", "w", stdout); } cin >> n >> m; cin >> s >> t >> u >> v; for (int i = 1; i <= n; ++i) for (int j = 1; j <= n; ++j) f[i][j] = 1e14; for (int i = 1; i <= n; ++i) f[i][i] = 0; for (int i = 1; i <= m; ++i) { int a, b, c; cin >> a >> b >> c; f[a][b] = min(f[a][b], c); f[b][a] = min(f[b][a], c); } for (int t = 1; t <= n; ++t) for (int i = 1; i <= n; ++i) for (int j = 1; j <= n; ++j) f[i][j] = min(f[i][j], f[i][t] + f[t][j]); int answer = f[u][v]; for (int x = 1; x <= n; ++x) for (int y = 1; y <= n; ++y) { if (f[s][x] + f[x][y] + f[y][t] != f[s][t]) continue; answer = min({answer, f[u][x] + f[y][v], f[u][y] + f[x][v]}); } cout << answer << '\n'; }

컴파일 시 표준 에러 (stderr) 메시지

commuter_pass.cpp: In function 'int32_t main()':
commuter_pass.cpp:19:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |     freopen("duck.inp", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
commuter_pass.cpp:20:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |     freopen("duck.out", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...