# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
422073 | Peti | Friend (IOI14_friend) | C++14 | 1 ms | 204 KiB |
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 <bits/stdc++.h>
#include "friend.h"
using namespace std;
// Find out best sample
int findSample(int n,int confidence[], int host[], int protocol[]){
vector<pair<int, int>> v(n, make_pair(0, 0));
for(int i = 0; i < n; i++)
v[i].first = confidence[i];
for(int i = n-1; i > 0; i--){
if(protocol[i] == 0){
v[host[i]].first += v[i].second;
v[host[i]].second += v[i].first;
v[host[i]].second = max(v[host[i]].second, v[host[i]].first - confidence[host[i]]);
} else if(protocol[i] == 1){
v[host[i]].first += v[i].first;
v[host[i]].second += v[i].second;
//v[host[i]].second = max(v[host[i]].second, v[host[i]].first - confidence[host[i]]);
} else{
v[host[i]].first = max(v[host[i]].first + v[i].second, v[host[i]].first + v[i].first - confidence[host[i]]);
v[host[i]].second += v[i].second;
//v[host[i]].second = max(v[host[i]].second, v[host[i]].first - confidence[host[i]]);
}
}
for(int i = 0; i < n; i++)
cout<<v[i].first<<" "<<v[i].second<<"\n";
return max(v[0].first, v[0].second);
}
Compilation message (stderr)
# | 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... |