Submission #1184290

#TimeUsernameProblemLanguageResultExecution timeMemory
1184290jcoladaFriend (IOI14_friend)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
#include "friend.h"
using namespace std;

int findSample(int n, int confidence[], int host[], int protocol[]){
    int cost[n], tot = 0; for(int i = 0; i < n; i++) cost[i] = confidence[i];
    for(int i = n-1, i > 0, i--){
        if(protocol[i] == 2){cost[host[i]] = max(cost[host[i]],cost[i]);}
        else if(protocol[i] == 1){cost[host[i]] += cost[i];}
        else{
            tot += cost[i];
            cost[host[i]] -= min(cost[host[i]], cost[i]);
        }
    }
    tot += cost[0];
    return tot;
}

Compilation message (stderr)

friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:7:23: error: expected ';' before '>' token
    7 |     for(int i = n-1, i > 0, i--){
      |                       ^~
      |                       ;
friend.cpp:7:24: error: expected primary-expression before '>' token
    7 |     for(int i = n-1, i > 0, i--){
      |                        ^
friend.cpp:7:32: error: expected ';' before ')' token
    7 |     for(int i = n-1, i > 0, i--){
      |                                ^
      |                                ;