Submission #96411

# Submission time Handle Problem Language Result Execution time Memory
96411 2019-02-09T10:34:28 Z MvC Library (JOI18_library) C++11
0 / 100
547 ms 504 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.back();
}
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]);
                 ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 41 ms 376 KB # of queries: 2570
2 Correct 43 ms 248 KB # of queries: 2569
3 Correct 35 ms 248 KB # of queries: 2700
4 Correct 46 ms 248 KB # of queries: 2698
5 Correct 26 ms 376 KB # of queries: 2706
6 Correct 33 ms 376 KB # of queries: 2712
7 Correct 49 ms 376 KB # of queries: 2712
8 Correct 49 ms 376 KB # of queries: 2591
9 Correct 45 ms 248 KB # of queries: 2693
10 Correct 26 ms 248 KB # of queries: 1581
11 Runtime error 2 ms 504 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 376 KB # of queries: 5
14 Correct 2 ms 376 KB # of queries: 10
15 Correct 3 ms 248 KB # of queries: 91
16 Correct 5 ms 248 KB # of queries: 209
# Verdict Execution time Memory Grader output
1 Correct 41 ms 376 KB # of queries: 2570
2 Correct 43 ms 248 KB # of queries: 2569
3 Correct 35 ms 248 KB # of queries: 2700
4 Correct 46 ms 248 KB # of queries: 2698
5 Correct 26 ms 376 KB # of queries: 2706
6 Correct 33 ms 376 KB # of queries: 2712
7 Correct 49 ms 376 KB # of queries: 2712
8 Correct 49 ms 376 KB # of queries: 2591
9 Correct 45 ms 248 KB # of queries: 2693
10 Correct 26 ms 248 KB # of queries: 1581
11 Runtime error 2 ms 504 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 376 KB # of queries: 5
14 Correct 2 ms 376 KB # of queries: 10
15 Correct 3 ms 248 KB # of queries: 91
16 Correct 5 ms 248 KB # of queries: 209
17 Correct 501 ms 376 KB # of queries: 18168
18 Correct 536 ms 248 KB # of queries: 17939
19 Correct 496 ms 248 KB # of queries: 18180
20 Correct 434 ms 376 KB # of queries: 16942
21 Correct 416 ms 376 KB # of queries: 15891
22 Correct 511 ms 376 KB # of queries: 18146
23 Correct 418 ms 408 KB # of queries: 18127
24 Correct 209 ms 376 KB # of queries: 8343
25 Correct 456 ms 324 KB # of queries: 17689
26 Correct 416 ms 248 KB # of queries: 16547
27 Correct 174 ms 248 KB # of queries: 8273
28 Correct 483 ms 376 KB # of queries: 18934
29 Correct 520 ms 376 KB # of queries: 18913
30 Correct 547 ms 376 KB # of queries: 18934