Submission #14096

#TimeUsernameProblemLanguageResultExecution timeMemory
14096exqtBe Two Bees (OJUZ10_b2b)C++98
33 / 100
6 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 REPE(i,s,e) for(int i=s; i<=e; i++) #define REPR(i,s,e) for(int i=e; i>=s; i--) #define X first #define Y second #define pdd pair<double, double> int main() { int n; in >> n; if(n > 1111) 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; //X:time Y:honey double mint = 98765432109876543210.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...