답안 #864617

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
864617 2023-10-23T10:41:42 Z vnm06 철인 이종 경기 (APIO18_duathlon) C++14
5 / 100
1000 ms 10840 KB
#include<bits/stdc++.h>
#define endl '\n'

using namespace std;

long long n, m, en;
vector<int> gr[300005];

long long ans=0;
int post[3005];
int vzm[3005];

void dfs(int v)
{
    if(v==en)
    {
        for(int j=1; j<=n; j++) if(post[j]) vzm[j]=1;
        return;
    }
    post[v]=1;
    int brs=gr[v].size();
    for(int i=0; i<brs; i++)
    {
        int nv=gr[v][i];
        if(!post[nv]) dfs(nv); 
    }
    post[v]=0;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin>>n>>m;
    for(int i=0; i<m; i++)
    {
        int v, u;
        cin>>v>>u;
        gr[v].push_back(u);
        gr[u].push_back(v);
    }
    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=n; j++)
        {
            if(i==j) continue;
            for(int k=1; k<=n; k++) vzm[k]=0;
            en=j;
            dfs(i);
            for(int k=1; k<=n; k++)
            {
                if(k==i || k==j) continue;
                ans+=vzm[k];
                post[k]=vzm[k]=0;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}
/**
8 7
1 2
2 3
2 4
3 5
5 6
6 7
6 8

4 4
1 2
2 4
2 3
3 4
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 7256 KB Output is correct
2 Correct 2 ms 7260 KB Output is correct
3 Correct 2 ms 7260 KB Output is correct
4 Correct 2 ms 7260 KB Output is correct
5 Correct 2 ms 7260 KB Output is correct
6 Correct 2 ms 7260 KB Output is correct
7 Correct 2 ms 7260 KB Output is correct
8 Correct 2 ms 7508 KB Output is correct
9 Correct 20 ms 7256 KB Output is correct
10 Correct 336 ms 7260 KB Output is correct
11 Correct 2 ms 7256 KB Output is correct
12 Correct 2 ms 7260 KB Output is correct
13 Correct 2 ms 7260 KB Output is correct
14 Correct 2 ms 7260 KB Output is correct
15 Correct 2 ms 7260 KB Output is correct
16 Correct 2 ms 7416 KB Output is correct
17 Correct 2 ms 7768 KB Output is correct
18 Correct 2 ms 7516 KB Output is correct
19 Correct 2 ms 7260 KB Output is correct
20 Correct 2 ms 7260 KB Output is correct
21 Correct 2 ms 7508 KB Output is correct
22 Correct 2 ms 7260 KB Output is correct
23 Correct 2 ms 7260 KB Output is correct
24 Correct 2 ms 7260 KB Output is correct
25 Correct 2 ms 7516 KB Output is correct
26 Correct 2 ms 7516 KB Output is correct
27 Correct 2 ms 7256 KB Output is correct
28 Correct 2 ms 7260 KB Output is correct
29 Correct 2 ms 7516 KB Output is correct
30 Correct 2 ms 7260 KB Output is correct
31 Correct 2 ms 7512 KB Output is correct
32 Correct 2 ms 7516 KB Output is correct
33 Correct 2 ms 7260 KB Output is correct
34 Correct 2 ms 7504 KB Output is correct
35 Correct 2 ms 7260 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 7256 KB Output is correct
2 Correct 2 ms 7260 KB Output is correct
3 Correct 2 ms 7260 KB Output is correct
4 Correct 2 ms 7260 KB Output is correct
5 Correct 2 ms 7260 KB Output is correct
6 Correct 2 ms 7260 KB Output is correct
7 Correct 2 ms 7260 KB Output is correct
8 Correct 2 ms 7508 KB Output is correct
9 Correct 20 ms 7256 KB Output is correct
10 Correct 336 ms 7260 KB Output is correct
11 Correct 2 ms 7256 KB Output is correct
12 Correct 2 ms 7260 KB Output is correct
13 Correct 2 ms 7260 KB Output is correct
14 Correct 2 ms 7260 KB Output is correct
15 Correct 2 ms 7260 KB Output is correct
16 Correct 2 ms 7416 KB Output is correct
17 Correct 2 ms 7768 KB Output is correct
18 Correct 2 ms 7516 KB Output is correct
19 Correct 2 ms 7260 KB Output is correct
20 Correct 2 ms 7260 KB Output is correct
21 Correct 2 ms 7508 KB Output is correct
22 Correct 2 ms 7260 KB Output is correct
23 Correct 2 ms 7260 KB Output is correct
24 Correct 2 ms 7260 KB Output is correct
25 Correct 2 ms 7516 KB Output is correct
26 Correct 2 ms 7516 KB Output is correct
27 Correct 2 ms 7256 KB Output is correct
28 Correct 2 ms 7260 KB Output is correct
29 Correct 2 ms 7516 KB Output is correct
30 Correct 2 ms 7260 KB Output is correct
31 Correct 2 ms 7512 KB Output is correct
32 Correct 2 ms 7516 KB Output is correct
33 Correct 2 ms 7260 KB Output is correct
34 Correct 2 ms 7504 KB Output is correct
35 Correct 2 ms 7260 KB Output is correct
36 Correct 2 ms 7256 KB Output is correct
37 Correct 2 ms 7260 KB Output is correct
38 Correct 32 ms 7508 KB Output is correct
39 Execution timed out 1063 ms 7260 KB Time limit exceeded
40 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1012 ms 10588 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1045 ms 7516 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1020 ms 10584 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1064 ms 7516 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1022 ms 10840 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 7256 KB Output is correct
2 Correct 2 ms 7260 KB Output is correct
3 Correct 2 ms 7260 KB Output is correct
4 Correct 2 ms 7260 KB Output is correct
5 Correct 2 ms 7260 KB Output is correct
6 Correct 2 ms 7260 KB Output is correct
7 Correct 2 ms 7260 KB Output is correct
8 Correct 2 ms 7508 KB Output is correct
9 Correct 20 ms 7256 KB Output is correct
10 Correct 336 ms 7260 KB Output is correct
11 Correct 2 ms 7256 KB Output is correct
12 Correct 2 ms 7260 KB Output is correct
13 Correct 2 ms 7260 KB Output is correct
14 Correct 2 ms 7260 KB Output is correct
15 Correct 2 ms 7260 KB Output is correct
16 Correct 2 ms 7416 KB Output is correct
17 Correct 2 ms 7768 KB Output is correct
18 Correct 2 ms 7516 KB Output is correct
19 Correct 2 ms 7260 KB Output is correct
20 Correct 2 ms 7260 KB Output is correct
21 Correct 2 ms 7508 KB Output is correct
22 Correct 2 ms 7260 KB Output is correct
23 Correct 2 ms 7260 KB Output is correct
24 Correct 2 ms 7260 KB Output is correct
25 Correct 2 ms 7516 KB Output is correct
26 Correct 2 ms 7516 KB Output is correct
27 Correct 2 ms 7256 KB Output is correct
28 Correct 2 ms 7260 KB Output is correct
29 Correct 2 ms 7516 KB Output is correct
30 Correct 2 ms 7260 KB Output is correct
31 Correct 2 ms 7512 KB Output is correct
32 Correct 2 ms 7516 KB Output is correct
33 Correct 2 ms 7260 KB Output is correct
34 Correct 2 ms 7504 KB Output is correct
35 Correct 2 ms 7260 KB Output is correct
36 Correct 2 ms 7256 KB Output is correct
37 Correct 2 ms 7260 KB Output is correct
38 Correct 32 ms 7508 KB Output is correct
39 Execution timed out 1063 ms 7260 KB Time limit exceeded
40 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 7256 KB Output is correct
2 Correct 2 ms 7260 KB Output is correct
3 Correct 2 ms 7260 KB Output is correct
4 Correct 2 ms 7260 KB Output is correct
5 Correct 2 ms 7260 KB Output is correct
6 Correct 2 ms 7260 KB Output is correct
7 Correct 2 ms 7260 KB Output is correct
8 Correct 2 ms 7508 KB Output is correct
9 Correct 20 ms 7256 KB Output is correct
10 Correct 336 ms 7260 KB Output is correct
11 Correct 2 ms 7256 KB Output is correct
12 Correct 2 ms 7260 KB Output is correct
13 Correct 2 ms 7260 KB Output is correct
14 Correct 2 ms 7260 KB Output is correct
15 Correct 2 ms 7260 KB Output is correct
16 Correct 2 ms 7416 KB Output is correct
17 Correct 2 ms 7768 KB Output is correct
18 Correct 2 ms 7516 KB Output is correct
19 Correct 2 ms 7260 KB Output is correct
20 Correct 2 ms 7260 KB Output is correct
21 Correct 2 ms 7508 KB Output is correct
22 Correct 2 ms 7260 KB Output is correct
23 Correct 2 ms 7260 KB Output is correct
24 Correct 2 ms 7260 KB Output is correct
25 Correct 2 ms 7516 KB Output is correct
26 Correct 2 ms 7516 KB Output is correct
27 Correct 2 ms 7256 KB Output is correct
28 Correct 2 ms 7260 KB Output is correct
29 Correct 2 ms 7516 KB Output is correct
30 Correct 2 ms 7260 KB Output is correct
31 Correct 2 ms 7512 KB Output is correct
32 Correct 2 ms 7516 KB Output is correct
33 Correct 2 ms 7260 KB Output is correct
34 Correct 2 ms 7504 KB Output is correct
35 Correct 2 ms 7260 KB Output is correct
36 Correct 2 ms 7256 KB Output is correct
37 Correct 2 ms 7260 KB Output is correct
38 Correct 32 ms 7508 KB Output is correct
39 Execution timed out 1063 ms 7260 KB Time limit exceeded
40 Halted 0 ms 0 KB -