Submission #676031

# Submission time Handle Problem Language Result Execution time Memory
676031 2022-12-29T00:52:34 Z Hacv16 Horses (IOI15_horses) C++17
0 / 100
15 ms 8308 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 = 0; 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 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 15 ms 8308 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -