제출 #109093

#제출 시각아이디문제언어결과실행 시간메모리
109093Garu말 (IOI15_horses)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>

using namespace std;
const int MOD = 1e9 + 7;
typedef long long ll;
int updateX(int pos,int val)
{
X[pos] = val;
ll ans = 0;
ll profit = 0;
ll horses = 1;

for(int i = 0 ; i < n ; i++)
{
	horses*=X[i];
	horses%=MOD;
	profit = (horses % MOD * y[i] % MOD) % MOD;
	ans = max(ans , profit);
}

return ans;


}

int updateY(int pos,int val)
{

Y[pos] = val;

ll ans = 0;
ll profit = 0;
ll horses = 1;

for(int i = 0 ; i < n ; i++)
{
	horses*=X[i];
	horses%=MOD;
	profit = (horses % MOD * y[i] % MOD) % MOD;
	ans = max(ans , profit);
}

return ans;

}

int init(int N , int X[] , int Y[])
{

ll ans = 0;
ll profit = 0;
ll horses = 1;

for(int i = 0 ; i < n ; i++)
{
	horses*=X[i];
	horses%=MOD;
	profit = (horses % MOD * y[i] % MOD) % MOD;
	ans = max(ans , profit);
}

return ans;

}

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

horses.cpp: In function 'int updateX(int, int)':
horses.cpp:8:1: error: 'X' was not declared in this scope
 X[pos] = val;
 ^
horses.cpp:13:21: error: 'n' was not declared in this scope
 for(int i = 0 ; i < n ; i++)
                     ^
horses.cpp:17:27: error: 'y' was not declared in this scope
  profit = (horses % MOD * y[i] % MOD) % MOD;
                           ^
horses.cpp:21:8: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
 return ans;
        ^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:29:1: error: 'Y' was not declared in this scope
 Y[pos] = val;
 ^
horses.cpp:35:21: error: 'n' was not declared in this scope
 for(int i = 0 ; i < n ; i++)
                     ^
horses.cpp:37:10: error: 'X' was not declared in this scope
  horses*=X[i];
          ^
horses.cpp:39:27: error: 'y' was not declared in this scope
  profit = (horses % MOD * y[i] % MOD) % MOD;
                           ^
horses.cpp:43:8: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
 return ans;
        ^~~
horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:54:21: error: 'n' was not declared in this scope
 for(int i = 0 ; i < n ; i++)
                     ^
horses.cpp:58:27: error: 'y' was not declared in this scope
  profit = (horses % MOD * y[i] % MOD) % MOD;
                           ^
horses.cpp:62:8: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
 return ans;
        ^~~
horses.cpp:47:14: warning: unused parameter 'N' [-Wunused-parameter]
 int init(int N , int X[] , int Y[])
              ^
horses.cpp:47:34: warning: unused parameter 'Y' [-Wunused-parameter]
 int init(int N , int X[] , int Y[])
                                  ^