제출 #13963

#제출 시각아이디문제언어결과실행 시간메모리
13963kriiiBe Two Bees (OJUZ10_b2b)C++14
33 / 100
1000 ms3428 KiB
#include <stdio.h> #include <algorithm> using namespace std; int N,H[100100],T[100100],S; struct p{ p(){ a = i = 0; } p(double a_, int i_){ a = a_; i = i_; } double a; int i; bool operator <(const p t) const{ return a > t.a; } }P[100100]; bool go(double m) { for (int i=0;i<N;i++){ P[i] = p(m/T[i]+H[i],i+1); } sort(P,P+N); return P[0].a + P[1].a >= S; } int main() { scanf ("%d",&N); for (int i=0;i<N;i++){ scanf ("%d",&H[i]); S += H[i]; } for (int j=0;j<N;j++) scanf ("%d",&T[j]); double l = 0, r = 1e9, m; for (int i=0;i<100;i++){ m = (l + r) / 2; if (go(m)) r = m; else l = m; } int a = P[0].i, b = P[1].i; if (a > b) swap(a,b); printf ("%d %d\n",a,b); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...