# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
589333 | LIF | 버섯 세기 (IOI20_mushrooms) | C++14 | 8 ms | 344 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "mushrooms.h"
#include<bits/stdc++.h>
using namespace std;
int count_mushrooms(int n) {
std::vector <int> m;
vector<int> a;
vector<int> b;
int aans = 1;
int bans = 0;
a.push_back(0);
bool check[200005];
int pointer = 1;
while(pointer<n)
{
m.clear();
if(a.size() >= b.size())
{
if(a.size()==1)
{
m.push_back(0);
m.push_back(pointer);
if(use_machine(m) == 1) //that means 1 is b
{
bans++;
b.push_back(pointer);
}
else //that means pointer is a
{
aans++;
a.push_back(pointer);
}
check[pointer] = true;
pointer++;
}
else
{
int fir = pointer;
for(int i=0;i<a.size()*2;i++)
{
if(i==0)
{
m.push_back(fir);
check[fir] = true;
pointer++;
}
else
{
if(i%2==1)
{
m.push_back(a[i/2]);
}
else
{
if(pointer>=n)break; //that means we can confirm the count of m's element is even.
m.push_back(pointer);
check[pointer] = true;
pointer++;
}
}
}
int kk = use_machine(m);
if(kk%2 == 1)//that means the first is b;
{
b.push_back(fir);
bans++;
kk+=1; //that means we can ignore the first element.
} //that means the first is A
else
{
a.push_back(fir);
}
kk/=2; //it is the count of kk;
aans += (m.size() - (m.size()/2) - kk);
}
}
else
{
int fir = pointer;
for(int i=0;i<b.size()*2;i++)
{
if(i==0)
{
m.push_back(fir);
check[fir] = true;
pointer++;
}
else
{
if(i%2==1)
{
m.push_back(b[i/2]);
}
else
{
if(pointer >=n)break;
m.push_back(pointer);
check[pointer] = true;
pointer++;
}
}
}
int kk = use_machine(m);
if(kk%2==1) //the first is A
{
a.push_back(fir);
kk+=1;
}
else
{
b.push_back(fir);
bans++;
}
kk/=2;
aans += kk;
}
}
return aans;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |