//```// YF YUSUF
#include <bits/stdc++.h>
// #include <iostream>
// #include <vector>
// #include <set>
// #include <map>
// #include <algorithm>
// #include <cmath>
// #include <numeric>
// #include <queue>
// #include <stack>
// #include <cassert>
// #include <climits>
// #include <string>
// #include <cstdlib>
// #include <random>
// #include <iomanip>
// #include <ctime>
using namespace std;
#ifdef YF_CHECK
bool LOCAL = 1;
#else
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("inline")
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("O3")
bool LOCAL = 0;
#endif
using ll = long long;
using ld = long double;
using vll = vector <ll>;
using mll = map <ll,ll>;
using pll = pair <ll,ll>;
using vvl = vector <vll>;
using vpll = vector <pll>;
template<class T>T MIN(T&a,T b){a=min(a,b);return a;}
template<class T>T MAX(T&a,T b){a=max(a,b);return a;}
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sgr v+v+1,(tl+tr)/2+1,tr
#define sgl v+v,tl,(tl+tr)/2
#define pb push_back
#define ins insert
#define S second
#define F first
mt19937_64 MT(time(0));
ll BP(ll a,ll b,ll mod=1e9+7){
if(b==0)return 1;
ll q=BP(a,b/2,mod);
return ((q*q)%mod*(b%2?a:1ll))%mod;
}
ll f(ll x){return x*(x+1)/2;}
ll dup(ll a,ll b){return (a+b-1)/b;}
ll lcm(ll a,ll b){return a/__gcd(a,b)*b;}
ll invf(ll x){return (-1+sqrt(1+8*x))/2;}
ll lg(ll x){return (x ? 63 - __builtin_clzll(x) : -1);}
const ll mod=998244353;
const ll INF=1e18;
const ll inf=1e9+7;
const ll N =1e6+7;
#include "koala.h"
int minValue(int N, int W) {
int B[N]{}, R[N];
B[0] = 1;
playRound(B, R);
int j;
for(int i=0;i<N;i++){
if(!R[i])
j = i;
}
return j;
}
int maxValue(int N, int W) {
int B[N]{}, R[N];
vll v;
for(int i=0;i<N;i++)v.pb(i);
while(v.size() > 1){
ll x = (W / v.size());
fill(B, B+N, 0);
for(auto i : v)B[i] = x;
playRound(B, R);
v.clear();
for(int i=0;i<N;i++)
if(R[i] > x)v.pb(i);
}
return v[0];
}
int greaterValue(int N, int W) {
int B[N]{}, R[N];
ll l = 1, r = 9;
while(l<=r){
ll m=(l+r)>>1;
B[0] = B[1] = m;
playRound(B, R);
if(min(R[0], R[1]) > m)l=m-1;
else if(max(R[0], R[1]) < m)r=m+1;
else return (R[0] < R[1]);
}
B[0] = B[1] = l;
playRound(B, R);
return (R[0] < R[1]);
}
void allValues(int N, int W, int *P) {
}
const bool TECT=1;
const bool FLSH=1;
const ll SN=1e0 + 7; ll SM[SN];
const ll FN=1e0 + 7; ll FACT[FN], inv[FN], FMOD=inf;
ll PNK(ll n,ll k){return FACT[n] *inv[n-k]%FMOD;}
ll CNK(ll n,ll k){return PNK(n,k)*inv[k ]%FMOD;}
void BEFORE(){
for(ll i=2;i<SN;i++){
if(SM[i])continue;
for(ll j=i;j<SN;j+=i)
MAX(SM[j],i);
}
FACT[0]=inv[0]=1;
for(int i=1;i<FN;i++){
FACT[i]=FACT[i-1]*i%FMOD;
inv[i]=BP(FACT[i],FMOD-2,FMOD);
}
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |