Submission #800797

#TimeUsernameProblemLanguageResultExecution timeMemory
800797LiudasHorses (IOI15_horses)C++17
17 / 100
32 ms12448 KiB
#include <bits/stdc++.h>
#include "horses.h"
using namespace std;
vector<long long> X, Y;
int init(int N, int XX[], int YY[]){
    X.resize(N);
    Y.resize(N);
    for(int i = 0; i < N; i ++){
        X[i] = XX[i];
        Y[i] = YY[i];
    }
    double a = 0, t = 0;
    int id = 0;
    for(int i = 0; i < N; i ++){
        t += log(XX[i]);
        if(t + log(YY[i]) > a){
            a = t + log(YY[i]);
            id = i;
        }
    }
    long long ans = 1, MOD = 1e9 + 7;
    ans *= YY[id];
    for(int i = 0; i <= id; i ++){
        ans = ans * XX[i] % MOD;
    }
    return ans;
}
int updateX(int pos, int val){
    return 0;
}
int updateY(int pos, int val){
    return 0;
}

Compilation message (stderr)

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:26:12: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   26 |     return ans;
      |            ^~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:28:17: warning: unused parameter 'pos' [-Wunused-parameter]
   28 | int updateX(int pos, int val){
      |             ~~~~^~~
horses.cpp:28:26: warning: unused parameter 'val' [-Wunused-parameter]
   28 | int updateX(int pos, int val){
      |                      ~~~~^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:31:17: warning: unused parameter 'pos' [-Wunused-parameter]
   31 | int updateY(int pos, int val){
      |             ~~~~^~~
horses.cpp:31:26: warning: unused parameter 'val' [-Wunused-parameter]
   31 | int updateY(int pos, int val){
      |                      ~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...