Submission #1150620

#TimeUsernameProblemLanguageResultExecution timeMemory
1150620BlockOGFriend (IOI14_friend)C++20
Compilation error
0 ms0 KiB
#include "friend.h"
#include <vector>
#include <cstdint>

// mrrrow meeow :3
// go play vivid/stasis! it's an awesome free game on steam

#define int long long

int vs[100000][2];

int max(int a, int b) { return a > b ? a : b; }

int32_t findSample(int n, int confidence[], int host[], int protocol[]) {
    for (int i = 0; i < n; i++) vs[i][1] = confidence[i];
    
    for (int i = n; i-- > 1;) {
        int j = host[i];
        
        switch (protocol[i]) {
        case 0:
            vs[j][0] += max(vs[i][0], vs[i][1]);
            vs[j][1] += vs[i][0];
            break;
        case 1:
            vs[j][0] += vs[i][0];
            vs[j][1] = max(vs[j][0], vs[j][1]) + max(vs[i][0], vs[i][1]);
            break;
        case 2:
            vs[j][0] += vs[i][0];
            vs[j][1] = max(vs[j][0] + vs[i][1], vs[j][1] + vs[i][0]);
            break;
        }
    }
    
    return max(vs[0][0], vs[0][1]);
}

Compilation message (stderr)

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