Submission #568067

#TimeUsernameProblemLanguageResultExecution timeMemory
568067minhcoolKoala Game (APIO17_koala)C++17
37 / 100
55 ms340 KiB
#include "koala.h" #include<bits/stdc++.h> using namespace std; //#define int long long #define fi first #define se second #define pb push_back #define mp make_pair #define foru(i, l, r) for(int i = l; i <= r; i++) #define ford(i, r, l) for(int i = r; i >= l; i--) typedef pair<int, int> ii; typedef pair<ii, int> iii; typedef pair<ii, ii> iiii; //const int N = ; const int oo = 1e18 + 7, mod = 1e9 + 7; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int rnd(int l, int r){ int temp = rng() % (r - l + 1); temp = (temp + (r - l + 1)) % (r - l + 1); return temp + l; } int n; int B[105], R[105]; int minValue(int N, int W) { //int B[105], R[105]; for(int i = 0; i < N; i++) B[i] = 0; B[0] = 1; playRound(B, R); //for(int i = 0; i < N; i++) cout << B[i] << " " << R[i] << "\n"; for(int i = 0; i < N; i++) if(R[i] <= B[i]) return i; //return; } int maxValue(int N, int W) { vector<int> rem; for(int i = 0; i < N; i++) rem.pb(i); while(rem.size() > 1){ //cout << rem.size() << "\n"; int temp = W / rem.size(); //cout << temp << "\n"; //cout << rem.size() << "\n"; //for(auto it : rem) cout << it << " "; //cout << "\n"; for(int i = 0; i < N; i++) B[i] = 0; for(auto it : rem) B[it] = temp; playRound(B, R); vector<int> vc; for(auto it : rem) if(R[it] > B[it] && B[it]) vc.pb(it); rem = vc; } return rem[0]; } int cnt = 0; int greaterValue(int N, int W) { n = N; int l = 0, r = 15; while(l <= r){ int mid = (l + r) >> 1; for(int i = 0; i < n; i++) B[i] = 0; B[0] = B[1] = mid; playRound(B, R); bool ck1 = (R[0] > B[0]), ck2 = (R[1] > B[1]); if(ck1 ^ ck2) return !ck1; if(!ck1) r = mid - 1; else l = mid + 1; } return 0; } void allValues(int N, int W, int *P) { if(W == 2*N){ } else{ } //return 0; } /* void process(){ } signed main(){ ios_base::sync_with_stdio(0); process(); }*/

Compilation message (stderr)

koala.cpp:19:21: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   19 | const int oo = 1e18 + 7, mod = 1e9 + 7;
      |                ~~~~~^~~
koala.cpp: In function 'int minValue(int, int)':
koala.cpp:40:1: warning: control reaches end of non-void function [-Wreturn-type]
   40 | }
      | ^
#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...