# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
236354 |
2020-06-01T13:16:14 Z |
MvC |
Library (JOI18_library) |
C++11 |
|
472 ms |
536 KB |
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include "library.h"
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
#define all(x) x.begin(),x.end()
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 ll mod=1e9+7;
using namespace std;
int i,j,pr,nx,x,y;
vector<int>vc,rs,a,nw,v1,v2,cur;
int ask(vector<int>v)
{
return Query(v);
}
void Solve(int n)
{
if(n==1)
{
Answer({1});
return;
}
for(i=0;i<n;i++)vc.pb(1);
for(i=0;i<n;i++)
{
vc[i]=0;
if(ask(vc)==1)
{
nx=i;
break;
}
vc[i]=1;
}
rs.pb(nx);
for(i=0;i<n;i++)if(i!=nx)a.pb(i);
for(i=1;i<n;i++)
{
pr=nx;
cur=a;
while(1)
{
if((int)cur.size()==1)
{
nx=cur[0];
break;
}
v1.clear(),v2.clear();
for(j=0;j<(int)cur.size();j++)
{
if(j<(int)cur.size()/2)v1.pb(cur[j]);
else v2.pb(cur[j]);
}
for(j=0;j<n;j++)vc[j]=0;
for(j=0;j<(int)v1.size();j++)vc[v1[j]]=1;
x=ask(vc);
vc[pr]=1;
y=ask(vc);
if(x==y)cur=v1;
else cur=v2;
}
nw=a;
a.clear();
for(j=0;j<(int)nw.size();j++)if(nw[j]!=nx)a.pb(nw[j]);
rs.pb(nx);
}
for(i=0;i<n;i++)rs[i]++;
Answer(rs);
}
/*int main()
{
//freopen("sol.in","r",stdin);
//freopen("sol.out","w",stdout);
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
return 0;
}*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
44 ms |
384 KB |
# of queries: 2375 |
2 |
Correct |
43 ms |
256 KB |
# of queries: 2409 |
3 |
Correct |
45 ms |
256 KB |
# of queries: 2648 |
4 |
Correct |
43 ms |
256 KB |
# of queries: 2595 |
5 |
Correct |
47 ms |
256 KB |
# of queries: 2508 |
6 |
Correct |
43 ms |
256 KB |
# of queries: 2551 |
7 |
Correct |
48 ms |
384 KB |
# of queries: 2544 |
8 |
Correct |
40 ms |
384 KB |
# of queries: 2420 |
9 |
Correct |
41 ms |
256 KB |
# of queries: 2546 |
10 |
Correct |
30 ms |
256 KB |
# of queries: 1474 |
11 |
Correct |
4 ms |
384 KB |
# of queries: 0 |
12 |
Correct |
4 ms |
256 KB |
# of queries: 1 |
13 |
Correct |
4 ms |
256 KB |
# of queries: 4 |
14 |
Correct |
5 ms |
384 KB |
# of queries: 7 |
15 |
Correct |
5 ms |
256 KB |
# of queries: 77 |
16 |
Correct |
7 ms |
256 KB |
# of queries: 183 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
44 ms |
384 KB |
# of queries: 2375 |
2 |
Correct |
43 ms |
256 KB |
# of queries: 2409 |
3 |
Correct |
45 ms |
256 KB |
# of queries: 2648 |
4 |
Correct |
43 ms |
256 KB |
# of queries: 2595 |
5 |
Correct |
47 ms |
256 KB |
# of queries: 2508 |
6 |
Correct |
43 ms |
256 KB |
# of queries: 2551 |
7 |
Correct |
48 ms |
384 KB |
# of queries: 2544 |
8 |
Correct |
40 ms |
384 KB |
# of queries: 2420 |
9 |
Correct |
41 ms |
256 KB |
# of queries: 2546 |
10 |
Correct |
30 ms |
256 KB |
# of queries: 1474 |
11 |
Correct |
4 ms |
384 KB |
# of queries: 0 |
12 |
Correct |
4 ms |
256 KB |
# of queries: 1 |
13 |
Correct |
4 ms |
256 KB |
# of queries: 4 |
14 |
Correct |
5 ms |
384 KB |
# of queries: 7 |
15 |
Correct |
5 ms |
256 KB |
# of queries: 77 |
16 |
Correct |
7 ms |
256 KB |
# of queries: 183 |
17 |
Correct |
472 ms |
512 KB |
# of queries: 17982 |
18 |
Correct |
457 ms |
376 KB |
# of queries: 17293 |
19 |
Correct |
453 ms |
400 KB |
# of queries: 17467 |
20 |
Correct |
430 ms |
428 KB |
# of queries: 16325 |
21 |
Correct |
386 ms |
384 KB |
# of queries: 15324 |
22 |
Correct |
462 ms |
504 KB |
# of queries: 17669 |
23 |
Correct |
456 ms |
504 KB |
# of queries: 17224 |
24 |
Correct |
156 ms |
536 KB |
# of queries: 7915 |
25 |
Correct |
445 ms |
384 KB |
# of queries: 17136 |
26 |
Correct |
410 ms |
384 KB |
# of queries: 15963 |
27 |
Correct |
162 ms |
376 KB |
# of queries: 8040 |
28 |
Correct |
424 ms |
504 KB |
# of queries: 15957 |
29 |
Correct |
405 ms |
504 KB |
# of queries: 15939 |
30 |
Correct |
431 ms |
384 KB |
# of queries: 15957 |