This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "friend.h"
#include<iostream>
using namespace std;
#define forn(i, n) for(int i=0; i<(int)n; ++i)
#define forsn(i, s, n) for(int i=s; i<(int)n; ++i)
int n;
int solve0(int confidence[], int host[]){
}
int solve1(int confidence[], int host[]){
int sum=0;
forn(i, n) sum+=confidence[i];
return sum;
}
int solve2(int confidence[], int host[]){
int mx=-1;
forn(i, n) mx=max(mx, confidence[i]);
return mx;
}
int solveTask(int task, int confidence[], int host[]){
if(task==0) return solve0(confidence, host);
else if(task==1) return solve1(confidence, host);
else if(task==2) return solve2(confidence, host);
}
// Find out best sample
int findSample(int N, int confidence[], int host[], int protocol[]){
n=N;
bool eq=true;
forsn(i, 1, n-1) eq&=protocol[i]==protocol[i+1];
if(eq) return solveTask(protocol[1], confidence, host);
return 0;
}
Compilation message (stderr)
friend.cpp: In function 'int solve0(int*, int*)':
friend.cpp:11:1: warning: no return statement in function returning non-void [-Wreturn-type]
11 | }
| ^
friend.cpp: In function 'int solveTask(int, int*, int*)':
friend.cpp:29:1: warning: control reaches end of non-void function [-Wreturn-type]
29 | }
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |