Submission #1225798

#TimeUsernameProblemLanguageResultExecution timeMemory
1225798dostsKoala Game (APIO17_koala)C++20
19 / 100
9 ms456 KiB
#include "koala.h" #include <bits/stdc++.h> #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2") //#define int long long #define pii pair<int,int> #define vi vector<int> #define ff first #define ss second #define sp << " " << #define all(x) x.begin(),x.end() #define big(x) ((int)(x.size())) using namespace std; const int MOD = 1e9+7, LIM = 1e6+1, inf = 2e9; int minValue(int N, int W) { int B[N]{},R[N]{}; B[0] = 1; set<int> waste; playRound(B,R); for (int i=0;i<N;i++) if (!R[i]) waste.insert(i); B[0] = 0; B[1] = 1; playRound(B,R); for (int i=0;i<N;i++) if (!R[i] && waste.count(i)) return i; return -1; } int maxValue(int N, int W) { set<int> cand; for (int i = 0;i<N;i++) cand.insert(i); int cur = 1; int B[N]{},R[N]{}; while (big(cand) > 1) { int k = W/big(cand); for (int j = 0;j<N;j++) B[j] = 0; for (auto it : cand) B[it] = k; playRound(B,R); for (int j = 0;j<N;j++) if (R[j] <= k) cand.erase(j); } return *cand.begin(); } int greaterValue(int N, int W) { int l = 0,r = min(N/2,9); int B[N]{},R[N]{}; while (l<=r) { int m = (l+r) >> 1; B[0] = B[1] = m; for (int j = 0;j<N;j++) cout << B[j] << ' '; cout << '\n'; playRound(B,R); for (int j = 0;j<N;j++) cout << R[j] << ' '; cout << '\n'; if (R[0] > m && R[1] > m) l = m+1; else if (R[0] < m && R[1] < m) r = m-1; else return (R[0] < R[1]); } R[0] = R[1] = l; playRound(B,R); return R[0] < R[1]; } void allValues(int N, int W, int *P) { if (W == 2*N) { // TODO: Implement Subtask 4 solution here. // You may leave this block unmodified if you are not attempting this // subtask. } else { // TODO: Implement Subtask 5 solution here. // You may leave this block unmodified if you are not attempting this // subtask. } }
#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...