답안 #620817

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
620817 2022-08-03T09:30:03 Z A_D 말 (IOI15_horses) C++14
컴파일 오류
0 ms 0 KB
#include "horses.h"

#include <bits/stdc++.h>

using namespace std;

const int N=1e3+100;
long long x[N];
long long y[N];
const long long MOD=1e9+7;
int init(int N, int X[], int Y[]){
    long long ret=0;
    long long sum=1;

    for(int i=0;i<N;i++){
        sum*=X[i];
        if(sum*Y[i]>ret){
            sum%=MOD;
            ret=sum*y[i];
        }
    }

    return ret;

}

int updateX(int pos, int val) {
	x[pos]=val;


	long long ret=0;
    long long sum=1;

    for(int i=0;i<N;i++){
        sum*=X[i];
        if(sum*Y[i]>ret){
            sum%=MOD;
            ret=sum*y[i];
        }
    }

    return ret;

}

int updateY(int pos, int val) {
	y[pos]=val;


	long long ret=0;
    long long sum=1;

    for(int i=0;i<N;i++){
        sum*=X[i];
        if(sum*Y[i]>ret){
            sum%=MOD;
            ret=sum*y[i];
        }
    }

    return ret;

}

Compilation message

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:11:14: warning: declaration of 'N' shadows a global declaration [-Wshadow]
   11 | int init(int N, int X[], int Y[]){
      |          ~~~~^
horses.cpp:7:11: note: shadowed declaration is here
    7 | const int N=1e3+100;
      |           ^
horses.cpp:23:12: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   23 |     return ret;
      |            ^~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:35:14: error: 'X' was not declared in this scope
   35 |         sum*=X[i];
      |              ^
horses.cpp:36:16: error: 'Y' was not declared in this scope
   36 |         if(sum*Y[i]>ret){
      |                ^
horses.cpp:42:12: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   42 |     return ret;
      |            ^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:54:14: error: 'X' was not declared in this scope
   54 |         sum*=X[i];
      |              ^
horses.cpp:55:16: error: 'Y' was not declared in this scope
   55 |         if(sum*Y[i]>ret){
      |                ^
horses.cpp:61:12: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   61 |     return ret;
      |            ^~~