結果
| 問題 |
No.92 逃走経路
|
| コンテスト | |
| ユーザー |
goodbaton
|
| 提出日時 | 2015-08-11 01:19:26 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,145 bytes |
| コンパイル時間 | 459 ms |
| コンパイル使用メモリ | 72,824 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-18 06:36:51 |
| 合計ジャッジ時間 | 1,073 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 1 |
| other | AC * 11 WA * 7 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:28:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
28 | scanf("%d%d%d",&n,&m,&k);
| ~~~~~^~~~~~~~~~~~~~~~~~~
main.cpp:31:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
31 | scanf("%d%d%d",&a[i],&b[i],&c[i]);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:39:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
39 | scanf("%d",&d);
| ~~~~~^~~~~~~~~
ソースコード
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cstring>
typedef long long ll;
using namespace std;
#define mod 1000000007
#define INF 1000000000
#define LLINF 2000000000000000000LL
#define PI 3.1415926536
#define SIZE 1000
int main(){
int n,m,k,a[SIZE],b[SIZE],c[SIZE],d,ans=0;
bool dp[1010][101]={0};
scanf("%d%d%d",&n,&m,&k);
for(int i=0;i<m;i++){
scanf("%d%d%d",&a[i],&b[i],&c[i]);
}
for(int i=1;i<=n;i++){
dp[0][i]=true;
}
for(int i=0;i<k;i++){
scanf("%d",&d);
for(int j=0;j<m;j++){
if(c[j]==d){
dp[i+1][b[j]]|=true;
dp[i+1][a[j]]|=true;
}
}
}
for(int i=1;i<=n;i++)
if(dp[k][i]) ans++;
printf("%d\n",ans);
for(int i=1;i<=n;i++){
if(dp[k][i]){
printf(i<n?"%d ":"%d\n",i);
}
}
return 0;
}
goodbaton