結果

問題 No.1983 [Cherry 4th Tune C] 南の島のマーメイド
ユーザー たたき@競プロたたき@競プロ
提出日時 2023-08-10 01:11:01
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 967 bytes
コンパイル時間 5,453 ms
コンパイル使用メモリ 313,580 KB
実行使用メモリ 17,440 KB
最終ジャッジ日時 2024-04-27 19:04:19
合計ジャッジ時間 22,645 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 14 ms
5,376 KB
testcase_09 AC 20 ms
5,376 KB
testcase_10 AC 19 ms
5,376 KB
testcase_11 AC 25 ms
5,376 KB
testcase_12 AC 15 ms
5,376 KB
testcase_13 AC 383 ms
9,600 KB
testcase_14 AC 427 ms
10,224 KB
testcase_15 AC 448 ms
13,184 KB
testcase_16 AC 261 ms
10,080 KB
testcase_17 AC 428 ms
10,368 KB
testcase_18 AC 343 ms
13,236 KB
testcase_19 AC 388 ms
14,800 KB
testcase_20 AC 383 ms
12,544 KB
testcase_21 WA -
testcase_22 AC 423 ms
12,160 KB
testcase_23 AC 603 ms
15,488 KB
testcase_24 AC 621 ms
15,304 KB
testcase_25 AC 609 ms
15,360 KB
testcase_26 AC 605 ms
15,440 KB
testcase_27 AC 616 ms
15,360 KB
testcase_28 AC 602 ms
15,360 KB
testcase_29 WA -
testcase_30 AC 605 ms
15,448 KB
testcase_31 AC 606 ms
15,240 KB
testcase_32 AC 609 ms
15,264 KB
testcase_33 AC 2 ms
5,376 KB
testcase_34 AC 399 ms
9,600 KB
testcase_35 AC 538 ms
15,872 KB
testcase_36 AC 528 ms
15,844 KB
testcase_37 AC 2 ms
5,376 KB
testcase_38 WA -
testcase_39 AC 549 ms
15,744 KB
testcase_40 AC 556 ms
17,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using mint=modint998244353; //1000000007;
using ll=long long;
using pp=pair<int,int>;
#define sr string 
#define vc vector
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define pque priority_queue
#define bpc(a) __builtin_popcount(a)
int main(){
  int n,m,qq;cin>>n>>m>>qq;
  vc v(n,vc<int>(0));
  rep(i,m){
    int a,b;cin>>a>>b; a--;b--;
    v[a].pb(b); v[b].pb(a);
  }
  vc<int>d(n); rep(i,n)d[i]=v[i].size();
  queue<int>q; rep(i,n)if(d[i]==1)q.push(i);
  dsu ds(n); vc<bool>bo(n,true);
  while(q.size()){
    int a=q.front(); q.pop();
    bo[a]=false;
    for(auto au:v[a])if(bo[au]){
      d[au]--; 
      ds.merge(a,au);
      if(d[au]==1)q.push(au);
    }
  }
  rep(z,qq){
    int a,b;cin>>a>>b; a--;b--;
    if(ds.same(a,b))cout<<"Yes";
    else cout<<"No";
    cout<<"\n";
  }
}
0