답안 #503567

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
503567 2022-01-08T10:46:41 Z Koosha_mv 도서관 (JOI18_library) C++14
19 / 100
483 ms 452 KB
#include <bits/stdc++.h>
using namespace std;
#define dbgv(v) cout<<#v<<" = "; f(i,0,v.size()) cout<<v[i]<<" "; cout<<endl
#define dbga(a,x,y) cout<<#a<<" = "; f(i,x,y) cout<<a[i]<<" "; cout<<endl
#define erorp(x) cout<<#x<<"={"<<(x.F)<<" , "<<x.S<<"}"<<endl
#define eror(x) cout<<#x<<'='<<(x)<<endl
#define f_(i,a,b) for(int i=a;i>=b;i--)
#define f(i,a,b) for(int i=a;i<b;i++)
#define nb(x) __builtin_popcount(x)
#define all(v) v.begin(),v.end()
#define bit(n,k) (((n)>>(k))&1)
#define Add(x,y) x=(x+y)%mod
#define maxm(a,b) a=max(a,b)
#define minm(a,b) a=min(a,b)
#define lst(x) x[x.size()-1]
#define sz(x) int(x.size())
#define mp make_pair
#define ll long long
#define pb push_back
#define S second
#define F first
#include "library.h"

const int N=2222;

int n,t,a[N];
vector<int> res,g[N];
vector<pair<int,int> > ans;

void dfs(int u,int p){
	res.pb(u+1);
	for(auto v : g[u]){
		if(v==p) continue ;
		dfs(v,u);
	}
}
/*int ask(int l,int r){
	vector<int> v(n);
	f(i,l,r+1) v[i]=1;
	int res=r-l+1-Query(v);
	for(auto p : ans){
		if(l<=p.F && p.F<=r && l<=p.S && p.S<=r){
			res--;
		}
	}
	return res;
}*/
int ask(int u,int v){
	vector<int> M(n);
	M[u]=1,M[v]=1;
	return Query(M);
}
void Solve(int _n){
	n=_n;
	f(i,0,n){
		f(j,i+1,n){
			vector<int> M(n);
			M[i]=1,M[j]=1;
			if(ask(i,j)==1){
				g[i].pb(j);
				g[j].pb(i);
			}
		}
	}
	f(i,0,n){
		if(g[i].size()==1 || i==n-1){
			dfs(i,i);
			Answer(res);
			return ;
		}
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 160 ms 344 KB # of queries: 18336
2 Correct 264 ms 452 KB # of queries: 18145
3 Correct 280 ms 336 KB # of queries: 19900
4 Correct 266 ms 452 KB # of queries: 19900
5 Correct 268 ms 340 KB # of queries: 19900
6 Correct 262 ms 348 KB # of queries: 19900
7 Correct 292 ms 332 KB # of queries: 19900
8 Correct 156 ms 348 KB # of queries: 18528
9 Correct 305 ms 348 KB # of queries: 19701
10 Correct 108 ms 340 KB # of queries: 8256
11 Correct 0 ms 328 KB # of queries: 0
12 Correct 0 ms 328 KB # of queries: 1
13 Correct 0 ms 328 KB # of queries: 3
14 Correct 0 ms 328 KB # of queries: 6
15 Correct 2 ms 328 KB # of queries: 105
16 Correct 5 ms 328 KB # of queries: 351
# 결과 실행 시간 메모리 Grader output
1 Correct 160 ms 344 KB # of queries: 18336
2 Correct 264 ms 452 KB # of queries: 18145
3 Correct 280 ms 336 KB # of queries: 19900
4 Correct 266 ms 452 KB # of queries: 19900
5 Correct 268 ms 340 KB # of queries: 19900
6 Correct 262 ms 348 KB # of queries: 19900
7 Correct 292 ms 332 KB # of queries: 19900
8 Correct 156 ms 348 KB # of queries: 18528
9 Correct 305 ms 348 KB # of queries: 19701
10 Correct 108 ms 340 KB # of queries: 8256
11 Correct 0 ms 328 KB # of queries: 0
12 Correct 0 ms 328 KB # of queries: 1
13 Correct 0 ms 328 KB # of queries: 3
14 Correct 0 ms 328 KB # of queries: 6
15 Correct 2 ms 328 KB # of queries: 105
16 Correct 5 ms 328 KB # of queries: 351
17 Runtime error 483 ms 356 KB Execution killed with signal 13
18 Halted 0 ms 0 KB -