답안 #284289

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
284289 2020-08-27T07:28:29 Z 최은수(#5747) Aesthetic (NOI20_aesthetic) C++17
13 / 100
2000 ms 36088 KB
#include<iostream>
#include<vector>
#include<queue>
#include<algorithm>
#define ep emplace
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const int inf=1e9+7;
const ll INF=1e18;
ll dis[300010];
vector<pl>adj[300010];
inline ll dijk(int n)
{
    fill(dis,dis+n+1,INF);
    priority_queue<pl,vector<pl>,greater<pl> >pq;
    pq.ep(dis[1]=0,1);
    while(!pq.empty())
    {
        int x=pq.top().se;
        ll w=pq.top().fi;
        pq.pop();
        if(dis[x]!=w)
            continue;
        for(pl&t:adj[x])
            if(dis[t.fi]>w+t.se)
                pq.ep(dis[t.fi]=w+t.se,t.fi);
    }
    return dis[n];
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,m;
    cin>>n>>m;
    vector<pair<pi,ll> >edge(m);
    for(auto&t:edge)
        cin>>t.fi.fi>>t.fi.se>>t.se;
    ll mx=0;
    ll ans=0;
    for(int i=m;i-->0;)
    {
        for(int j=0;j++<n;)
            adj[j].clear();
        for(int j=0;j<m;j++)
        {
            if(j==i)
                continue;
            auto&t=edge[j];
            adj[t.fi.fi].eb(t.fi.se,t.se);
            adj[t.fi.se].eb(t.fi.fi,t.se);
        }
        auto&t=edge[i];
        adj[t.fi.fi].eb(t.fi.se,t.se+mx);
        adj[t.fi.se].eb(t.fi.fi,t.se+mx);
        ans=max(ans,dijk(n));
        mx=max(mx,edge[i].se);
    }
    cout<<ans<<endl;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 7424 KB Output is correct
2 Correct 6 ms 7424 KB Output is correct
3 Correct 6 ms 7552 KB Output is correct
4 Correct 6 ms 7424 KB Output is correct
5 Correct 7 ms 7424 KB Output is correct
6 Correct 7 ms 7424 KB Output is correct
7 Correct 6 ms 7424 KB Output is correct
8 Correct 6 ms 7444 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 7424 KB Output is correct
2 Correct 6 ms 7424 KB Output is correct
3 Correct 6 ms 7552 KB Output is correct
4 Correct 6 ms 7424 KB Output is correct
5 Correct 7 ms 7424 KB Output is correct
6 Correct 7 ms 7424 KB Output is correct
7 Correct 6 ms 7424 KB Output is correct
8 Correct 6 ms 7444 KB Output is correct
9 Correct 414 ms 7552 KB Output is correct
10 Correct 415 ms 7672 KB Output is correct
11 Correct 298 ms 7552 KB Output is correct
12 Correct 317 ms 7612 KB Output is correct
13 Correct 214 ms 7676 KB Output is correct
14 Correct 218 ms 7672 KB Output is correct
15 Correct 222 ms 7640 KB Output is correct
16 Correct 214 ms 7632 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2090 ms 35448 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2098 ms 36088 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2098 ms 35720 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2098 ms 35720 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 7424 KB Output is correct
2 Correct 6 ms 7424 KB Output is correct
3 Correct 6 ms 7552 KB Output is correct
4 Correct 6 ms 7424 KB Output is correct
5 Correct 7 ms 7424 KB Output is correct
6 Correct 7 ms 7424 KB Output is correct
7 Correct 6 ms 7424 KB Output is correct
8 Correct 6 ms 7444 KB Output is correct
9 Correct 414 ms 7552 KB Output is correct
10 Correct 415 ms 7672 KB Output is correct
11 Correct 298 ms 7552 KB Output is correct
12 Correct 317 ms 7612 KB Output is correct
13 Correct 214 ms 7676 KB Output is correct
14 Correct 218 ms 7672 KB Output is correct
15 Correct 222 ms 7640 KB Output is correct
16 Correct 214 ms 7632 KB Output is correct
17 Execution timed out 2090 ms 35448 KB Time limit exceeded
18 Halted 0 ms 0 KB -