Submission #1055698

# Submission time Handle Problem Language Result Execution time Memory
1055698 2024-08-13T03:48:26 Z shjeong Beech Tree (IOI23_beechtree) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pi;
#define all(x) x.begin(),x.end()
#define rll(x) x.rbegin(),x.rend()
ll n, m;
vector<ll> p, c;
vector<int> ans;
vector<ll> adj[202020];
void dfs(ll x){
    for(auto next : adj[x]){
        dfs(next);
    }
    set<ll> st;
    bool flag = 1;
    for(auto next : adj[x]){
        if(st.find(c[next]) != st.end()){
            flag = 0;
            break;
        }
        st.insert(c[next]);
    }
    ans[x] = flag;
    if(x==0 and flag){
        vector<pair<ll,map<ll,ll>>> v;
        for(auto next : adj[x]){
            if(!ans[next]){ans[x] = 0; return;}
            ll cnt = 0; map<ll,ll> mp;
            for(auto nnext : adj[next])cnt++, mp[c[nnext]]++;
            v.push_back({cnt,mp});
        }
        sort(rll(v));
        for(int i = 1 ; i < v.size() ; i++){
            for(auto [a,b] : v[i].second){
                if(v[i-1].second[a] < b){
                    ans[x] = 0;
                    return;
                }
            }
        }
    }
}

Compilation message

beechtree.cpp: In function 'void dfs(ll)':
beechtree.cpp:34:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, std::map<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |         for(int i = 1 ; i < v.size() ; i++){
      |                         ~~^~~~~~~~~~
/usr/bin/ld: /tmp/ccPh57y9.o: in function `main':
grader.cpp:(.text.startup+0x27d): undefined reference to `beechtree(int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status