답안 #795752

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
795752 2023-07-27T14:16:28 Z Username4132 말 (IOI15_horses) C++14
0 / 100
11 ms 8404 KB
#include "horses.h"
#include<iostream>
#include<cmath>
using namespace std;
using ll = long long;
using ld = long double;
#define forn(i, n) for(int i=0; i<(int)n; ++i)

const int MAXN = 1010, MOD = 1000000007;
int n, arr[MAXN], brr[MAXN];
ld pa[MAXN], pb[MAXN];

int calc(){
	ll prod=1, res=-1;
	ld mx=0, sum=0;
	forn(i, n){
		sum+=pa[i];
		prod=(prod*arr[i])%MOD;
		if(mx<sum+pb[i]){
			mx=sum+pb[i];
			res=(prod*brr[i])%MOD;
		}
	}
	return res;
}

int init(int N, int X[], int Y[]) {
	n=N;
	forn(i, n){
		arr[i]=X[i];
		brr[i]=Y[i];
		pa[i]=log((ld)X[i]);
		pb[i]=log((ld)Y[i]);
	}
	return calc();
}

int updateX(int pos, int val) {	
	arr[pos]=val;
	pa[pos]=log(val);
	return calc();
}

int updateY(int pos, int val) {
	brr[pos]=val;
	pb[pos]=log(val);
	return calc();
}

Compilation message

horses.cpp: In function 'int calc()':
horses.cpp:24:9: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   24 |  return res;
      |         ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Incorrect 0 ms 212 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Incorrect 0 ms 212 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 11 ms 8404 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Incorrect 0 ms 212 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Incorrect 0 ms 212 KB Output isn't correct
13 Halted 0 ms 0 KB -