結果
| 問題 | No.623 fudan no modulus to tigau | 
| コンテスト | |
| ユーザー |  WA_TLE | 
| 提出日時 | 2017-12-23 00:11:38 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,107 bytes | 
| コンパイル時間 | 1,102 ms | 
| コンパイル使用メモリ | 112,824 KB | 
| 最終ジャッジ日時 | 2025-01-05 06:13:59 | 
| ジャッジサーバーID (参考情報) | judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | WA * 2 | 
| other | AC * 1 WA * 11 | 
ソースコード
#include<string>
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<map>
#include<functional>
using namespace std;
typedef long long int llint;
typedef bool izryt;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
const int big=1e9;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
const int mod=998244353;
//なにがNTTだ!
int main(void){
	int n;cin>>n;
	vector<tuple<int,int,int>>que(n-1);
	for(auto &it:que){cin>>get<0>(it)>>get<1>(it)>>get<2>(it);}
	int q;cin>>q;
	vector<llint>ans(n+1);
	while(q--){
		llint x;cin>>x;ans[0]=1;ans[1]=x;
		for(int i=0;i<n-1;i++){
			int t,a,b;tie(t,a,b)=que[i];
			if(t==0){ans[i+2]=ans[a]+ans[b];}
			if(t==1){ans[i+2]=a*ans[b];}
			if(t==2){ans[i+2]=ans[a]+ans[b];}
			ans[i+2]%=mod;
		}
		cout<<ans[n]<<endl;
	}
	return 0;
}
            
            
            
        