結果
問題 | No.92 逃走経路 |
ユーザー |
![]() |
提出日時 | 2021-03-10 13:53:07 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,090 bytes |
コンパイル時間 | 1,974 ms |
コンパイル使用メモリ | 177,964 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-12 04:26:10 |
合計ジャッジ時間 | 3,030 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 19 ms
5,248 KB |
testcase_01 | WA | - |
testcase_02 | AC | 2 ms
5,248 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 3 ms
5,248 KB |
testcase_14 | AC | 5 ms
5,248 KB |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | AC | 16 ms
5,248 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; template<typename type1,typename type2> type2 vector_reduce(vector<type1>& v,function<type2(type2,type1)> fn,type2 initial){ int N=v.size(); type2 ans=initial; for(int i=0;i<N;i++){ ans=fn(ans,v[i]); } return ans; } int main(){ int N,M,K; cin>>N>>M>>K; vector<vector<int>> road(0,vector<int>(3)); vector<bool> possible(N+1,true); vector<bool> next(N+1); vector<bool> mask(N+1); possible[0]=false; int a,b,c,d; for(int i=0;i<M;i++){ cin>>a>>b>>c; road.push_back({a,b,c}); road.push_back({b,a,c}); } for(int i=0;i<K;i++){ cin>>d; next=mask; for(int j=0;j<2*M;j++){ if(possible[road[j][0]] && d==road[j][2]){ next[road[j][1]]=true; } } possible=next; } function<int(int,bool)> fn=[](int p,bool a){return p+(a?1:0);}; cout<<vector_reduce(possible,fn,0)<<endl; for(int i=0;i<N;i++){ if(possible[i]){ cout<<i<<" "; } } }