Submission #978379

#TimeUsernameProblemLanguageResultExecution timeMemory
978379oolimryKoala Game (APIO17_koala)C++17
34 / 100
136 ms740 KiB
#include "koala.h" #include<bits/stdc++.h> #define all(x) (x).begin(), (x).end() #define sz(x) ((int) x.size()) using namespace std; int B[100]; int R[100]; int minValue(int N, int W) { fill(B,B+N,0); B[0] = 1; playRound(B,R); for(int i = 0;i < N;i++){ if(R[i] == 0) return i; } return -1; } int big[105]; int maxValue(int n, int W) { fill(big,big+n,1); vector<int> witness = {1,2,4,11}; for(int x : witness){ for(int i = 0;i < n;i++){ if(big[i]) B[i] = x; else B[i] = 0; } playRound(B,R); for(int i = 0;i < n;i++){ if(R[i] == 0) big[i] = 0; } for(int i = 0;i < n;i++) { cerr << R[i] << " "; } cerr << endl; } for(int i = 0;i < n;i++) if(big[i]) return i; return 0; } int greaterValue(int n, int W){ for(int x = 1;x < n;x++){ B[0] = x; B[1] = x; playRound(B,R); if(R[0] > R[1]) return 0; if(R[1] > R[0]) return 1; } return -1; } void allValues1(int n, int W, int *P){ int B[n]; int R[n]; int A[n]; for(int i = 0;i < n;i++) A[i] = i; stable_sort(A, A+n, [&](int a, int b){ fill(B,B+n,0); B[a] = n, B[b] = n; playRound(B,R); if(R[a] == 0) return true; else return false; }); for(int i = 0;i < n;i++) P[A[i]] = i+1; } void allValues2(int n, int *P, int s, int e, vector<int> stuff){ if(sz(stuff) == 1){ P[stuff[0]] = s; return; } for(int X = 1;X < 100;X++){ fill(B,B+n,0); for(int i : stuff) B[i] = X; playRound(B,R); vector<int> left, right; for(int i : stuff){ if(R[i] == 0) left.push_back(i); else right.push_back(i); } if(sz(left) != 0 and sz(right) != 0){ cout << X << ","; int m = s + sz(left); allValues2(n, P, s, m-1, left); allValues2(n, P, m, e, right); return; } } } void allValues(int N, int W, int *P) { if (W == 2*N) allValues1(N, W, P); else{ vector<int> stuff; for(int i = 0;i < N;i++) stuff.push_back(i); allValues2(N, P, 1, N, stuff); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...