# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
285369 |
2020-08-28T20:20:52 Z |
YJU |
Library (JOI18_library) |
C++14 |
|
368 ms |
504 KB |
#include<bits/stdc++.h>
#include"library.h"
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef int ll;
typedef long double ld;
typedef pair<int,ll> pll;
const ll MOD=1e9+7;
const ll MOD2=998244353;
const ld pi=3.14159265359;
#define SQ(i) ((i)*(i))
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define setp setprecision
#define lwb lower_bound
#define SZ(_a) (ll)_a.size()
void Solve(int N){
if(N==1){
Answer(vector<int>(1,1));
return;
}
vector<ll> q(N),t(N),ans;
ll A,B;
REP(i,N)t[i]=i,q[i]=1;
REP(i,N){
q[i]=0;
if(Query(q)==1){
t.erase(t.begin()+i);
ans.pb(i);break;
}
q[i]=1;
}
REP(i,N)q[i]=0;
while(SZ(ans)<N){
ll l=-1,r=SZ(t)-1;
while(r-1>l){
ll mid=(l+r)/2;
for(int i=0;i<=mid;i++)q[t[i]]=1;
A=Query(q);
q[ans.back()]=1;
B=Query(q);
for(int i=0;i<=mid;i++)q[t[i]]=0;
q[ans.back()]=0;
if(A==B){
r=mid;
}else{
l=mid;
}
}
ans.pb(t[r]);
t.erase(t.begin()+r);
}
REP(i,N)ans[i]+=1;
Answer(ans);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
38 ms |
256 KB |
# of queries: 2375 |
2 |
Correct |
34 ms |
256 KB |
# of queries: 2409 |
3 |
Correct |
40 ms |
256 KB |
# of queries: 2648 |
4 |
Correct |
39 ms |
256 KB |
# of queries: 2595 |
5 |
Correct |
40 ms |
256 KB |
# of queries: 2508 |
6 |
Correct |
33 ms |
256 KB |
# of queries: 2551 |
7 |
Correct |
35 ms |
256 KB |
# of queries: 2544 |
8 |
Correct |
34 ms |
256 KB |
# of queries: 2420 |
9 |
Correct |
48 ms |
256 KB |
# of queries: 2546 |
10 |
Correct |
21 ms |
256 KB |
# of queries: 1474 |
11 |
Correct |
0 ms |
256 KB |
# of queries: 0 |
12 |
Correct |
0 ms |
256 KB |
# of queries: 1 |
13 |
Correct |
0 ms |
256 KB |
# of queries: 4 |
14 |
Correct |
0 ms |
256 KB |
# of queries: 7 |
15 |
Correct |
2 ms |
256 KB |
# of queries: 77 |
16 |
Correct |
3 ms |
256 KB |
# of queries: 183 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
38 ms |
256 KB |
# of queries: 2375 |
2 |
Correct |
34 ms |
256 KB |
# of queries: 2409 |
3 |
Correct |
40 ms |
256 KB |
# of queries: 2648 |
4 |
Correct |
39 ms |
256 KB |
# of queries: 2595 |
5 |
Correct |
40 ms |
256 KB |
# of queries: 2508 |
6 |
Correct |
33 ms |
256 KB |
# of queries: 2551 |
7 |
Correct |
35 ms |
256 KB |
# of queries: 2544 |
8 |
Correct |
34 ms |
256 KB |
# of queries: 2420 |
9 |
Correct |
48 ms |
256 KB |
# of queries: 2546 |
10 |
Correct |
21 ms |
256 KB |
# of queries: 1474 |
11 |
Correct |
0 ms |
256 KB |
# of queries: 0 |
12 |
Correct |
0 ms |
256 KB |
# of queries: 1 |
13 |
Correct |
0 ms |
256 KB |
# of queries: 4 |
14 |
Correct |
0 ms |
256 KB |
# of queries: 7 |
15 |
Correct |
2 ms |
256 KB |
# of queries: 77 |
16 |
Correct |
3 ms |
256 KB |
# of queries: 183 |
17 |
Correct |
331 ms |
380 KB |
# of queries: 17982 |
18 |
Correct |
335 ms |
376 KB |
# of queries: 17293 |
19 |
Correct |
251 ms |
504 KB |
# of queries: 17467 |
20 |
Correct |
260 ms |
372 KB |
# of queries: 16325 |
21 |
Correct |
245 ms |
408 KB |
# of queries: 15324 |
22 |
Correct |
331 ms |
504 KB |
# of queries: 17669 |
23 |
Correct |
321 ms |
376 KB |
# of queries: 17224 |
24 |
Correct |
143 ms |
376 KB |
# of queries: 7915 |
25 |
Correct |
368 ms |
376 KB |
# of queries: 17136 |
26 |
Correct |
327 ms |
376 KB |
# of queries: 15963 |
27 |
Correct |
160 ms |
256 KB |
# of queries: 8040 |
28 |
Correct |
263 ms |
380 KB |
# of queries: 15957 |
29 |
Correct |
298 ms |
376 KB |
# of queries: 15939 |
30 |
Correct |
315 ms |
384 KB |
# of queries: 15957 |