Submission #986640

#TimeUsernameProblemLanguageResultExecution timeMemory
986640beabossFriend (IOI14_friend)C++14
Compilation error
0 ms0 KiB
// Source: https://oj.uz/problem/view/IOI14_friend?locale=en // #include "friend.h" #include "bits/stdc++.h" using namespace std; #define s second #define f first #define pb push_back typedef long long ll; typedef pair<ll, ll> pii; typedef vector<pii> vpii; typedef vector<ll> vi; #define FOR(i, a, b) for (ll i = (a); i<b; i++) bool ckmin(ll& a, ll b){ return b < a ? a = b, true : false; } bool ckmax(ll& a, ll b){ return b > a ? a = b, true : false; } const ll N = 1e5 + 10; ll c[N]; ll findSample(ll n, vi confidence, vi host, vi protocol) { vi bst = {0, 0}; bst[0] += confidence[0]; c[0] = 0; FOR(i, 1, n) { // cout << ' ' << i << host[i] << protocol[i] << endl; if (protocol[i] == 1) { c[i] = c[host[i]]; bst[c[i]] += confidence[i]; } else if (protocol[i] == 0) { c[i] = !c[host[i]]; bst[c[i]] += confidence[i]; } else { bst[c[host[i]]] -= confidence[host[i]]; bst[c[host[i]]] += max(confidence[host[i]], confidence[i]); } // if (protocol[i] != 2) cout << i << bst[c[i]] << endl; } return max(bst[0], bst[1]); } // int main() { // ios::sync_with_stdio(false); // cin.tie(nullptr); // ll n; // cin >> n; // vi c(n); // FOR(i, 0, n) cin >> c[i]; // vi prot(n); // vi host(n); // FOR(i, 1, n) cin >> host[i] >> prot[i]; // cout << findSample(n, c, host, prot) << endl; // }

Compilation message (stderr)

/usr/bin/ld: /tmp/cckrGMrS.o: in function `main':
grader.cpp:(.text.startup+0xdd): undefined reference to `findSample(int, int*, int*, int*)'
collect2: error: ld returned 1 exit status