제출 #234972

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

#define ll long long int
#define pb push_back
#define mp make_pair
#define FOR(i,n) for(i=0;i<(n);++i)
#define FORe(i,n) for(i=1;i<=(n);++i)
#define FORr(i,a,b) for(i=(a);i<(b);++i)
#define FORrev(i,n) for(i=(n);i>=0;--i)
#define F0R(i,n) for(int i=0;i<(n);++i)
#define F0Re(i,n) for(int i=1;i<=(n);++i)
#define F0Rr(i,a,b) for(ll i=(a);i<(b);++i)
#define F0Rrev(i,n) for(int i=(n);i>=0;--i)
#define ii pair<ll,ll>
#define vi vector<ll>
#define vii vector<ii>
#define ff first 
#define ss second
#define cd complex<double>
#define vcd vector<cd>
#define ldd long double
#define dbgLine cout<<"Line : "<<__LINE__<<'\n'
#define all(x) (x).begin(),(x).end()

using namespace std;
/*
const short int __PRECISION = 10;

const ll MOD = 1e9+7;
const ll INF = 1e17 + 1101;
const ll LOGN = 17;
const ll MAXN = 2e5+5;
const ll ROOTN = 320;

const ldd PI = acos(-1);
const ldd EPS = 1e-7;
*/

#define MOD 1000000007

int L_init(int N, int* X, int* Y)
{
	ll dp[10][2000],prod = 1;
	F0R(i, N)	prod *= X[i];
	F0R(i, prod + 1)
		dp[0][i] = (i > X[0] ? -INF : (X[0]  - i)*Y[0]);
	F0Re(i, N-1)
		F0R(j, prod + 1)
		{
			dp[i][j] = -INF;
			F0R(k, prod + 1)
				if(Y[i]*1LL*(X[i]*k - j) >= 0LL)
					dp[i][j] = max(dp[i][j], dp[i-1][k] + Y[i]*1LL*(X[i]*k - j));
		}
	// F0R(i, N)
	// 	F0R(j, prod)
	// 		cout<<"dp["<<i<<"]["<<j<<"] = "<<dp[i][j]<<'\n';
	return dp[N-1][0];
}


int init(int N, int* X, int* Y)
{
	ll amt = 0, prod = 1;
	F0R(i, N)
	{
		prod *= X[i];
		amt = max(amt, prod*Y[i]);
	}
	return amt%MOD;
}

int updateX(int pos, int val){return 0;}
int updateY(int pos, int val){return 0;}
/*
int main()
{
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	

	int N, X[10], Y[10];
	cin>>N;
	F0R(i, N)
		cin>>X[i];
	F0R(i, N)	
		cin>>Y[i];
	cout<<init(N, X, Y);
	return 0;
}*/

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

horses.cpp: In function 'int L_init(int, int*, int*)':
horses.cpp:46:27: error: 'INF' was not declared in this scope
   dp[0][i] = (i > X[0] ? -INF : (X[0]  - i)*Y[0]);
                           ^~~
horses.cpp:46:27: note: suggested alternative: 'SING'
   dp[0][i] = (i > X[0] ? -INF : (X[0]  - i)*Y[0]);
                           ^~~
                           SING
horses.cpp:50:16: error: 'INF' was not declared in this scope
    dp[i][j] = -INF;
                ^~~
horses.cpp:50:16: note: suggested alternative: 'SING'
    dp[i][j] = -INF;
                ^~~
                SING
horses.cpp:58:18: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
  return dp[N-1][0];
         ~~~~~~~~~^
horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:70:12: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
  return amt%MOD;
            ^
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:73:17: warning: unused parameter 'pos' [-Wunused-parameter]
 int updateX(int pos, int val){return 0;}
                 ^~~
horses.cpp:73:26: warning: unused parameter 'val' [-Wunused-parameter]
 int updateX(int pos, int val){return 0;}
                          ^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:74:17: warning: unused parameter 'pos' [-Wunused-parameter]
 int updateY(int pos, int val){return 0;}
                 ^~~
horses.cpp:74:26: warning: unused parameter 'val' [-Wunused-parameter]
 int updateY(int pos, int val){return 0;}
                          ^~~