結果

問題 No.1382 Travel in Mitaru city
ユーザー 夜
提出日時 2021-02-08 17:22:42
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,002 bytes
コンパイル時間 974 ms
コンパイル使用メモリ 100,672 KB
実行使用メモリ 10,076 KB
最終ジャッジ日時 2023-09-19 07:10:47
合計ジャッジ時間 10,282 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
5,168 KB
testcase_01 AC 3 ms
5,200 KB
testcase_02 AC 3 ms
5,188 KB
testcase_03 AC 3 ms
5,172 KB
testcase_04 AC 3 ms
5,220 KB
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 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 129 ms
8,836 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 128 ms
8,740 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 87 ms
8,504 KB
testcase_37 AC 17 ms
6,084 KB
testcase_38 AC 96 ms
8,852 KB
testcase_39 AC 27 ms
6,220 KB
testcase_40 AC 74 ms
8,000 KB
testcase_41 AC 81 ms
8,344 KB
testcase_42 AC 97 ms
8,844 KB
testcase_43 AC 84 ms
8,320 KB
testcase_44 AC 35 ms
6,472 KB
testcase_45 AC 76 ms
7,996 KB
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 AC 92 ms
8,540 KB
testcase_52 AC 110 ms
8,980 KB
testcase_53 AC 25 ms
6,276 KB
testcase_54 AC 50 ms
7,080 KB
testcase_55 AC 106 ms
8,860 KB
testcase_56 AC 36 ms
6,836 KB
testcase_57 AC 71 ms
7,856 KB
testcase_58 AC 13 ms
5,680 KB
testcase_59 AC 34 ms
6,524 KB
testcase_60 AC 103 ms
8,804 KB
testcase_61 WA -
testcase_62 AC 3 ms
5,188 KB
testcase_63 WA -
testcase_64 WA -
testcase_65 WA -
testcase_66 WA -
testcase_67 WA -
testcase_68 WA -
testcase_69 WA -
testcase_70 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
vector<vector<int>> vec(100010);
bool b[100010] = { false };
int p[100010];
int main() {
	int n, m, s, t;
	cin >> n >> m >> s >> t;
	for (int i = 1; i <= n; i++) {
		cin >> p[i];
	}
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		vec[a].emplace_back(b);
		vec[b].emplace_back(a);
	}
	int ans = 0;
	queue<pair<int, int>> que;
	que.push(make_pair(s, p[s]));
	b[s] = true;
	while (!que.empty()) {
		int x = que.front().first;
		int y = que.front().second;
		que.pop();
		for (int i = 0; i < vec[x].size(); i++) {
			if (!b[vec[x][i]]) {
				if (y > p[vec[x][i]]) {
					ans++;
				}
				que.push(make_pair(vec[x][i], min(y, p[vec[x][i]])));
				b[vec[x][i]] = true;
			}
		}
	}
	cout << ans << endl;
}

0