Submission #698813

# Submission time Handle Problem Language Result Execution time Memory
698813 2023-02-14T10:14:46 Z vjudge1 Duathlon (APIO18_duathlon) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#define endl '\n'
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int ll
#define all(vec) vec.begin(), vec.end()
typedef long long ll;
using namespace std;
const int N = 1e3 + 10, mod = 1e9 + 7;
vector<vector<int> > v(N);
bool vis[N];
bool flag;
int dfs(int node, int par) {
    vis[node] = 1;
    int cnt = 1;
    for(auto ch : v[node]) {
        if(!vis[ch]) {
            cnt += dfs(ch, node);
        }
        if(vis[ch] && par != ch) flag = 1;
    }
    return cnt;
}
signed main()
{
    FAST;
    int n, m;
    cin >> n >> m;
    for(int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    for (int i=1; i<=n; ++i){
        flag = 0;
        int x = 0;
        if(!vis[i]) x = dfs(i);
        if(x > 2) {
            if (flag) ans += x*(x-1)*(x-2);
            else  ans += x*(x-1)*(x-2)/3;
        }
    }
    cout << y;
}

Compilation message

count_triplets.cpp: In function 'int main()':
count_triplets.cpp:37:30: error: too few arguments to function 'll dfs(ll, ll)'
   37 |         if(!vis[i]) x = dfs(i);
      |                              ^
count_triplets.cpp:12:5: note: declared here
   12 | int dfs(int node, int par) {
      |     ^~~
count_triplets.cpp:39:23: error: 'ans' was not declared in this scope; did you mean 'abs'?
   39 |             if (flag) ans += x*(x-1)*(x-2);
      |                       ^~~
      |                       abs
count_triplets.cpp:40:19: error: 'ans' was not declared in this scope; did you mean 'abs'?
   40 |             else  ans += x*(x-1)*(x-2)/3;
      |                   ^~~
      |                   abs
count_triplets.cpp:43:13: error: 'y' was not declared in this scope
   43 |     cout << y;
      |             ^