Submission #1142502

#TimeUsernameProblemLanguageResultExecution timeMemory
1142502SmuggingSpunMonster Game (JOI21_monster)C++20
10 / 100
58 ms408 KiB
#include "monster.h"
#include<bits/stdc++.h>
using namespace std;
vector<int>Solve(int n){
	if(n <= 100){
		vector<int>ans(n, 0);
		for(int i = 0; i < n; i++){
			for(int j = i + 1; j < n; j++){
				ans[Query(i, j) ? i : j]++;
			}
		}
		for(int i = 0, small = -1, large = -1; i < n; i++){
			if(ans[i] == 1){
				if(small == -1){
					small = i;
				}
				else{
					ans[i] = 1 ^ (ans[small] = (Query(small, i) ? 0 : 1));
				}
			}
			else if(ans[i] == n - 2){
				if(large == -1){
					large = i;
				}
				else{
					ans[i] = (n - 2) ^ (n - 1) ^ (ans[large] = (Query(large, i) ? n - 2 : n - 1));
				}
			}
		}
		return ans;
	}
}

Compilation message (stderr)

monster.cpp: In function 'std::vector<int> Solve(int)':
monster.cpp:32:1: warning: control reaches end of non-void function [-Wreturn-type]
   32 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...