Submission #866323

# Submission time Handle Problem Language Result Execution time Memory
866323 2023-10-25T21:15:41 Z JakobZorz Horses (IOI15_horses) C++14
34 / 100
1500 ms 27852 KB
#include<iostream>
#include<math.h>
#include"horses.h"
using namespace std;
typedef long long ll;
typedef long double ld;
const int MOD=(int)1e9+7;

int n;
int x[500000];
ld xlog[500000];
int y[500000];
ld ylog[500000];

int calc(){
    ld curr=1;
    ld mx=0;
    int maxi=0;
    for(int i=0;i<n;i++){
        curr+=xlog[i];
        if(mx<curr+ylog[i]){
            mx=curr+ylog[i];
            maxi=i;
        }
    }
    
    ll res=1;
    for(int i=0;i<=maxi;i++){
        res*=x[i];
        res%=MOD;
    }
    return res*y[maxi]%MOD;
}

int init(int N,int X[],int Y[]){
    n=N;
    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:32:23: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   32 |     return res*y[maxi]%MOD;
      |            ~~~~~~~~~~~^~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 1 ms 6492 KB Output is correct
4 Correct 1 ms 6488 KB Output is correct
5 Correct 1 ms 6492 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Correct 1 ms 6488 KB Output is correct
8 Correct 1 ms 6492 KB Output is correct
9 Correct 1 ms 6492 KB Output is correct
10 Correct 1 ms 6492 KB Output is correct
11 Correct 1 ms 6492 KB Output is correct
12 Correct 1 ms 6488 KB Output is correct
13 Correct 1 ms 6492 KB Output is correct
14 Correct 1 ms 6492 KB Output is correct
15 Correct 1 ms 6492 KB Output is correct
16 Correct 1 ms 6492 KB Output is correct
17 Correct 1 ms 6492 KB Output is correct
18 Correct 1 ms 6492 KB Output is correct
19 Correct 1 ms 6492 KB Output is correct
20 Correct 1 ms 6492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6488 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 1 ms 6488 KB Output is correct
4 Correct 1 ms 6488 KB Output is correct
5 Correct 1 ms 6492 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Correct 1 ms 6492 KB Output is correct
8 Correct 1 ms 6488 KB Output is correct
9 Correct 1 ms 6492 KB Output is correct
10 Correct 1 ms 6488 KB Output is correct
11 Correct 1 ms 6492 KB Output is correct
12 Correct 1 ms 6492 KB Output is correct
13 Correct 1 ms 6492 KB Output is correct
14 Correct 1 ms 6492 KB Output is correct
15 Correct 1 ms 6492 KB Output is correct
16 Correct 1 ms 6492 KB Output is correct
17 Correct 1 ms 6744 KB Output is correct
18 Correct 1 ms 6492 KB Output is correct
19 Correct 1 ms 6492 KB Output is correct
20 Correct 1 ms 6492 KB Output is correct
21 Correct 1 ms 6492 KB Output is correct
22 Correct 1 ms 6492 KB Output is correct
23 Correct 8 ms 6492 KB Output is correct
24 Correct 8 ms 6492 KB Output is correct
25 Correct 9 ms 6744 KB Output is correct
26 Correct 9 ms 6488 KB Output is correct
27 Correct 8 ms 6492 KB Output is correct
28 Correct 9 ms 6648 KB Output is correct
29 Correct 6 ms 6488 KB Output is correct
30 Correct 8 ms 6492 KB Output is correct
31 Correct 5 ms 6492 KB Output is correct
32 Correct 6 ms 6492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1567 ms 23900 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6488 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 1 ms 6740 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 6596 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Correct 1 ms 6492 KB Output is correct
8 Correct 1 ms 6488 KB Output is correct
9 Correct 1 ms 6492 KB Output is correct
10 Correct 1 ms 6492 KB Output is correct
11 Correct 1 ms 6492 KB Output is correct
12 Correct 1 ms 6492 KB Output is correct
13 Correct 1 ms 6492 KB Output is correct
14 Correct 1 ms 6568 KB Output is correct
15 Correct 1 ms 6492 KB Output is correct
16 Correct 1 ms 6492 KB Output is correct
17 Correct 1 ms 6488 KB Output is correct
18 Correct 1 ms 6492 KB Output is correct
19 Correct 1 ms 6492 KB Output is correct
20 Correct 1 ms 6492 KB Output is correct
21 Correct 1 ms 6492 KB Output is correct
22 Correct 1 ms 6492 KB Output is correct
23 Correct 8 ms 6648 KB Output is correct
24 Correct 9 ms 6652 KB Output is correct
25 Correct 9 ms 6488 KB Output is correct
26 Correct 9 ms 6492 KB Output is correct
27 Correct 8 ms 6492 KB Output is correct
28 Correct 10 ms 6492 KB Output is correct
29 Correct 7 ms 6492 KB Output is correct
30 Correct 7 ms 6644 KB Output is correct
31 Correct 5 ms 6488 KB Output is correct
32 Correct 6 ms 6648 KB Output is correct
33 Execution timed out 1530 ms 27852 KB Time limit exceeded
34 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 1 ms 6492 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 6592 KB Output is correct
6 Correct 1 ms 6596 KB Output is correct
7 Correct 1 ms 6492 KB Output is correct
8 Correct 1 ms 6488 KB Output is correct
9 Correct 1 ms 6488 KB Output is correct
10 Correct 1 ms 6492 KB Output is correct
11 Correct 1 ms 6488 KB Output is correct
12 Correct 1 ms 6488 KB Output is correct
13 Correct 1 ms 6492 KB Output is correct
14 Correct 1 ms 6492 KB Output is correct
15 Correct 1 ms 6492 KB Output is correct
16 Correct 1 ms 6492 KB Output is correct
17 Correct 1 ms 6540 KB Output is correct
18 Correct 1 ms 6492 KB Output is correct
19 Correct 1 ms 6492 KB Output is correct
20 Correct 1 ms 6492 KB Output is correct
21 Correct 1 ms 6492 KB Output is correct
22 Correct 1 ms 6492 KB Output is correct
23 Correct 9 ms 6492 KB Output is correct
24 Correct 8 ms 6492 KB Output is correct
25 Correct 8 ms 6660 KB Output is correct
26 Correct 9 ms 6492 KB Output is correct
27 Correct 8 ms 6496 KB Output is correct
28 Correct 9 ms 6492 KB Output is correct
29 Correct 6 ms 6492 KB Output is correct
30 Correct 8 ms 6492 KB Output is correct
31 Correct 5 ms 6600 KB Output is correct
32 Correct 6 ms 6492 KB Output is correct
33 Execution timed out 1578 ms 26076 KB Time limit exceeded
34 Halted 0 ms 0 KB -