# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
656586 | haojiandan | 도서관 (JOI18_library) | C++14 | 443 ms | 312 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "library.h"
using namespace std;
int n,p[1010],tot;
int d[1010],vis[1010];
void Solve(int _n) {
n=_n;
if (n==1) { Answer({1}); return; }
int x=-1;
for (int i=1;i<=n;i++) {
vector<int> Q(n);
for (int j=1;j<=n;j++) Q[j-1]=1;
Q[i-1]=0;
if (Query(Q)==1) { x=i; break; }
}
d[1]=x,vis[x]=1;
for (int i=2;i<=n;i++) {
tot=0;
for (int j=1;j<=n;j++) if (!vis[j]) p[++tot]=j;
if (tot==1) { d[i]=p[1]; continue; }
int l=1,r=tot,mid,res=-1;
while (l<=r) {
vector<int> Q(n);
for (int j=1;j<=n;j++) Q[j-1]=0;
int mid=(l+r)>>1;
for (int j=1;j<=mid;j++) Q[p[j]-1]=1;
int tmp=Query(Q);
Q[d[i-1]-1]=1;
tmp=abs(tmp-Query(Q));
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |