提出 #75451464


ソースコード 拡げる

#include<bits/stdc++.h>
using namespace std;
int t,n,m,w,ans,vis[100005][15];
string s[100005];
vector<int> e[100005];
int main(){
	cin>>t;
	while(t--){
		queue<pair<int,int>> q;
		cin>>n>>m,ans=0;
		for(int i=1;i<=n;i++) e[i].clear(),e[i].push_back(i);
		for(int i=1,u,v;i<=m;i++) cin>>u>>v,e[u].push_back(v),e[v].push_back(u);
		cin>>w;
		for(int i=1;i<=n;i++){
			cin>>s[i];
		}
		for(int i=1;i<=n;i++){
			if(s[i][0]=='x') continue;
			memset(vis,0,sizeof(vis));
			q.push({i,1});
			while(!q.empty()){
				int u=q.front().first,d=q.front().second;
				q.pop();
				if(vis[u][d]){ans=1;break;}
				vis[u][d]=1;
				for(int i=0;i<e[u].size();i++){
					int v=e[u][i];
					if(d==w&&s[v][0]=='o') q.push({v,1});
					else if(s[v][d]=='o') q.push({v,d+1});
				}
			}
			if(ans){cout<<"Yes\n";break;}
		}
		if(!ans) cout<<"No\n";
	}
}

提出情報

提出日時
問題 E - Endless Holidays
ユーザ Rya_
言語 C++23 (GCC 15.2.0)
得点 0
コード長 870 Byte
結果 WA
実行時間 > 3000 ms
メモリ 18240 KiB

コンパイルエラー

./Main.cpp: In function 'int main()':
./Main.cpp:26:46: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |                                 for(int i=0;i<e[u].size();i++){
      |                                             ~^~~~~~~~~~~~

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 0 / 450
結果
AC × 1
AC × 6
WA × 11
TLE × 4
セット名 テストケース
Sample 00_sample_01.txt
All 00_sample_01.txt, 01_small_random_01.txt, 01_small_random_02.txt, 01_small_random_03.txt, 01_small_random_04.txt, 02_medium_random_01.txt, 02_medium_random_02.txt, 02_medium_random_03.txt, 02_medium_random_04.txt, 03_large_sparse_01.txt, 03_large_sparse_02.txt, 03_large_sparse_03.txt, 03_large_sparse_04.txt, 04_long_01.txt, 04_long_02.txt, 04_long_03.txt, 04_long_04.txt, 05_hand_01.txt, 05_hand_02.txt, 05_hand_03.txt, 05_hand_04.txt
ケース名 結果 実行時間 メモリ
00_sample_01.txt AC 5 ms 12416 KiB
01_small_random_01.txt WA 437 ms 12496 KiB
01_small_random_02.txt WA 788 ms 12616 KiB
01_small_random_03.txt WA 1462 ms 12628 KiB
01_small_random_04.txt WA 1844 ms 12480 KiB
02_medium_random_01.txt WA 52 ms 13256 KiB
02_medium_random_02.txt WA 132 ms 13184 KiB
02_medium_random_03.txt WA 198 ms 13308 KiB
02_medium_random_04.txt WA 266 ms 13428 KiB
03_large_sparse_01.txt WA 44 ms 13824 KiB
03_large_sparse_02.txt WA 46 ms 13824 KiB
03_large_sparse_03.txt AC 48 ms 13648 KiB
03_large_sparse_04.txt WA 54 ms 14008 KiB
04_long_01.txt TLE > 3000 ms 13608 KiB
04_long_02.txt AC 53 ms 13804 KiB
04_long_03.txt TLE > 3000 ms 13524 KiB
04_long_04.txt AC 51 ms 13824 KiB
05_hand_01.txt TLE > 3000 ms 17664 KiB
05_hand_02.txt AC 81 ms 17948 KiB
05_hand_03.txt AC 60 ms 18240 KiB
05_hand_04.txt TLE > 3000 ms 12300 KiB