結果

問題 No.1382 Travel in Mitaru city
ユーザー eQeeQe
提出日時 2021-03-07 17:53:11
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,042 bytes
コンパイル時間 3,907 ms
コンパイル使用メモリ 228,800 KB
実行使用メモリ 7,808 KB
最終ジャッジ日時 2024-04-17 08:27:01
合計ジャッジ時間 11,817 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 WA -
testcase_07 AC 39 ms
5,376 KB
testcase_08 WA -
testcase_09 AC 55 ms
5,376 KB
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 WA -
testcase_27 AC 104 ms
5,376 KB
testcase_28 AC 104 ms
5,376 KB
testcase_29 AC 104 ms
5,376 KB
testcase_30 AC 103 ms
5,376 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 84 ms
5,376 KB
testcase_37 AC 14 ms
5,376 KB
testcase_38 AC 93 ms
5,376 KB
testcase_39 AC 25 ms
5,376 KB
testcase_40 AC 69 ms
5,376 KB
testcase_41 AC 78 ms
5,376 KB
testcase_42 AC 95 ms
5,376 KB
testcase_43 AC 82 ms
5,376 KB
testcase_44 AC 34 ms
5,376 KB
testcase_45 AC 76 ms
5,376 KB
testcase_46 WA -
testcase_47 WA -
testcase_48 AC 66 ms
5,376 KB
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
testcase_61 AC 4 ms
5,376 KB
testcase_62 AC 2 ms
5,376 KB
testcase_63 AC 15 ms
5,376 KB
testcase_64 AC 5 ms
5,376 KB
testcase_65 AC 2 ms
5,376 KB
testcase_66 AC 3 ms
5,376 KB
testcase_67 AC 4 ms
5,376 KB
testcase_68 AC 6 ms
5,376 KB
testcase_69 AC 3 ms
5,376 KB
testcase_70 AC 8 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define pt(sth) cout << sth << "\n"
#define itr(x,c) for(auto x=c.begin();x!=c.end();x++)
#define all(a) (a.begin()),(a.end())
using namespace std;
#include <atcoder/all>
using namespace atcoder;
typedef long long ll;
typedef pair<ll, ll> pll;
template<class T>bool chmax(T &a, const T &b) {if(a<b) {a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) {if(b<a) {a=b; return 1;} return 0;}
static const ll INF=1e18;
static const ll MAX=101010;
//static const ll MOD=1e9+7;
//static const ll MOD=998244353;
//for(i=0;i<N;i++) cin>>a[i];

typedef vector<ll> v1D;
typedef vector<v1D> v2D;
typedef vector<v2D> v3D;



int main(void) {
  ll i,j,k;
  
  ll N,M,S,T;cin>>N>>M>>S>>T;S--;T--;
  
  dsu d(N);
  vector<ll> a(N);
  for(i=0;i<N;i++)cin>>a[i];
  
  for(i=0;i<M;i++){
    ll x,y;cin>>x>>y;x--;y--;
    d.merge(x, y);
  }
  
  set<ll> st;
  for(i=0;i<N;i++)
    if(d.leader(i)==d.leader(S) and a[i]<a[S])
      st.insert(a[i]);
  st.insert(a[S]);
  
  pt((ll)st.size()-1);
  
  
  
  
  
  
  
}
0