提出 #40536021


ソースコード 拡げる

#include<bits/stdc++.h>
using namespace std;

typedef long long int ll;
#define IOS ios_base::sync_with_stdio(0);  cin.tie(0); cout.tie(0);


#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

typedef tree<int,null_type, less<int>,rb_tree_tag, tree_order_statistics_node_update>order_set;
typedef pair<int,int>pr;
#define all(i)     i.begin() , i.end()
#define ft     first
#define sn     second
#define pb push_back


#define en "\n"
#define dbg cout<<"rony\n";

#define MAXN 200010
#define inf 1e6
const ll mod = 998244353;

vector<int>g[MAXN];
ll vis[MAXN];
int n,m;

int dfs(int nd)
{
    vis[nd] = 1;
    int sz = 1;
    for(auto i:g[nd])
    {
        if(vis[i] == 1) continue;
        if(sz >= inf) return sz;
        sz += dfs(i);
        if(sz >= inf) return sz;
    }
    vis[nd] = 2;
    return sz;
}

void solve()
{
    cin >> n >> m;
    for(int i = 1;i <= m;i++){
        int x,y;
        cin >> x >> y;
        g[x].pb(y);
        g[y].pb(x);
    }

      int k = dfs(1);
      cout<<min(k,(int)inf)<<en;

}
int main()
{
    IOS;
   int t;
   t = 1;
  
   // cin >> t;

   int c = 0;
    while ( t-- )
    {
        // cout<<"Case "<<++c<<": ";
        solve();
    }
    return 0;
}   

提出情報

提出日時
問題 E - Count Simple Paths
ユーザ ar_rony1
言語 C++ (GCC 9.2.1)
得点 500
コード長 1331 Byte
結果 AC
実行時間 144 ms
メモリ 25364 KiB

コンパイルエラー

./Main.cpp: In function ‘int main()’:
./Main.cpp:68:8: warning: unused variable ‘c’ [-Wunused-variable]
   68 |    int c = 0;
      |        ^

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 500 / 500
結果
AC × 3
AC × 33
セット名 テストケース
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_small_00.txt, 01_small_01.txt, 01_small_02.txt, 01_small_03.txt, 01_small_04.txt, 01_small_05.txt, 01_small_06.txt, 01_small_07.txt, 01_small_08.txt, 01_small_09.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 03_random_2_00.txt, 03_random_2_01.txt, 03_random_2_02.txt, 03_random_2_03.txt, 03_random_2_04.txt, 04_corner_00.txt, 04_corner_01.txt, 04_corner_02.txt, 04_corner_03.txt, 04_corner_04.txt, 04_corner_05.txt, 05_path_00.txt, 05_path_01.txt, 06_m_eq_0_00.txt, 07_n_eq_1_00.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 12 ms 8176 KiB
00_sample_01.txt AC 7 ms 8192 KiB
00_sample_02.txt AC 10 ms 8212 KiB
01_small_00.txt AC 11 ms 8160 KiB
01_small_01.txt AC 10 ms 8152 KiB
01_small_02.txt AC 8 ms 8164 KiB
01_small_03.txt AC 11 ms 8216 KiB
01_small_04.txt AC 8 ms 8100 KiB
01_small_05.txt AC 8 ms 8160 KiB
01_small_06.txt AC 9 ms 8220 KiB
01_small_07.txt AC 7 ms 8156 KiB
01_small_08.txt AC 29 ms 8240 KiB
01_small_09.txt AC 7 ms 8160 KiB
02_random_00.txt AC 80 ms 11452 KiB
02_random_01.txt AC 29 ms 8152 KiB
02_random_02.txt AC 23 ms 8156 KiB
02_random_03.txt AC 144 ms 17860 KiB
02_random_04.txt AC 69 ms 13756 KiB
03_random_2_00.txt AC 51 ms 12024 KiB
03_random_2_01.txt AC 55 ms 11812 KiB
03_random_2_02.txt AC 39 ms 10500 KiB
03_random_2_03.txt AC 41 ms 9628 KiB
03_random_2_04.txt AC 52 ms 11996 KiB
04_corner_00.txt AC 65 ms 17964 KiB
04_corner_01.txt AC 63 ms 17336 KiB
04_corner_02.txt AC 64 ms 16868 KiB
04_corner_03.txt AC 38 ms 10896 KiB
04_corner_04.txt AC 52 ms 14596 KiB
04_corner_05.txt AC 95 ms 24268 KiB
05_path_00.txt AC 87 ms 22512 KiB
05_path_01.txt AC 62 ms 25364 KiB
06_m_eq_0_00.txt AC 6 ms 8124 KiB
07_n_eq_1_00.txt AC 9 ms 8196 KiB