結果
| 問題 | No.92 逃走経路 |
| コンテスト | |
| ユーザー |
777yuuki12323
|
| 提出日時 | 2017-07-05 15:35:49 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 12 ms / 5,000 ms |
| コード長 | 1,818 bytes |
| 記録 | |
| コンパイル時間 | 503 ms |
| コンパイル使用メモリ | 102,024 KB |
| 実行使用メモリ | 17,808 KB |
| 最終ジャッジ日時 | 2026-04-21 05:51:57 |
| 合計ジャッジ時間 | 1,512 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/string:53,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/locale_classes.h:42,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/ios_base.h:43,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/ios:46,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/ostream.h:43,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/ostream:42,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/iostream:43,
from main.cpp:1:
In function 'void std::__fill_a1(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = bool*; _Tp = int]',
inlined from 'void std::__fill_a(_FIte, _FIte, const _Tp&) [with _FIte = bool*; _Tp = int]' at /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_algobase.h:979:21,
inlined from 'void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = bool*; _Tp = int]' at /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_algobase.h:1011:20,
inlined from 'int main()' at main.cpp:97:6:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_algobase.h:925:18: warning: 'void* __builtin_memset(void*, int, long unsigned int)' specified size between 18446743833191383040 and 18446744073709551504 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
925 | *__first = __val;
| ~~~~~~~~~^~~~~~~
main.cpp: In function 'int main()':
main.cpp:38:6: note: destination object allocated here
38 | bool dp[1123][112];
| ^~
ソースコード
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <bitset>
#include <vector>
#include <queue>
typedef long long ll;
#define fi first
#define se second
const ll mod = 1000000007;
// 123456789
using namespace std;
///////////////////////////////////////////////
//
//
///////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////
int N;
int M;
int K;
int cost;
int c[1123];
int s[1123];
int d[1123];
int a[1123];
int b[1123];
bool P[1123][112][112];
bool dp[1123][112];
int ans = 0;
int idx;
int OUT[112];
int main(){
int i;
int j;
int flag = 0;
cin>>N>>M>>K;
for( i = 0; i < M; i++ ){
scanf("%d %d %d", a+i, b+i, c+i);
s[i] = c[i];
}
for( i = 0; i < K; i++ ){
scanf("%d", d+i );
}
sort( s, s+M );
int cnt = 0;
for( i = 1; i < M; i++ ){
if( s[i] == s[i-1] ){
s[i-1] = mod;
cnt++;
}
}
sort( s, s+M );
for( i = 0; i < M; i++ ){
for( j = 0; j < M-cnt; j++ ){
if( c[i] == s[j] ){
c[i] = j+1;
}
}
}
for( i = 0; i < K; i++ ){
for( j = 0; j < M-cnt; j++ ){
if( d[i] == s[j] ){
d[i] = j+1;
}
}
}
fill( P[0][0], P[1123][0], 0 );
for( i = 0; i < M; i++ ){
P[c[i]][b[i]][a[i]] = 1;
P[c[i]][a[i]][b[i]] = 1;
}
fill( dp[0], dp[1], 1 );
fill( dp[1], dp[K+1], 0 );
int o;
for( i = 0; i < K; i++ ){
for( j = 1; j <= N; j++ ){
if( dp[i][j] ){
for( o = 1; o <= N; o++ ){
if( P[d[i]][j][o]){
dp[i+1][o] = 1;
}
}
}
}
}
for( i = 1; i <= N; i++ ){
OUT[ans] = i;
if( dp[K][i] ) ans++;
}
cout<<ans<<endl;
for( i = 0; i < ans; i++ ){
if( i ) printf(" ");
printf("%d", OUT[i] );
}
puts("");
return 0;
}
777yuuki12323