제출 #1013367

#제출 시각아이디문제언어결과실행 시간메모리
1013367daffuwuCommuter Pass (JOI18_commuter_pass)C++14
24 / 100
38 ms2652 KiB
#include <bits/stdc++.h>
using namespace std;
#define fr first
#define sc second
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

long long n, m, dst[369][369], s, t, u, v, a, b, c, ans;

int main() 
{
    long long i, j, ii;
    scanf("%lld%lld%lld%lld%lld%lld", &n, &m, &s, &t, &u, &v);
    for (i=1; i<=n; i++)
    {
        for (j=1; j<=n; j++)
        {
            if (i != j) dst[i][j] = 1e15;
        }
    }
    for (i=1; i<=m; i++)
    {
        scanf("%lld%lld%lld", &a, &b, &c);
        dst[a][b] = dst[b][a] = c;
    }
    for (ii=1; ii<=n; ii++)
    {
        for (i=1; i<=n; i++)
        {
            for (j=1; j<=n; j++) dst[i][j] = min(dst[i][j], dst[i][ii]+dst[ii][j]);
        }
    }
    ans = dst[u][v];
    for (i=1; i<=n; i++)
    {
        for (j=1; j<=n; j++)
        {
            if (min(dst[s][i]+dst[j][t], dst[s][j]+dst[i][t])+dst[i][j] == dst[s][t]) ans = min(ans, dst[u][i]+dst[j][v]);
        }
    }
    printf("%lld\n", ans);    
}

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

commuter_pass.cpp: In function 'int main()':
commuter_pass.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     scanf("%lld%lld%lld%lld%lld%lld", &n, &m, &s, &t, &u, &v);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
commuter_pass.cpp:22:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |         scanf("%lld%lld%lld", &a, &b, &c);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...