이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "koala.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
int minValue(int N, int W) {
int P[N], T[N];
rep(i, N) P[i]=0;
P[0]=1;
playRound(P, T);
rep(i, N) if(P[i]>=T[i]) return i;
return 0;
}
int maxValue(int N, int W) {
int P[N], T[N];
vector<int>V(N);
rep(i, N) V[i]=0;
int ans=-1;
while(true) {
int ile=N;
rep(i, N) if(V[i]) --ile;
if(ile==1) {
rep(i, N) if(!V[i]) ans=i;
break;
}
rep(i, N) if(V[i]) P[i]=0; else P[i]=W/ile;
playRound(P, T);
rep(i, N) if(P[i]>=T[i]) V[i]=1;
int ans=0;
rep(i, N) if(!V[i]) ++ans;
}
return ans;
}
int greaterValue(int N, int W) {
int T[N], P[N], po=1, ko=8;
rep(i, N) P[i]=0;
while(po<ko) {
int sr=(po+ko)/2;
P[0]=P[1]=sr;
playRound(P, T);
if(T[0]>sr && T[1]<=sr) return 0;
if(T[0]<=sr && T[1]>sr) return 1;
if(T[0]>sr) po=sr+1; else ko=sr-1;
}
P[0]=P[1]=po;
playRound(P, T);
if(T[0]<=po) return 1;
return 0;
}
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 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... |