# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
940382 | groshi | Library (JOI18_library) | C++17 | 25 ms | 448 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include "library.h"
using namespace std;
int zaliczony[2000];
/*int Query(vector<int> pyt)
{
for(int i=0;i<pyt.size();i++)
cout<<pyt[i]<<" ";
int wynik;
cin>>wynik;
return wynik;
}
void Answer(vector<int> wynik)
{
cout<<"wynik - > ";
for(int i=0;i<wynik.size();i++)
cout<<wynik[i]<<" ";
}*/
void Solve(int n)
{
vector<int> pytaj;
for(int i=1;i<=n;i++)
pytaj.push_back(1);
int ost;
vector<int> wynik;
for(int i=0;i<n;i++)
{
pytaj[i]=0;
if(Query(pytaj)==1)
{
ost=i;
wynik.push_back(i+1);
zaliczony[i]=1;
break;
}
pytaj[i]=1;
}
for(int i=1;i<n;i++)
{
vector<int> niema;
for(int j=0;j<n;j++)
if(zaliczony[j]==0)
niema.push_back(j);
int pocz=1,kon=niema.size()+1,sre,ostd=0;
while(pocz<kon)
{
//cout<<i<<": "<<pocz<<" "<<kon<<"\n";
sre=(pocz+kon)/2;
vector<int> pytaj;
for(int j=0;j<n;j++)
pytaj.push_back(0);
for(int j=0;j<sre;j++)
pytaj[niema[j]]=1;
int essa=Query(pytaj);
pytaj[ost]=1;
if(Query(pytaj)==essa)
{
ostd=sre-1;
kon=sre;
}
else pocz=sre+1;
}
wynik.push_back(niema[ostd]+1);
zaliczony[niema[ostd]]=1;
ost=niema[ostd];
}
Answer(wynik);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |