提出 #39431624


ソースコード 拡げる

#include <bits/stdc++.h>
using namespace std;
#define ll long long
/*--------------CHARAN YADAV------------------------*/
void dfs(vector<ll>&vis,vector<vector<ll>>&v,ll i,set<ll>&st,set<pair<ll,ll>>&st2)
{
    vis[i]=1;
    st.insert(i);
    for(ll j=0;j<v[i].size();j++)
    {
        if(vis[v[i][j]]==0)
        {
            dfs(vis,v,v[i][j],st,st2);
            st2.insert({i,v[i][j]});
            st2.insert({v[i][j],i});
        }
    }
    
}
int main() {
      ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
   ll n,m;
   cin>>n>>m;
   vector<vector<ll>>v(n+1);
   for(ll i=0;i<m;i++)
   {
       ll a,b;
       cin>>a>>b;
       v[a].push_back(b);
       v[b].push_back(a);
   }
   vector<ll>vis(n+1,0);
   map<ll,ll>mp,mp2;
   ll c=0;
   for(ll i=1;i<=n;i++)
   {
      if(vis[i]==0)
      {
        //   c++;
          set<ll>st;
          set<pair<ll,ll>>st2;
          dfs(vis,v,i,st,st2);
           mp[st.size()]++;
           mp2[st2.size()]++;
      }
   }
//   cout<<mp.size()<<" ";
   if(mp.size()==1&&mp2.size()==1)
   cout<<"Yes"<<"\n";
   else
   cout<<"No"<<"\n";
   
    return 0;
}

提出情報

提出日時
問題 D - Unicyclic Components
ユーザ Charan06
言語 C++ (GCC 9.2.1)
得点 0
コード長 1190 Byte
結果 WA
実行時間 428 ms
メモリ 71912 KiB

コンパイルエラー

./Main.cpp: In function ‘void dfs(std::vector<long long int>&, std::vector<std::vector<long long int> >&, long long int, std::set<long long int>&, std::set<std::pair<long long int, long long int> >&)’:
./Main.cpp:9:17: warning: comparison of integer expressions of different signedness: ‘long long int’ and ‘std::vector<long long int>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
    9 |     for(ll j=0;j<v[i].size();j++)
      |                ~^~~~~~~~~~~~
./Main.cpp: In function ‘int main()’:
./Main.cpp:36:7: warning: unused variable ‘c’ [-Wunused-variable]
   36 |    ll c=0;
      |       ^

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 0 / 400
結果
AC × 2
WA × 1
AC × 46
WA × 15
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_rnd_00.txt, 01_rnd_01.txt, 01_rnd_02.txt, 01_rnd_03.txt, 01_rnd_04.txt, 01_rnd_05.txt, 01_rnd_06.txt, 01_rnd_07.txt, 01_rnd_08.txt, 02_one_00.txt, 02_one_01.txt, 02_one_02.txt, 02_one_03.txt, 02_one_04.txt, 02_one_05.txt, 02_one_06.txt, 02_one_07.txt, 02_one_08.txt, 02_one_09.txt, 02_one_10.txt, 02_one_11.txt, 02_one_12.txt, 02_one_13.txt, 03_two_00.txt, 03_two_01.txt, 03_two_02.txt, 03_two_03.txt, 03_two_04.txt, 03_two_05.txt, 03_two_06.txt, 03_two_07.txt, 03_two_08.txt, 03_two_09.txt, 03_two_10.txt, 03_two_11.txt, 04_many_00.txt, 04_many_01.txt, 04_many_02.txt, 04_many_03.txt, 04_many_04.txt, 04_many_05.txt, 04_many_06.txt, 04_many_07.txt, 04_many_08.txt, 04_many_09.txt, 04_many_10.txt, 04_many_11.txt, 05_hand_00.txt, 05_hand_01.txt, 99_hack_00.txt, 99_hack_01.txt, 99_hack_02.txt, 99_hack_03.txt, 99_hack_04.txt, 99_hack_05.txt, 99_hack_06.txt, 99_hack_07.txt, 99_hack_08.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt WA 7 ms 3564 KiB
00_sample_01.txt AC 3 ms 3564 KiB
00_sample_02.txt AC 2 ms 3564 KiB
01_rnd_00.txt WA 7 ms 3560 KiB
01_rnd_01.txt WA 2 ms 3520 KiB
01_rnd_02.txt WA 34 ms 7280 KiB
01_rnd_03.txt WA 2 ms 3540 KiB
01_rnd_04.txt AC 2 ms 3588 KiB
01_rnd_05.txt WA 42 ms 7612 KiB
01_rnd_06.txt WA 18 ms 9416 KiB
01_rnd_07.txt AC 20 ms 9356 KiB
01_rnd_08.txt AC 428 ms 49572 KiB
02_one_00.txt WA 3 ms 3508 KiB
02_one_01.txt AC 2 ms 3504 KiB
02_one_02.txt WA 2 ms 3524 KiB
02_one_03.txt WA 4 ms 3532 KiB
02_one_04.txt AC 2 ms 3548 KiB
02_one_05.txt AC 2 ms 3552 KiB
02_one_06.txt WA 2 ms 3564 KiB
02_one_07.txt AC 326 ms 36988 KiB
02_one_08.txt AC 315 ms 36100 KiB
02_one_09.txt AC 321 ms 37080 KiB
02_one_10.txt AC 320 ms 36940 KiB
02_one_11.txt AC 320 ms 36992 KiB
02_one_12.txt AC 316 ms 36092 KiB
02_one_13.txt AC 322 ms 37076 KiB
03_two_00.txt AC 324 ms 37152 KiB
03_two_01.txt AC 319 ms 36492 KiB
03_two_02.txt AC 318 ms 37072 KiB
03_two_03.txt AC 321 ms 37052 KiB
03_two_04.txt AC 322 ms 36992 KiB
03_two_05.txt AC 319 ms 36592 KiB
03_two_06.txt AC 316 ms 37060 KiB
03_two_07.txt AC 324 ms 37008 KiB
03_two_08.txt AC 320 ms 36604 KiB
03_two_09.txt AC 322 ms 37092 KiB
03_two_10.txt AC 318 ms 36604 KiB
03_two_11.txt AC 315 ms 36132 KiB
04_many_00.txt WA 57 ms 11668 KiB
04_many_01.txt WA 58 ms 11616 KiB
04_many_02.txt WA 61 ms 11688 KiB
04_many_03.txt WA 58 ms 11672 KiB
04_many_04.txt AC 321 ms 36688 KiB
04_many_05.txt AC 320 ms 36644 KiB
04_many_06.txt AC 319 ms 36708 KiB
04_many_07.txt AC 320 ms 36604 KiB
04_many_08.txt AC 298 ms 34776 KiB
04_many_09.txt AC 294 ms 34504 KiB
04_many_10.txt AC 293 ms 34652 KiB
04_many_11.txt AC 297 ms 34688 KiB
05_hand_00.txt AC 3 ms 3548 KiB
05_hand_01.txt AC 211 ms 71912 KiB
99_hack_00.txt AC 2 ms 3500 KiB
99_hack_01.txt AC 2 ms 3476 KiB
99_hack_02.txt AC 4 ms 3460 KiB
99_hack_03.txt AC 3 ms 3564 KiB
99_hack_04.txt AC 4 ms 3592 KiB
99_hack_05.txt AC 3 ms 3520 KiB
99_hack_06.txt AC 3 ms 3460 KiB
99_hack_07.txt AC 3 ms 3564 KiB
99_hack_08.txt AC 2 ms 3564 KiB