Submission #633386

#TimeUsernameProblemLanguageResultExecution timeMemory
633386shmadKoala Game (APIO17_koala)C++17
24 / 100
123 ms440 KiB
#include "koala.h" #include <bits/stdc++.h> #define vt vector #define pb push_back #define all(x) (x).begin(), (x).end() #define sz(x) (int)(x).size() #define ff first #define ss second #define dbg(x) cerr << #x << " = " << x << '\n' #define bit(x, i) ((x) >> (i) & 1) using namespace std; using ll = long long; using pii = pair<int, int>; using vvt = vt< vt<int> >; int minValue(int n, int w) { int a[n], b[n]; fill(a, a + n, 0); a[0] = 1; playRound(a, b); for (int i = 1; i < n; i++) if (b[i] == 0) return i; return 0; } int maxValue (int n, int w) { vt<int> p(n); iota(all(p), 0ll); while (sz(p) != 1) { int a[n], b[n]; fill(a, a + n, 0); int x = n / sz(p); for (int i: p) a[i] = x; playRound(a, b); vt<int> np; for (int i = 0; i < n; i++) { if (b[i] == x + 1) np.pb(i); } p = np; } return p[0]; } int greaterValue (int n, int w) { int a[n], b[n]; fill(a, a + n, 0); int l = 1, r = w, ans = 1; while (l <= r) { int mid = l + r >> 1; a[0] = a[1] = mid; playRound(a, b); if (b[0] > mid && b[1] > mid) ans = l = mid + 1; else if (b[0] <= mid && b[1] <= mid) r = mid - 1; else return (b[0] < b[1]); } a[0] = a[1] = ans; playRound(a, b); return (b[0] < b[1]); } void allValues (int n, int w, int *p) { if (w == n * 2) { } else { } }

Compilation message (stderr)

koala.cpp: In function 'int greaterValue(int, int)':
koala.cpp:50:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   50 |     int mid = l + r >> 1;
      |               ~~^~~
#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...