# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
197878 | Masterdan | Friend (IOI14_friend) | C++14 | 0 ms | 0 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 "friend.h"
#include <bits/stdc++.h>
// Find out best sample
#define all(a) a.begin (),a.end ()
#define MIN -1
#define MAX 1e9+7
#define F first
#define S second
#define mk make_pair()
#define pb push_back
using namespace std;
typedef vector <int> vi;
typedef pair<int, int> ii;
int findSample(int n,int confidence[],int host[],int protocol[]){
vi v;
for(int i=0;i<n;i++)v.pb(confidence[i]);
sort(all(v));
return v[n-1]+v[n-2];
}
#include <cstdio>
#include <cassert>
#define __MAXSIZE__ 100002
using namespace std;
// Confidence
int confidence[__MAXSIZE__];
// Host
int host[__MAXSIZE__];
// Protocol
int protocol[__MAXSIZE__];
// Main
int main(void)
{
int n,i;
// Number of people
assert(scanf("%d",&n)==1);
// Confidence
for(i=0;i<n;i++)
assert(scanf("%d",&confidence[i])==1);
// Host and Protocol
for(i=1;i<n;i++)
assert(scanf("%d %d",&host[i],&protocol[i])==2);
// Answer
printf("%d\n",findSample(n,confidence,host,protocol));
return 0;
}