# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
885231 | epicci23 | 버섯 세기 (IOI20_mushrooms) | C++17 | 8 ms | 784 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "mushrooms.h"
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define pb push_back
#define sz(x) ((int)(x).size())
const int BL = 300;
const int BL2 = 299;
int count_mushrooms(int n){
int ar[n+5],ans=1;
memset(ar,-1,sizeof(ar));
ar[0]=1;
vector<int> ind_a,ind_b;
ind_a.pb(0);
for(int i=1;i<=min(n-1,2*BL);i++){
int xd = use_machine({0,i});
if(xd==0){
ar[i]=1;
ans++;
ind_a.pb(i);
}
else{
ar[i]=0;
ind_b.pb(i);
}
}
if(n-1<=2*BL) return ans;
for(int i=2*BL+1;i<n;i+=BL2){
vector<int> que;
for(int j=i;j<min(n,i+BL2);j++) que.pb(j);
if(sz(ind_a)>sz(que)){
vector<int> haha;
haha.pb(ind_a[0]);
for(int j=0;j<sz(que);j++){
haha.pb(que[j]);
haha.pb(ind_a[j+1]);
}
int res = use_machine(haha);
ans += sz(que) - res/2;
}
else{
vector<int> haha;
haha.pb(ind_b[0]);
for(int j=0;j<sz(que);j++){
haha.pb(que[j]);
haha.pb(ind_b[j+1]);
}
int res = use_machine(haha);
ans += res/2;
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |