제출 #800796

#제출 시각아이디문제언어결과실행 시간메모리
800796Liudas말 (IOI15_horses)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#include "horses.h"
using namespace std;
vector<long long> X, Y;
int init(int N, int XX[], int YY[]){
    int ans = 0;
    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;
    ans *= YY[id];
    for(int i = 0; i <= id; i ++){
        ans = ans * XX[i] % 1e9+7;
    }
    return ans;
}
int updateX(int pos, int val){
    return 0;
}
int updateY(int pos, int val){
    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:22:15: error: conflicting declaration 'long long int ans'
   22 |     long long ans = 1;
      |               ^~~
horses.cpp:6:9: note: previous declaration as 'int ans'
    6 |     int ans = 0;
      |         ^~~
horses.cpp:25:27: error: invalid operands of types 'int' and 'double' to binary 'operator%'
   25 |         ans = ans * XX[i] % 1e9+7;
      |               ~~~~~~~~~~~ ^ ~~~
      |                   |         |
      |                   int       double
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:29:17: warning: unused parameter 'pos' [-Wunused-parameter]
   29 | int updateX(int pos, int val){
      |             ~~~~^~~
horses.cpp:29:26: warning: unused parameter 'val' [-Wunused-parameter]
   29 | int updateX(int pos, int val){
      |                      ~~~~^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:32:17: warning: unused parameter 'pos' [-Wunused-parameter]
   32 | int updateY(int pos, int val){
      |             ~~~~^~~
horses.cpp:32:26: warning: unused parameter 'val' [-Wunused-parameter]
   32 | int updateY(int pos, int val){
      |                      ~~~~^~~