Submission #66014

# Submission time Handle Problem Language Result Execution time Memory
66014 2018-08-09T11:14:26 Z daniel_02 Horses (IOI15_horses) C++17
34 / 100
1500 ms 8508 KB
#include <iostream>
#include <horses.h>
#include <cmath>
#include <stdio.h>

#define ll long long

using namespace std;

const int MOD = 1e9 + 7;
const int sz = 5e5 + 7;

int n, x[sz], y[sz];

int init(int N, int X[], int Y[]) {

    double h = 0;
    ll cur = 1;
    double ans = 0;
    ll ans1 = 1;
    n = N;

    for (int i = 0; i < N; i++)
    {
        x[i] = X[i];
        y[i] = Y[i];

        h += log10(x[i]);
        cur = (cur * x[i]) % MOD;
        if (ans * 1.0 < h + log10(y[i]))
        {
            ans = log10(y[i]) + h;
            ans1 = (y[i] * 1LL * cur) % MOD;
        }
    }

    return (ans1 % MOD);
}

int updateX(int pos, int val) {
    x[pos] = val;
    return init(n, x, y);
}

int updateY(int pos, int val) {
    y[pos] = val;
    return init(n, x, y);
}

Compilation message

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:37:18: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
     return (ans1 % MOD);
            ~~~~~~^~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 2 ms 408 KB Output is correct
4 Correct 2 ms 460 KB Output is correct
5 Correct 3 ms 468 KB Output is correct
6 Correct 2 ms 476 KB Output is correct
7 Correct 2 ms 476 KB Output is correct
8 Correct 2 ms 484 KB Output is correct
9 Correct 2 ms 484 KB Output is correct
10 Correct 2 ms 484 KB Output is correct
11 Correct 2 ms 484 KB Output is correct
12 Correct 2 ms 484 KB Output is correct
13 Correct 2 ms 672 KB Output is correct
14 Correct 2 ms 672 KB Output is correct
15 Correct 2 ms 672 KB Output is correct
16 Correct 2 ms 672 KB Output is correct
17 Correct 2 ms 672 KB Output is correct
18 Correct 2 ms 672 KB Output is correct
19 Correct 3 ms 672 KB Output is correct
20 Correct 2 ms 672 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 672 KB Output is correct
2 Correct 2 ms 672 KB Output is correct
3 Correct 3 ms 672 KB Output is correct
4 Correct 2 ms 672 KB Output is correct
5 Correct 2 ms 672 KB Output is correct
6 Correct 2 ms 672 KB Output is correct
7 Correct 2 ms 672 KB Output is correct
8 Correct 2 ms 672 KB Output is correct
9 Correct 2 ms 672 KB Output is correct
10 Correct 2 ms 672 KB Output is correct
11 Correct 2 ms 672 KB Output is correct
12 Correct 2 ms 672 KB Output is correct
13 Correct 4 ms 672 KB Output is correct
14 Correct 2 ms 672 KB Output is correct
15 Correct 2 ms 672 KB Output is correct
16 Correct 2 ms 672 KB Output is correct
17 Correct 2 ms 672 KB Output is correct
18 Correct 2 ms 672 KB Output is correct
19 Correct 3 ms 672 KB Output is correct
20 Correct 2 ms 672 KB Output is correct
21 Correct 2 ms 672 KB Output is correct
22 Correct 2 ms 672 KB Output is correct
23 Correct 74 ms 672 KB Output is correct
24 Correct 74 ms 764 KB Output is correct
25 Correct 104 ms 764 KB Output is correct
26 Correct 118 ms 800 KB Output is correct
27 Correct 38 ms 800 KB Output is correct
28 Correct 94 ms 800 KB Output is correct
29 Correct 36 ms 800 KB Output is correct
30 Correct 51 ms 800 KB Output is correct
31 Correct 30 ms 800 KB Output is correct
32 Correct 52 ms 800 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1557 ms 8508 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 8508 KB Output is correct
2 Correct 2 ms 8508 KB Output is correct
3 Correct 2 ms 8508 KB Output is correct
4 Correct 2 ms 8508 KB Output is correct
5 Correct 2 ms 8508 KB Output is correct
6 Correct 2 ms 8508 KB Output is correct
7 Correct 3 ms 8508 KB Output is correct
8 Correct 2 ms 8508 KB Output is correct
9 Correct 2 ms 8508 KB Output is correct
10 Correct 2 ms 8508 KB Output is correct
11 Correct 2 ms 8508 KB Output is correct
12 Correct 2 ms 8508 KB Output is correct
13 Correct 3 ms 8508 KB Output is correct
14 Correct 3 ms 8508 KB Output is correct
15 Correct 2 ms 8508 KB Output is correct
16 Correct 2 ms 8508 KB Output is correct
17 Correct 2 ms 8508 KB Output is correct
18 Correct 2 ms 8508 KB Output is correct
19 Correct 2 ms 8508 KB Output is correct
20 Correct 2 ms 8508 KB Output is correct
21 Correct 3 ms 8508 KB Output is correct
22 Correct 2 ms 8508 KB Output is correct
23 Correct 72 ms 8508 KB Output is correct
24 Correct 101 ms 8508 KB Output is correct
25 Correct 116 ms 8508 KB Output is correct
26 Correct 130 ms 8508 KB Output is correct
27 Correct 42 ms 8508 KB Output is correct
28 Correct 100 ms 8508 KB Output is correct
29 Correct 28 ms 8508 KB Output is correct
30 Correct 53 ms 8508 KB Output is correct
31 Correct 33 ms 8508 KB Output is correct
32 Correct 28 ms 8508 KB Output is correct
33 Execution timed out 1586 ms 8508 KB Time limit exceeded
34 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 8508 KB Output is correct
2 Correct 3 ms 8508 KB Output is correct
3 Correct 2 ms 8508 KB Output is correct
4 Correct 3 ms 8508 KB Output is correct
5 Correct 2 ms 8508 KB Output is correct
6 Correct 3 ms 8508 KB Output is correct
7 Correct 3 ms 8508 KB Output is correct
8 Correct 3 ms 8508 KB Output is correct
9 Correct 3 ms 8508 KB Output is correct
10 Correct 3 ms 8508 KB Output is correct
11 Correct 3 ms 8508 KB Output is correct
12 Correct 2 ms 8508 KB Output is correct
13 Correct 2 ms 8508 KB Output is correct
14 Correct 3 ms 8508 KB Output is correct
15 Correct 3 ms 8508 KB Output is correct
16 Correct 3 ms 8508 KB Output is correct
17 Correct 2 ms 8508 KB Output is correct
18 Correct 2 ms 8508 KB Output is correct
19 Correct 2 ms 8508 KB Output is correct
20 Correct 3 ms 8508 KB Output is correct
21 Correct 2 ms 8508 KB Output is correct
22 Correct 3 ms 8508 KB Output is correct
23 Correct 70 ms 8508 KB Output is correct
24 Correct 74 ms 8508 KB Output is correct
25 Correct 106 ms 8508 KB Output is correct
26 Correct 117 ms 8508 KB Output is correct
27 Correct 40 ms 8508 KB Output is correct
28 Correct 95 ms 8508 KB Output is correct
29 Correct 29 ms 8508 KB Output is correct
30 Correct 49 ms 8508 KB Output is correct
31 Correct 29 ms 8508 KB Output is correct
32 Correct 28 ms 8508 KB Output is correct
33 Execution timed out 1574 ms 8508 KB Time limit exceeded
34 Halted 0 ms 0 KB -