# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1093873 | DobromirAngelov | 도서관 (JOI18_library) | C++14 | 388 ms | 708 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "library.h"
#include<bits/stdc++.h>
using namespace std;
const int MAXN=1005;
int n;
vector<int> m;
bool used[MAXN];
int queryNot(int ind)
{
for(int i=0;i<n;i++)
{
m[i]=1;
if(i==ind-1) m[i]=0;
}
return Query(m);
}
int query(vector<int> v)
{
for(int i=0;i<n;i++) m[i]=0;
for(auto x: v) m[x-1]=1;
return Query(m);
}
void Solve(int N)
{
n=N;
m.resize(n);
if(n==1)
{
vector<int> res;
res.push_back(1);
Answer(res);
return;
}
int st=0;
for(int i=1;i<=n;i++)
{
if(queryNot(i)==1)
{
st=i;
break;
}
}
vector<int> res;
res.push_back(st);
used[st]=1;
vector<int> pot;
pot.reserve(n);
for(int i=2;i<=n;i++)
{
pot.clear();
for(int j=1;j<=n;j++)
{
if(!used[j]) pot.push_back(j);
}
int nxt=0;
for(int j=0;(1<<j)<=(int)(pot.size()-1);j++)
{
vector<int> cur;
for(int k=0;k<pot.size();k++)
{
if(k&(1<<j)) cur.push_back(pot[k]);
}
int cnt1=query(cur);
cur.push_back(res.back());
int cnt2=query(cur);
if(cnt1==cnt2) nxt|=(1<<j);
}
res.push_back(pot[nxt]);
used[res.back()]=1;
}
Answer(res);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |