結果
| 問題 |
No.92 逃走経路
|
| コンテスト | |
| ユーザー |
latte0119
|
| 提出日時 | 2016-01-13 18:52:18 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 879 bytes |
| コンパイル時間 | 1,345 ms |
| コンパイル使用メモリ | 161,532 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-19 18:56:48 |
| 合計ジャッジ時間 | 1,856 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 |
| other | WA * 18 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
int N,M,K;
int A[1000],B[1000],C[1000];
signed main(){
cin>>N>>M>>K;
rep(i,M)cin>>A[i]>>B[i]>>C[i],A[i]--,B[i]--;
bool prev[100],next[100];
fill_n(prev,N,true);
while(K--){
int d;cin>>d;
rep(i,M)if(C[i]==d&&prev[A[i]])next[B[i]]=true;
rep(i,M)if(C[i]==d&&prev[B[i]])next[A[i]]=true;
rep(i,N)prev[i]=next[i];
fill_n(next,N,false);
}
vint ans;
rep(i,N)if(prev[i])ans.pb(i);
cout<<ans.size()<<endl;
rep(i,ans.size()){
if(i)cout<<" ";
cout<<ans[i]+1<<endl;
}cout<<endl;
return 0;
}
latte0119