Submission #718499

#TimeUsernameProblemLanguageResultExecution timeMemory
718499mseebacherHorses (IOI15_horses)C++17
0 / 100
1561 ms10224 KiB
#include "horses.h" #include <stdio.h> #include <stdlib.h> #include <iostream> #include <string> #include <vector> #include <cmath> #include <cstring> #include <algorithm> #include <iomanip> #include <map> #include <set> #include <stack> #include <queue> #include <functional> #include <iostream> #include <fstream> #include <string> using namespace std; vector<int> x; vector<int> y; int n; double logp(int i){ return 1e3*log2(i); } int expp(double i){ double a = i/1000; return (int)pow(2,a); } const double MOD = logp(1e9+7); int calc(){ double horses = logp(1); double p = 0; for(int i = 0;i<n;i++){ horses += logp(x[i]); p = max(p,horses+logp(y[i])); } return expp(p); } int init(int N, int X[], int Y[]) { n = N; x.assign(N,0); y.assign(N,0); for(int i = 0;i<n;i++){ x[i] = X[i]; y[i] = Y[i]; } return calc(); } int updateX(int pos, int val) { x[pos] = val; return calc(); } int updateY(int pos, int val) { y[pos] = val; return calc(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...