제출 #14095

#제출 시각아이디문제언어결과실행 시간메모리
14095exqtBe Two Bees (OJUZ10_b2b)C++98
11 / 100
7 ms1720 KiB
#include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <vector> #include <queue> #include <string> #include <algorithm> #include <utility> using namespace std; #define in cin #define out cout #define _abs(a) ((a)>0?(a):(-(a))) #define _min(a,b) ((a)>(b)?(b):(a)) #define _max(a,b) ((a)<(b)?(b):(a)) #define isin(a,b,c) ((a)<=(c)&&(c)<=(b)) #define REP(i,e) for(int i=0; i<e; i++) #define REP2(i,s,e) for(int i=s; i<e; i++) #define X first #define Y second #define pdd pair<double, double> int main() { int n; in >> n; if(n > 1000) return 0; vector< pdd > o(n), v(n); REP(i,n) in >> v[i].Y; REP(i,n) in >> v[i].X; REP(i,n) o[i] = v[i]; sort(v.begin(), v.end()); double sum = 0.0; REP(i,n) sum += v[i].Y; double mint = 111111111111.0; int mina, minb; REP(i,v.size()) { REP2(j,i+1,v.size()) { double k = v[i].X; double m = v[i].Y; double t = (k - (k*k)/(k+v[j].X))*(sum-m-v[j].Y); if(mint > t) { mint = t; mina = i, minb = j; } } } int ra, rb; REP(i,n) { if(v[mina] == o[i]) ra = i; if(v[minb] == o[i]) rb = i; } ra++; rb++; if(ra > rb) out << rb << " " << ra << endl; else out << ra << " " << rb << endl; 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...