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 <stdio.h>
#include <algorithm>
using namespace std;
struct emp
{
int n,t;
}d[100001];
int n;
int main (void)
{
int i,j,a,b,num,mxt=0,totn=0,tott=0,temp,temp2;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&d[i].n);
totn+=d[i].n;
}
for(i=0;i<n;i++){
scanf("%d",&d[i].t);
tott+=d[i].t;
}
a=0;
b=1;
num=totn-(d[0].n+d[1].n);
mxt=d[0].t+d[1].t;
for(i=0;i<n;i++){
for(j=i+1;j<n;j++){
temp=totn-(d[i].n+d[j].n);
temp2=d[i].t+d[j].t;
if(mxt*temp>num*temp2){
a=i+1;
b=j+1;
num=temp;
mxt=temp2;
}
}
//printf("%d %d %d %d\n",a,b,num,mxt);
}
printf("%d %d\n",a,b);
return 0;
}
# | 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... |