답안 #96410

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
96410 2019-02-09T10:32:19 Z MvC 도서관 (JOI18_library) C++11
0 / 100
583 ms 376 KB
#pragma GCC optimize("O3")
#include "library.h"
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<62);
const int inf=(1<<30);
const int nmax=1e5+50;
const int mod=1e9+7;
using namespace std;
int n,viz[1050];
int get(int rt)
{
	vector<int>v;
	for(int i=1;i<=n;i++)if(!viz[i])v.pb(i);
	while(v.size()!=1)
	{
		vector<int>l,r,s(n,0);
		int mid=(int)v.size()/2;
		for(int i=0;i<mid;i++)l.pb(v[i]),s[v[i]-1]=1;
		for(int i=mid;i<v.size();i++)r.pb(v[i]);
		int x=Query(s);
		s[rt-1]=1;
		if(Query(s)==x)v=l;
		else v=r;
	}
	return v[0];
}
void Solve(int N)
{
	n=N;
	int r;
	for(int i=1;i<=n;i++)
	{
		vector<int>v;
		for(int j=1;j<=n;j++)
		{
			if(i==j)v.pb(0);
			else v.pb(1);
		}
		if(Query(v)==1)r=i;
	}
	vector<int>ans;
	ans.pb(r);
	viz[r]=1;
	for(int i=2;i<=n;i++)
	{
		int nxt=get(r);
		ans.pb(nxt);
		r=nxt;
		viz[r]=1;
	}
	Answer(ans);
}
/*int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	
    return 0;
}*/

Compilation message

library.cpp: In function 'int get(int)':
library.cpp:29:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=mid;i<v.size();i++)r.pb(v[i]);
                 ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 44 ms 376 KB # of queries: 2570
2 Correct 49 ms 248 KB # of queries: 2569
3 Correct 49 ms 252 KB # of queries: 2700
4 Correct 65 ms 376 KB # of queries: 2698
5 Correct 44 ms 376 KB # of queries: 2706
6 Correct 42 ms 376 KB # of queries: 2712
7 Correct 48 ms 376 KB # of queries: 2712
8 Correct 52 ms 248 KB # of queries: 2591
9 Correct 46 ms 376 KB # of queries: 2693
10 Correct 27 ms 248 KB # of queries: 1581
11 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Correct 2 ms 248 KB # of queries: 2
13 Correct 2 ms 252 KB # of queries: 5
14 Correct 2 ms 252 KB # of queries: 10
15 Correct 2 ms 248 KB # of queries: 91
16 Correct 6 ms 376 KB # of queries: 209
# 결과 실행 시간 메모리 Grader output
1 Correct 44 ms 376 KB # of queries: 2570
2 Correct 49 ms 248 KB # of queries: 2569
3 Correct 49 ms 252 KB # of queries: 2700
4 Correct 65 ms 376 KB # of queries: 2698
5 Correct 44 ms 376 KB # of queries: 2706
6 Correct 42 ms 376 KB # of queries: 2712
7 Correct 48 ms 376 KB # of queries: 2712
8 Correct 52 ms 248 KB # of queries: 2591
9 Correct 46 ms 376 KB # of queries: 2693
10 Correct 27 ms 248 KB # of queries: 1581
11 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Correct 2 ms 248 KB # of queries: 2
13 Correct 2 ms 252 KB # of queries: 5
14 Correct 2 ms 252 KB # of queries: 10
15 Correct 2 ms 248 KB # of queries: 91
16 Correct 6 ms 376 KB # of queries: 209
17 Correct 567 ms 376 KB # of queries: 18168
18 Correct 556 ms 248 KB # of queries: 17939
19 Correct 488 ms 328 KB # of queries: 18180
20 Correct 504 ms 376 KB # of queries: 16942
21 Correct 370 ms 324 KB # of queries: 15891
22 Correct 503 ms 248 KB # of queries: 18146
23 Correct 507 ms 376 KB # of queries: 18127
24 Correct 162 ms 324 KB # of queries: 8343
25 Correct 468 ms 376 KB # of queries: 17689
26 Correct 415 ms 320 KB # of queries: 16547
27 Correct 172 ms 376 KB # of queries: 8273
28 Correct 497 ms 324 KB # of queries: 18934
29 Correct 583 ms 376 KB # of queries: 18913
30 Correct 408 ms 324 KB # of queries: 18934