Submission #718502

# Submission time Handle Problem Language Result Execution time Memory
718502 2023-04-04T09:03:47 Z mseebacher Horses (IOI15_horses) C++17
0 / 100
1500 ms 8020 KB
#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 log2(i);
}

int expp(double i){
	return (int)pow(2,i);
}

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 time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1554 ms 8020 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -