Submission #65617

# Submission time Handle Problem Language Result Execution time Memory
65617 2018-08-08T09:20:25 Z daniel_02 Horses (IOI15_horses) C++17
17 / 100
1500 ms 8448 KB
#include "horses.h"
#include "bits/stdc++.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;
    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:35:18: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
     return (ans1 % MOD);
            ~~~~~~^~~~~~
horses.cpp:35:23: warning: 'ans1' may be used uninitialized in this function [-Wmaybe-uninitialized]
     return (ans1 % MOD);
                       ^
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 396 KB Output is correct
3 Correct 3 ms 416 KB Output is correct
4 Correct 3 ms 416 KB Output is correct
5 Correct 3 ms 468 KB Output is correct
6 Correct 3 ms 476 KB Output is correct
7 Correct 2 ms 496 KB Output is correct
8 Correct 0 ms 496 KB Output is correct
9 Correct 3 ms 496 KB Output is correct
10 Correct 3 ms 544 KB Output is correct
11 Correct 3 ms 544 KB Output is correct
12 Correct 6 ms 668 KB Output is correct
13 Correct 3 ms 668 KB Output is correct
14 Correct 2 ms 668 KB Output is correct
15 Correct 3 ms 668 KB Output is correct
16 Correct 1 ms 668 KB Output is correct
17 Correct 1 ms 668 KB Output is correct
18 Correct 2 ms 668 KB Output is correct
19 Correct 2 ms 668 KB Output is correct
20 Correct 3 ms 668 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 668 KB Output is correct
2 Correct 3 ms 668 KB Output is correct
3 Correct 4 ms 668 KB Output is correct
4 Correct 3 ms 668 KB Output is correct
5 Correct 4 ms 668 KB Output is correct
6 Correct 3 ms 740 KB Output is correct
7 Correct 3 ms 740 KB Output is correct
8 Correct 2 ms 740 KB Output is correct
9 Correct 3 ms 744 KB Output is correct
10 Correct 3 ms 744 KB Output is correct
11 Correct 3 ms 744 KB Output is correct
12 Correct 3 ms 744 KB Output is correct
13 Correct 3 ms 744 KB Output is correct
14 Correct 2 ms 744 KB Output is correct
15 Correct 3 ms 744 KB Output is correct
16 Correct 0 ms 744 KB Output is correct
17 Correct 3 ms 744 KB Output is correct
18 Correct 2 ms 744 KB Output is correct
19 Correct 4 ms 744 KB Output is correct
20 Correct 3 ms 744 KB Output is correct
21 Correct 3 ms 744 KB Output is correct
22 Correct 3 ms 744 KB Output is correct
23 Correct 86 ms 744 KB Output is correct
24 Correct 87 ms 744 KB Output is correct
25 Correct 162 ms 764 KB Output is correct
26 Correct 139 ms 764 KB Output is correct
27 Correct 53 ms 764 KB Output is correct
28 Correct 114 ms 764 KB Output is correct
29 Incorrect 37 ms 764 KB Output isn't correct
30 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1523 ms 8448 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 8448 KB Output is correct
2 Correct 3 ms 8448 KB Output is correct
3 Correct 3 ms 8448 KB Output is correct
4 Correct 2 ms 8448 KB Output is correct
5 Correct 4 ms 8448 KB Output is correct
6 Correct 3 ms 8448 KB Output is correct
7 Correct 3 ms 8448 KB Output is correct
8 Correct 5 ms 8448 KB Output is correct
9 Correct 2 ms 8448 KB Output is correct
10 Correct 2 ms 8448 KB Output is correct
11 Correct 3 ms 8448 KB Output is correct
12 Correct 3 ms 8448 KB Output is correct
13 Correct 3 ms 8448 KB Output is correct
14 Correct 3 ms 8448 KB Output is correct
15 Correct 2 ms 8448 KB Output is correct
16 Correct 3 ms 8448 KB Output is correct
17 Correct 2 ms 8448 KB Output is correct
18 Correct 2 ms 8448 KB Output is correct
19 Correct 3 ms 8448 KB Output is correct
20 Correct 3 ms 8448 KB Output is correct
21 Correct 4 ms 8448 KB Output is correct
22 Correct 3 ms 8448 KB Output is correct
23 Correct 91 ms 8448 KB Output is correct
24 Correct 80 ms 8448 KB Output is correct
25 Correct 143 ms 8448 KB Output is correct
26 Correct 133 ms 8448 KB Output is correct
27 Correct 56 ms 8448 KB Output is correct
28 Correct 115 ms 8448 KB Output is correct
29 Incorrect 44 ms 8448 KB Output isn't correct
30 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 8448 KB Output is correct
2 Correct 3 ms 8448 KB Output is correct
3 Correct 3 ms 8448 KB Output is correct
4 Correct 3 ms 8448 KB Output is correct
5 Correct 2 ms 8448 KB Output is correct
6 Correct 4 ms 8448 KB Output is correct
7 Correct 3 ms 8448 KB Output is correct
8 Correct 2 ms 8448 KB Output is correct
9 Correct 2 ms 8448 KB Output is correct
10 Correct 9 ms 8448 KB Output is correct
11 Correct 3 ms 8448 KB Output is correct
12 Correct 3 ms 8448 KB Output is correct
13 Correct 3 ms 8448 KB Output is correct
14 Correct 3 ms 8448 KB Output is correct
15 Correct 3 ms 8448 KB Output is correct
16 Correct 2 ms 8448 KB Output is correct
17 Correct 2 ms 8448 KB Output is correct
18 Correct 2 ms 8448 KB Output is correct
19 Correct 3 ms 8448 KB Output is correct
20 Correct 3 ms 8448 KB Output is correct
21 Correct 3 ms 8448 KB Output is correct
22 Correct 3 ms 8448 KB Output is correct
23 Correct 88 ms 8448 KB Output is correct
24 Correct 90 ms 8448 KB Output is correct
25 Correct 144 ms 8448 KB Output is correct
26 Correct 138 ms 8448 KB Output is correct
27 Correct 63 ms 8448 KB Output is correct
28 Correct 124 ms 8448 KB Output is correct
29 Incorrect 39 ms 8448 KB Output isn't correct
30 Halted 0 ms 0 KB -