Submission #540121

#TimeUsernameProblemLanguageResultExecution timeMemory
540121rk42745417Monster Game (JOI21_monster)C++17
10 / 100
184 ms300 KiB
#include "monster.h"
#include <bits/stdc++.h>
using namespace std;

#define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(0);
using ll = int64_t;
using ull = uint64_t;
using uint = uint32_t;
using ld = long double;
const int INF = 0x3f3f3f3f;
const ll LINF = ll(4e18) + ll(2e15);
const int MOD = 1e9 + 7;
const double EPS = 1e-9;

namespace {

bool example_variable;

}  // namespace

vector<int> Solve(int n) {
	vector<int> cnt(n);
	for(int i = 0; i < n; i++)
		for(int j = i + 1; j < n; j++) {
			if(Query(i, j))
				cnt[i]++;
			else
				cnt[j]++;
		}
	vector<int> ans(n);
	for(int i = 0; i < n; i++) {
		if(cnt[i] == 1 || cnt[i] == n - 2)
			continue;
		ans[i] = cnt[i];
	}

	{
		int a = -1, b;
		for(int i = 0; i < n; i++) {
			if(cnt[i] == 1) {
				if(~a)
					b = i;
				else
					a = i;
			}
		}
		if(Query(a, b))
			ans[a] = 0, ans[b] = 1;
		else
			ans[a] = 1, ans[b] = 0;
	}
	{
		int a = -1, b;
		for(int i = 0; i < n; i++) {
			if(cnt[i] == n - 2) {
				if(~a)
					b = i;
				else
					a = i;
			}
		}
		if(Query(a, b))
			ans[a] = n - 2, ans[b] = n - 1;
		else
			ans[a] = n - 1, ans[b] = n - 2;
	}
	return ans;
}

Compilation message (stderr)

monster.cpp:17:6: warning: '{anonymous}::example_variable' defined but not used [-Wunused-variable]
   17 | bool example_variable;
      |      ^~~~~~~~~~~~~~~~
monster.cpp: In function 'std::vector<int> Solve(int)':
monster.cpp:62:11: warning: 'b' may be used uninitialized in this function [-Wmaybe-uninitialized]
   62 |   if(Query(a, b))
      |      ~~~~~^~~~~~
monster.cpp:47:11: warning: 'b' may be used uninitialized in this function [-Wmaybe-uninitialized]
   47 |   if(Query(a, b))
      |      ~~~~~^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...