Submission #676032

# Submission time Handle Problem Language Result Execution time Memory
676032 2022-12-29T00:53:54 Z Hacv16 Horses (IOI15_horses) C++17
34 / 100
22 ms 12408 KB
#include <bits/stdc++.h>
using namespace std;
 
#define fr first
#define sc second
 
typedef long long ll;
const int MAX = 1010;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
 
int n, x[MAX], y[MAX];

int getAnswer(){
    ll h = 1, l = 0, p = 1, resp = 0; 

    for(int i = 1; i <= n; i++) {
        h *= x[i]; 
        p = (p * x[i] % MOD);

        long double aux = y[i] * h;

        if(aux > (long double) l){
            resp = (p * y[i]) % MOD;
            h = 1, l = y[i];
        }
    }

    resp %= MOD;

    return (int) resp; 
}

int init(int _n, int _x[], int _y[]){
    n = _n; 
 
    for(int i = 1; i <= n; i++)
        x[i] = _x[i - 1], y[i] = _y[i - 1];
 
    return getAnswer();
}
 
int updateX(int pos, int val){
    x[pos + 1] = val;
    return getAnswer();
}
 
int updateY(int pos, int val){
    y[pos + 1] = val;
    return getAnswer();
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 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 1 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 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 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 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 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 6 ms 312 KB Output is correct
24 Correct 6 ms 340 KB Output is correct
25 Correct 6 ms 312 KB Output is correct
26 Correct 6 ms 340 KB Output is correct
27 Correct 6 ms 312 KB Output is correct
28 Correct 6 ms 340 KB Output is correct
29 Correct 6 ms 328 KB Output is correct
30 Correct 6 ms 340 KB Output is correct
31 Correct 6 ms 340 KB Output is correct
32 Correct 6 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 13 ms 8340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 5 ms 340 KB Output is correct
24 Correct 6 ms 340 KB Output is correct
25 Correct 6 ms 340 KB Output is correct
26 Correct 6 ms 316 KB Output is correct
27 Correct 6 ms 340 KB Output is correct
28 Correct 6 ms 340 KB Output is correct
29 Correct 5 ms 312 KB Output is correct
30 Correct 7 ms 340 KB Output is correct
31 Correct 6 ms 340 KB Output is correct
32 Correct 6 ms 320 KB Output is correct
33 Runtime error 22 ms 12408 KB Execution killed with signal 11
34 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 288 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 1 ms 300 KB Output is correct
23 Correct 6 ms 340 KB Output is correct
24 Correct 5 ms 340 KB Output is correct
25 Correct 6 ms 340 KB Output is correct
26 Correct 7 ms 340 KB Output is correct
27 Correct 6 ms 340 KB Output is correct
28 Correct 7 ms 316 KB Output is correct
29 Correct 5 ms 304 KB Output is correct
30 Correct 6 ms 340 KB Output is correct
31 Correct 6 ms 340 KB Output is correct
32 Correct 6 ms 340 KB Output is correct
33 Runtime error 18 ms 10488 KB Execution killed with signal 11
34 Halted 0 ms 0 KB -