# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
884484 | jamjanek | 버섯 세기 (IOI20_mushrooms) | C++14 | 6 ms | 736 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include "mushrooms.h"
using namespace std;
int count_mushrooms(int n){
vector<int>A[2];
A[0].push_back(0);
int it = 1;
int Ac[2] = {1,0};
Ac[0] = 1;
Ac[1] = 0;
while(it<n){
// printf("it = %d\n", it);
vector<int>pom;
bool czy = 0;
if(A[1].size()>A[0].size())czy = 1;
int pom1 = 0;
while(it<n && pom.size()<2*A[czy].size()){
pom.push_back(A[czy][pom1++]);
pom.push_back(it);
it++;
}
int ans = use_machine(pom);
// printf("vec: = ");for(auto j: pom)printf("%d ", j);printf("\n");
// printf("ans = %d\n", ans);
if(ans%2==0)
A[czy].push_back(it-1);
else
A[!czy].push_back(it-1);
Ac[!czy]+=(ans+1)/2;
Ac[czy]+=pom1-(ans+1)/2;
}
// printf("res = %d\n", Ac[0]);
return Ac[0];
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |