답안 #118980

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
118980 2019-06-20T06:52:56 Z Mahdi_Jfri 코알라 (APIO17_koala) C++14
37 / 100
88 ms 912 KB
#include "koala.h"
#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define pb push_back

const int maxn = 1e2 + 20;

int b[maxn] , r[maxn];
bool can[maxn];

int minValue(int n, int w)
{
	memset(b , 0 , sizeof b);
	b[0] = 1;

	playRound(b , r);
	if(r[0] != 2)
		return 0;

	for(int i = 1; i < n - 1; i++)
		if(!r[i])
			return i;
}

int maxValue(int n, int w)
{
	for(int i = 0; i < n; i++)
		can[i] = 1;

	int rem = n;
	while(rem > 1)
	{
		for(int i = 0; i < n; i++)
		{
			if(can[i])
				b[i] = w / rem;
			else
				b[i] = 0;
		}
		playRound(b , r);

		for(int i = 0; i < n; i++)
			if(can[i] && r[i] <= b[i])
				can[i] = 0 , rem--;
	}

	for(int i = 0; i < n; i++)
		if(can[i])
			return i;
}

int greaterValue(int n, int w)
{
	// p[0] < p[1]?

	int l = 1 , rx = 14;
	while(1)
	{
		memset(b , 0 , sizeof b);

		int m = (l + rx) / 2;
		b[0] = b[1] = m;
		playRound(b , r);

		if(b[0] < r[0] && b[1] < r[1])
		{
			l = m + 1;
			continue;
		}
		if(b[0] < r[0] && b[1] >= r[1])
			return 0;
		if(b[0] >= r[0] && b[1] < r[1])
			return 1;
		rx = m - 1;
	}
}

void allValues(int N, int W, int *P)
{
	if (W == 2*N)
	{
	}
	else
	{
	}
}

Compilation message

koala.cpp: In function 'int minValue(int, int)':
koala.cpp:26:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
koala.cpp: In function 'int maxValue(int, int)':
koala.cpp:53:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 380 KB Output is correct
2 Correct 15 ms 384 KB Output is correct
3 Correct 14 ms 420 KB Output is correct
4 Correct 14 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 43 ms 504 KB Output is correct
2 Correct 53 ms 384 KB Output is correct
3 Correct 43 ms 912 KB Output is correct
4 Correct 88 ms 760 KB Output is correct
5 Correct 44 ms 760 KB Output is correct
6 Correct 43 ms 760 KB Output is correct
7 Correct 44 ms 768 KB Output is correct
8 Correct 43 ms 768 KB Output is correct
9 Correct 44 ms 676 KB Output is correct
10 Correct 46 ms 760 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -