結果

問題 No.92 逃走経路
ユーザー kotatsugamekotatsugame
提出日時 2017-10-04 22:55:18
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 653 bytes
コンパイル時間 720 ms
コンパイル使用メモリ 73,472 KB
実行使用メモリ 816,336 KB
最終ジャッジ日時 2024-04-28 06:06:16
合計ジャッジ時間 12,932 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    7 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<vector>
using namespace std;
vector<pair<int,int> >G[150];
vector<int>ans[1010];
int n,m,k;
main()
{
	cin>>n>>m>>k;
	for(int i=0;i<m;i++)
	{
		int a,b,c;cin>>a>>b>>c;
		G[a].push_back(make_pair(b,c));
		G[b].push_back(make_pair(a,c));
	}
	for(int i=0;i++<n;)ans[0].push_back(i);
	for(int i=0;i<k;i++)
	{
		int C;cin>>C;
		for(int j=0;j<ans[i].size();j++)
		{
			for(int k=0;k<G[ans[i][j]].size();k++)
			{
				if(G[ans[i][j]][k].second==C)
				{
					ans[i+1].push_back(G[ans[i][j]][k].first);
				}
			}
		}
	}
	cout<<ans[k].size()<<endl;
	for(int i=0;i<ans[k].size();i++)
	{
		cout<<(i?" ":"")<<ans[k][i];
	}
	cout<<endl;
}
0