#include<stdio.h>
int n;
long long int a[1009];
long long int b[1009];
long long int x;
int main()
{
scanf("%d",&n);
if(n>1000)printf("3 8\n");
int i, j, k;
for(i=0;i<n;i++)
{
scanf("%lld",&a[i]);
x += a[i];
}
for(i=0;i<n;i++)
scanf("%lld",&b[i]);
long long int p,q,r,s;
int mi,mj;
mi=mj=-1;
for(i=0;i<n;i++)
for(j=i+1;j<n;j++)
{
r=(x-a[i]-a[j])*b[i]*b[j];
s=(b[i]+b[j]);
if(mi==-1)
{
p = r;
q = s;
mi = i;
mj = j;
}
else
{
if(p/q > r/s)
{
p = r;
q = s;
mi = i;mj = j;
}
else if(p/q<r/s) continue;
long long int t,u;
t = p%q;
u = r%s;
if(t*s > r*u)
{
p = r;
q = s;
mi = i;mj = j;
}
}
}
printf("%d %d\n",mi+1,mj+1);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1100 KB |
Output is correct |
2 |
Correct |
0 ms |
1100 KB |
Output is correct |
3 |
Correct |
0 ms |
1100 KB |
Output is correct |
4 |
Correct |
0 ms |
1100 KB |
Output is correct |
5 |
Correct |
0 ms |
1100 KB |
Output is correct |
6 |
Correct |
0 ms |
1100 KB |
Output is correct |
7 |
Correct |
0 ms |
1100 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
1100 KB |
Output is correct |
2 |
Correct |
11 ms |
1100 KB |
Output is correct |
3 |
Correct |
2 ms |
1100 KB |
Output is correct |
4 |
Correct |
11 ms |
1100 KB |
Output is correct |
5 |
Correct |
10 ms |
1100 KB |
Output is correct |
6 |
Correct |
0 ms |
1100 KB |
Output is correct |
7 |
Correct |
15 ms |
1100 KB |
Output is correct |
8 |
Correct |
0 ms |
1100 KB |
Output is correct |
9 |
Correct |
15 ms |
1100 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
1100 KB |
Output isn't correct |
2 |
Runtime error |
0 ms |
1100 KB |
futex (syscall #202) was called by the program (disallowed syscall) |
3 |
Runtime error |
0 ms |
1100 KB |
futex (syscall #202) was called by the program (disallowed syscall) |
4 |
Runtime error |
0 ms |
1100 KB |
futex (syscall #202) was called by the program (disallowed syscall) |
5 |
Incorrect |
7 ms |
1100 KB |
Output isn't correct |
6 |
Runtime error |
0 ms |
1100 KB |
futex (syscall #202) was called by the program (disallowed syscall) |
7 |
Incorrect |
0 ms |
1100 KB |
Output isn't correct |
8 |
Runtime error |
0 ms |
1100 KB |
futex (syscall #202) was called by the program (disallowed syscall) |
9 |
Runtime error |
0 ms |
1100 KB |
futex (syscall #202) was called by the program (disallowed syscall) |
10 |
Incorrect |
0 ms |
1100 KB |
Output isn't correct |
11 |
Runtime error |
0 ms |
1100 KB |
futex (syscall #202) was called by the program (disallowed syscall) |
12 |
Runtime error |
0 ms |
1100 KB |
futex (syscall #202) was called by the program (disallowed syscall) |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
1100 KB |
futex (syscall #202) was called by the program (disallowed syscall) |
2 |
Runtime error |
0 ms |
1100 KB |
futex (syscall #202) was called by the program (disallowed syscall) |
3 |
Runtime error |
0 ms |
1100 KB |
futex (syscall #202) was called by the program (disallowed syscall) |
4 |
Runtime error |
0 ms |
1100 KB |
futex (syscall #202) was called by the program (disallowed syscall) |
5 |
Runtime error |
0 ms |
1100 KB |
futex (syscall #202) was called by the program (disallowed syscall) |
6 |
Runtime error |
0 ms |
1100 KB |
futex (syscall #202) was called by the program (disallowed syscall) |
7 |
Incorrect |
0 ms |
1100 KB |
Output isn't correct |
8 |
Runtime error |
0 ms |
1100 KB |
futex (syscall #202) was called by the program (disallowed syscall) |
9 |
Incorrect |
0 ms |
1100 KB |
Output isn't correct |
10 |
Incorrect |
15 ms |
1100 KB |
Output isn't correct |
11 |
Runtime error |
0 ms |
1100 KB |
futex (syscall #202) was called by the program (disallowed syscall) |
12 |
Runtime error |
0 ms |
1100 KB |
futex (syscall #202) was called by the program (disallowed syscall) |
13 |
Runtime error |
0 ms |
1100 KB |
futex (syscall #202) was called by the program (disallowed syscall) |
14 |
Runtime error |
0 ms |
1100 KB |
futex (syscall #202) was called by the program (disallowed syscall) |
15 |
Runtime error |
0 ms |
1100 KB |
futex (syscall #202) was called by the program (disallowed syscall) |
16 |
Runtime error |
0 ms |
1100 KB |
futex (syscall #202) was called by the program (disallowed syscall) |
17 |
Runtime error |
0 ms |
1100 KB |
futex (syscall #202) was called by the program (disallowed syscall) |