답안 #876049

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
876049 2023-11-21T07:19:14 Z Elvin_Fritl 말 (IOI15_horses) C++17
34 / 100
26 ms 21844 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

const int N = 1e5 + 545 , inf = 1e9 + 199 , mod = 1e9 + 7;

     #include "horses.h"
 
ll n , x[N] , y[N];
long double xlog[N] , ylog[N];
 
int calc(){
    long double curr = 1 , mx = 0;
    ll ind=0;
    for(int i=0;i<n;i++){
        curr += xlog[i];
        if(mx < curr + ylog[i]){
            mx = curr + ylog[i];
            ind = i;
        }
    }
    
    ll res=1;
    for(int i=0;i<=ind;i++){
        res *= x[i];
        res %= mod;
    }
    return (res*y[ind])%mod;
}
 
int init(int nn,int X[],int Y[]){
    n=nn;
    for(int i=0;i<n;i++){
        x[i]=X[i];
        xlog[i] = log(x[i]);
        y[i]=Y[i];
        ylog[i] = log(y[i]);
    }
    return calc();
}
 
int updateX(int pos,int val){
    x[pos]=val;
    xlog[pos] = log(x[pos]);
    return calc();
}
 
int updateY(int pos,int val){
    y[pos]=val;
    ylog[pos] = log(y[pos]);
    return calc();
}

Compilation message

horses.cpp: In function 'int calc()':
horses.cpp:29:24: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   29 |     return (res*y[ind])%mod;
      |            ~~~~~~~~~~~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 1 ms 4604 KB Output is correct
3 Correct 1 ms 4440 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4700 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 1 ms 4440 KB Output is correct
13 Correct 1 ms 4440 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
16 Correct 1 ms 4444 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 1 ms 4440 KB Output is correct
19 Correct 1 ms 4448 KB Output is correct
20 Correct 1 ms 4700 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4596 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4440 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4440 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 1 ms 4440 KB Output is correct
16 Correct 1 ms 4444 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 1 ms 4444 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 1 ms 4440 KB Output is correct
21 Correct 1 ms 4444 KB Output is correct
22 Correct 1 ms 4444 KB Output is correct
23 Correct 8 ms 4696 KB Output is correct
24 Correct 8 ms 4444 KB Output is correct
25 Correct 9 ms 4444 KB Output is correct
26 Correct 9 ms 4444 KB Output is correct
27 Correct 9 ms 4444 KB Output is correct
28 Correct 9 ms 4444 KB Output is correct
29 Correct 6 ms 4444 KB Output is correct
30 Correct 9 ms 4444 KB Output is correct
31 Correct 5 ms 4444 KB Output is correct
32 Correct 6 ms 4588 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 17 ms 18012 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4440 KB Output is correct
7 Correct 1 ms 4440 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4444 KB Output is correct
14 Correct 1 ms 4452 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
16 Correct 1 ms 4444 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 1 ms 4700 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 1 ms 4444 KB Output is correct
21 Correct 1 ms 4444 KB Output is correct
22 Correct 1 ms 4444 KB Output is correct
23 Correct 8 ms 4444 KB Output is correct
24 Correct 8 ms 4596 KB Output is correct
25 Correct 8 ms 4444 KB Output is correct
26 Correct 8 ms 4696 KB Output is correct
27 Correct 9 ms 4440 KB Output is correct
28 Correct 11 ms 4444 KB Output is correct
29 Correct 7 ms 4440 KB Output is correct
30 Correct 8 ms 4600 KB Output is correct
31 Correct 5 ms 4444 KB Output is correct
32 Correct 6 ms 4444 KB Output is correct
33 Runtime error 26 ms 21844 KB Execution killed with signal 11
34 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4456 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4440 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4440 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4444 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 1 ms 4544 KB Output is correct
16 Correct 1 ms 4444 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 1 ms 4444 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 1 ms 4444 KB Output is correct
21 Correct 1 ms 4444 KB Output is correct
22 Correct 1 ms 4444 KB Output is correct
23 Correct 8 ms 4444 KB Output is correct
24 Correct 8 ms 4556 KB Output is correct
25 Correct 8 ms 4444 KB Output is correct
26 Correct 8 ms 4444 KB Output is correct
27 Correct 8 ms 4488 KB Output is correct
28 Correct 8 ms 4444 KB Output is correct
29 Correct 6 ms 4444 KB Output is correct
30 Correct 7 ms 4444 KB Output is correct
31 Correct 5 ms 4444 KB Output is correct
32 Correct 6 ms 4444 KB Output is correct
33 Runtime error 19 ms 20052 KB Execution killed with signal 11
34 Halted 0 ms 0 KB -