結果

問題 No.30 たこやき工場
ユーザー ktgktg
提出日時 2016-06-09 11:52:14
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,549 bytes
コンパイル時間 721 ms
コンパイル使用メモリ 82,012 KB
実行使用メモリ 8,576 KB
最終ジャッジ日時 2024-04-17 12:11:24
合計ジャッジ時間 7,348 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 3 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

//#include <bits/stdc++.h>
#include <assert.h>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <iterator>
using namespace std;

typedef signed long long ll;

#define pp(...) (void)printf(__VA_ARGS__)
#define For(x,to) for(x=0;x<(to);x++)
#define ForAuto(x,arr) for(auto& x:arr)
#define ForBeginEnd(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define All(a) (a.begin()),(a.end())
#define Zeros(a) memset(a,0,sizeof(a))
#define Minus(a) memset(a,0xff,sizeof(a))

#define PI 3.14159265
#define EPS (1e-10)
#define EPS_eq(a,b) (abs((a)-(b)) < EPS)

#pragma GCC diagnostic ignored "-Wconversion"

//#define int long long
#define INF 1000*1000

int dxy[] = {0, 1, 0, -1, 0};

typedef pair<int, int> P;

void pp_int(int x){ printf("%d\n", x); };

int i,j,k;

ll M = 100000009;

//ios::sync_with_stdio(false);

//-------------------------------------------------

vector<int> g[200];
vector<int> qs[200];
int res[200];

void rec(int p, int sum){
    if(g[p].size() == 0){
        res[p] += sum;
        return;
    }
    for(int i=0;i<g[p].size();i++){
        rec(g[p][i], sum * qs[p][i]);
    }
    return;
}

signed main() {
    int n,m;
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int p,q,r;
        cin>>p>>q>>r;
        g[r].push_back(p);
        qs[r].push_back(q);
    }
    rec(n, 1);
    for(int i=1;i<n;i++)
        cout<<res[i]<<endl;
    return 0;
}
0