답안 #234254

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
234254 2020-05-23T14:28:25 Z dannber_BR 말 (IOI15_horses) C++14
0 / 100
1500 ms 9088 KB
#include "horses.h"
#include <bits/stdc++.h>

using namespace std;

const short HORSE = 0;
const short CASH = 1;
const long long MODUL = pow(10,9) + 7;

int actual_X[999999] = { };
int actual_Y[999999] = { };
int actual_N = 0;

int an_update(int horses,int X[],int Y[],int pos,int N)
{

	int maxY = 0;
	for(int i = 0;i < N;i++)
	{
		if(maxY < Y[i] && i == pos)
		{
			maxY = Y[i];
		}
	}
	if (maxY != Y[pos])
	{
		return 0;
	}
	else
	{
		int answ = ((horses - 1)* maxY) % MODUL;
		return answ;
	}
}

int init(int N, int X[], int Y[]) {
	int horses_cash[2] = {1,0};

	for(int i = 0;i < N;i++)
	{
		actual_X[i] = X[i];
		actual_Y[i] = Y[i];
	}
	actual_N = N;

	for(int i = 0;i < N;i++)
	{
		horses_cash[HORSE] *= X[i];
		if(horses_cash[HORSE] > 1)
		{
			int mmry = horses_cash[CASH];
			horses_cash[CASH] += an_update(horses_cash[HORSE],X,Y,i,N);
			if(horses_cash[CASH] != mmry)
			{
				horses_cash[HORSE] = 1;
			}
		}
	}
	return horses_cash[CASH];
}

int updateX(int pos, int val) {
  /*
	actual_X[pos] = val;

	int horses_cash[2] = {1,0};

	for(int i = 0;i < actual_N;i++)
	{
		horses_cash[HORSE] *= actual_X[i];
		if(horses_cash[HORSE] > 1)
		{
			int mmry = horses_cash[CASH];
			horses_cash[CASH] += an_update(horses_cash[HORSE],actual_X,actual_Y,i,actual_N);
			if(horses_cash[CASH] != mmry)
			{
				horses_cash[HORSE] = 1;
			}
		}
	}
    */
	return 0;
}

int updateY(int pos, int val) {
  /*
	actual_Y[pos] = val;

	int horses_cash[2] = {1,0};

	for(int i = 0;i < actual_N;i++)
	{
		horses_cash[HORSE] *= actual_X[i];
		if(horses_cash[HORSE] > 1)
		{
			int mmry = horses_cash[CASH];
			horses_cash[CASH] += an_update(horses_cash[HORSE],actual_X,actual_Y,i,actual_N);
			if(horses_cash[CASH] != mmry)
			{
				horses_cash[HORSE] = 1;
			}
		}
	}
    */
	return 0;
}

Compilation message

horses.cpp: In function 'int an_update(int, int*, int*, int, int)':
horses.cpp:14:32: warning: unused parameter 'X' [-Wunused-parameter]
 int an_update(int horses,int X[],int Y[],int pos,int N)
                                ^
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:62:17: warning: unused parameter 'pos' [-Wunused-parameter]
 int updateX(int pos, int val) {
                 ^~~
horses.cpp:62:26: warning: unused parameter 'val' [-Wunused-parameter]
 int updateX(int pos, int val) {
                          ^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:85:17: warning: unused parameter 'pos' [-Wunused-parameter]
 int updateY(int pos, int val) {
                 ^~~
horses.cpp:85:26: warning: unused parameter 'val' [-Wunused-parameter]
 int updateY(int pos, int val) {
                          ^~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1579 ms 9088 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -