Submission #97225

# Submission time Handle Problem Language Result Execution time Memory
97225 2019-02-14T13:23:50 Z E869120 Koala Game (APIO17_koala) C++14
37 / 100
81 ms 888 KB
#include "koala.h"
#include <iostream>
#include <vector>
using namespace std;

int D[109], R[109];

void preset() {
	for (int i = 0; i < 109; i++) { D[i] = 0; R[i] = 0; }
}

int minValue(int N, int W) {
	preset(); D[0] = 1;
	playRound(D, R);
	for (int i = 0; i < N; i++) {
		if (D[i] >= R[i]) return i;
	}
	return -1;
}

int maxValue(int N, int W) {
	int P[4] = { 1, 2, 4, 11 };
	vector<int>I; for (int i = 0; i < N; i++) I.push_back(i);
	for (int i = 0; i < 4; i++) {
		preset();
		for (int j = 0; j < I.size(); j++) D[I[j]] = P[i];
		playRound(D, R);
		vector<int>II; for (int j = 0; j < I.size(); j++) { if (D[I[j]] < R[I[j]]) II.push_back(I[j]); }
		I = II;
	}
	return I[0];
}

int solve_3(int N, int W, int P) {
	preset();
	D[0] = P; D[1] = P;
	playRound(D, R);
	int v1 = 0; if (D[0] < R[0]) v1 = 1;
	int v2 = 0; if (D[1] < R[1]) v2 = 2;
	return v1 + v2;
}

int greaterValue(int N, int W) {
	int G = solve_3(N, W, 6);
	if (G == 1 || G == 2) return G - 1;

	if (G == 0) {
		int G1 = solve_3(N, W, 1); if (G1 == 1 || G1 == 2) return G1 - 1;
		int G2 = solve_3(N, W, 3); if (G2 == 1 || G2 == 2) return G2 - 1;
		return -1;
	}
	if (G == 3) {
		int G1 = solve_3(N, W, 9); if (G1 == 1 || G1 == 2) return G1 - 1;
		return -1;
	}
	return -1;
}

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

Compilation message

koala.cpp: In function 'int maxValue(int, int)':
koala.cpp:26:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int j = 0; j < I.size(); j++) D[I[j]] = P[i];
                   ~~^~~~~~~~~~
koala.cpp:28:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   vector<int>II; for (int j = 0; j < I.size(); j++) { if (D[I[j]] < R[I[j]]) II.push_back(I[j]); }
                                  ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 10 ms 512 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 9 ms 384 KB Output is correct
4 Correct 9 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 384 KB Output is correct
2 Correct 14 ms 412 KB Output is correct
3 Correct 20 ms 384 KB Output is correct
4 Correct 17 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 76 ms 760 KB Output is correct
2 Correct 78 ms 756 KB Output is correct
3 Correct 59 ms 888 KB Output is correct
4 Correct 70 ms 764 KB Output is correct
5 Correct 53 ms 768 KB Output is correct
6 Correct 58 ms 752 KB Output is correct
7 Correct 63 ms 760 KB Output is correct
8 Correct 50 ms 760 KB Output is correct
9 Correct 81 ms 760 KB Output is correct
10 Correct 79 ms 760 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -