제출 #49203

#제출 시각아이디문제언어결과실행 시간메모리
49203BThero철인 이종 경기 (APIO18_duathlon)C++17
0 / 100
5 ms1088 KiB
// Why am I so stupid? :c
#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair

#define all(x) (x).begin(), (x).end()

#define fi first
#define se second

typedef long long ll;

using namespace std;

vector <int> adj[105];

bool can[105];

bool u[105];

int n, m;

int ans;

void dfs(int v, int fn) {
    if (v == fn) {
        for (int i = 1; i <= n; ++i) {
            can[i] |= u[i];
        }

        return;
    }

    u[v] = 1;

    for (int to : adj[v]) {
        if (u[to]) {
            continue;
        }

        dfs(to, fn);
    }

    u[v] = 0;
}

void solve() {
    scanf("%d %d", &n, &m);

    for (int i = 1, u, v; i <= m; ++i) {
        scanf("%d %d", &u, &v);

        adj[u].pb(v);
        adj[v].pb(u);
    }

    for (int a = 1; a <= n; ++a) {
        for (int b = 1; b <= n; ++b) {
            if (a == b) {
                continue;
            }

            dfs(a, b);

            for (int i = 1; i <= n; ++i) {
                ans += can[i];
                can[i] = 0;
            }

            --ans;
        }
    }

    printf("%d\n", ans);
}

int main() {
#ifdef BThero
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif // BThero

    int tt = 1;

    while (tt--) {
        solve();
    }

    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

count_triplets.cpp: In function 'void solve()':
count_triplets.cpp:49:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d", &n, &m);
     ~~~~~^~~~~~~~~~~~~~~~~
count_triplets.cpp:52:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d", &u, &v);
         ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...