Submission #1755508


Source Code Expand

#include<bits/stdc++.h>
#define vi vector<int>
#define vvi vector<vector<int> >
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
using ll = long long;
using ld =long double;
#define int ll
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<int,pii> piii;
#define mp make_pair
signed main(){
    int n,m; cin>>n>>m;
    vector<piii>edge;
    rep(i,m){
        int to,from,cost;
        cin>>to>>from>>cost;
        edge.push_back(mp(--to,mp(--from,cost)));
    }
    vector<int>d(n,INF);
    d[0]=0;
    rep(v,2*n){
        bool update=false;
        rep(j,edge.size()){
            int from=edge[j].first;
            int to=edge[j].second.first;
            int cost=edge[j].second.second;
            if(d[from]==INF)continue;
            if(d[to]<d[from]+cost||d[to]==INF){
                update=true;
                d[to]=d[from]+cost;
            }
        }
        if(update&&v==2*n-1)return puts("inf")*0;
    }
    cout<<d[n-1]<<endl;
}

Submission Info

Submission Time
Task D - Score Attack
User yebityon
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1415 Byte
Status WA
Exec Time 18 ms
Memory 384 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 3
AC × 25
WA × 5
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All sample_01.txt, sample_02.txt, sample_03.txt, subtask_1_1.txt, subtask_1_10.txt, subtask_1_11.txt, subtask_1_12.txt, subtask_1_13.txt, subtask_1_14.txt, subtask_1_15.txt, subtask_1_16.txt, subtask_1_17.txt, subtask_1_18.txt, subtask_1_19.txt, subtask_1_2.txt, subtask_1_20.txt, subtask_1_21.txt, subtask_1_22.txt, subtask_1_23.txt, subtask_1_24.txt, subtask_1_25.txt, subtask_1_26.txt, subtask_1_27.txt, subtask_1_3.txt, subtask_1_4.txt, subtask_1_5.txt, subtask_1_6.txt, subtask_1_7.txt, subtask_1_8.txt, subtask_1_9.txt
Case Name Status Exec Time Memory
sample_01.txt AC 1 ms 256 KB
sample_02.txt AC 1 ms 256 KB
sample_03.txt AC 1 ms 256 KB
subtask_1_1.txt AC 3 ms 256 KB
subtask_1_10.txt AC 1 ms 256 KB
subtask_1_11.txt AC 2 ms 256 KB
subtask_1_12.txt AC 11 ms 384 KB
subtask_1_13.txt AC 1 ms 256 KB
subtask_1_14.txt AC 7 ms 256 KB
subtask_1_15.txt AC 12 ms 384 KB
subtask_1_16.txt AC 1 ms 256 KB
subtask_1_17.txt AC 1 ms 256 KB
subtask_1_18.txt AC 9 ms 384 KB
subtask_1_19.txt AC 10 ms 384 KB
subtask_1_2.txt AC 7 ms 256 KB
subtask_1_20.txt AC 1 ms 256 KB
subtask_1_21.txt AC 6 ms 256 KB
subtask_1_22.txt AC 18 ms 384 KB
subtask_1_23.txt WA 1 ms 256 KB
subtask_1_24.txt AC 9 ms 384 KB
subtask_1_25.txt WA 4 ms 256 KB
subtask_1_26.txt AC 7 ms 256 KB
subtask_1_27.txt WA 7 ms 256 KB
subtask_1_3.txt WA 3 ms 256 KB
subtask_1_4.txt WA 5 ms 256 KB
subtask_1_5.txt AC 3 ms 256 KB
subtask_1_6.txt AC 7 ms 256 KB
subtask_1_7.txt AC 6 ms 256 KB
subtask_1_8.txt AC 7 ms 256 KB
subtask_1_9.txt AC 1 ms 256 KB