Submission #608800

#TimeUsernameProblemLanguageResultExecution timeMemory
608800Duy_eMonster Game (JOI21_monster)C++17
10 / 100
162 ms704 KiB
#include "monster.h"

using namespace std;

const long long N = 2e2 + 5;
int ans[N][N];
vector<int> Solve(int n) {

  	vector<int> T(n);
	
	int pos1 = 0, pos2 = 0;
    vector <int> p1, p2;

	for (int i = 0; i < n; i ++)
		for (int j = i + 1; j < n; j ++)
			ans[i][j] = Query(i, j), ans[j][i] = !ans[i][j];

	for (int i = 0; i < n; i ++) {
		for (int j = 0; j < n; j ++) 
			if (i != j) {
				T[i] += ans[i][j];
			}

		if (T[i] == 2) p1.push_back(i);
        if (T[i] == n - 3) p2.push_back(i);
    }

	for (int i = 0; i < n; i ++) {
        if (T[i] == 1) {
            T[i] = 0;
            for (int j: p1) if (ans[i][j]) T[i] = 1;
	    }

        if (T[i] == n - 2) {
            T[i] = n - 1;
            for (int j: p2) if (!ans[i][j]) T[i] = n - 2;
        }
    }

	return T;
}

Compilation message (stderr)

monster.cpp: In function 'std::vector<int> Solve(int)':
monster.cpp:11:6: warning: unused variable 'pos1' [-Wunused-variable]
   11 |  int pos1 = 0, pos2 = 0;
      |      ^~~~
monster.cpp:11:16: warning: unused variable 'pos2' [-Wunused-variable]
   11 |  int pos1 = 0, pos2 = 0;
      |                ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...