#include "library.h"
#include <bits/stdc++.h>
using namespace std;
const int nmax=1e5+42;
vector<int> adj[nmax];
/*
vector<int> order={4,2,5,3,1};
int Query(vector<int> in)
{
bool active=0;
int ret=0;
for(auto k:order)
{
if(in[k-1])
{
if(active==0)ret++;
active=1;
}
else active=0;
}
return ret;
}
void Answer(vector<int> outp)
{
for(auto k:outp)printf("%i ",k);
}
*/
vector<int> outp;
void dfs(int node,int par)
{
outp.push_back(node);
for(auto k:adj[node])
if(k!=par)dfs(k,node);
}
void Solve(int n_)
{
vector<int> help={};
for(int i=0;i<n_;i++)help.push_back(0);
for(int i=0;i<n_;i++)
for(int j=i+1;j<n_;j++)
{
help[i]=1;
help[j]=1;
if(Query(help)==1)
{
//cout<<i+1<<" to "<<j+1<<endl;
adj[i+1].push_back(j+1);
adj[j+1].push_back(i+1);
}
help[i]=0;
help[j]=0;
}
for(int i=1;i<=n_;i++)
if(adj[i].size()==1)
{
dfs(i,0);
Answer(outp);
return;
}
}
/*
int main()
{
Solve(5);
return 0;
}
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
314 ms |
2688 KB |
# of queries: 18336 |
2 |
Correct |
259 ms |
2592 KB |
# of queries: 18145 |
3 |
Correct |
290 ms |
2688 KB |
# of queries: 19900 |
4 |
Correct |
265 ms |
2688 KB |
# of queries: 19900 |
5 |
Correct |
356 ms |
2808 KB |
# of queries: 19900 |
6 |
Correct |
331 ms |
2936 KB |
# of queries: 19900 |
7 |
Correct |
349 ms |
2876 KB |
# of queries: 19900 |
8 |
Correct |
249 ms |
2808 KB |
# of queries: 18528 |
9 |
Correct |
316 ms |
2688 KB |
# of queries: 19701 |
10 |
Correct |
128 ms |
2808 KB |
# of queries: 8256 |
11 |
Incorrect |
6 ms |
2688 KB |
Wrong Answer [7] |
12 |
Correct |
6 ms |
2688 KB |
# of queries: 1 |
13 |
Correct |
6 ms |
2688 KB |
# of queries: 3 |
14 |
Correct |
6 ms |
2688 KB |
# of queries: 6 |
15 |
Correct |
7 ms |
2688 KB |
# of queries: 105 |
16 |
Correct |
12 ms |
2688 KB |
# of queries: 351 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
314 ms |
2688 KB |
# of queries: 18336 |
2 |
Correct |
259 ms |
2592 KB |
# of queries: 18145 |
3 |
Correct |
290 ms |
2688 KB |
# of queries: 19900 |
4 |
Correct |
265 ms |
2688 KB |
# of queries: 19900 |
5 |
Correct |
356 ms |
2808 KB |
# of queries: 19900 |
6 |
Correct |
331 ms |
2936 KB |
# of queries: 19900 |
7 |
Correct |
349 ms |
2876 KB |
# of queries: 19900 |
8 |
Correct |
249 ms |
2808 KB |
# of queries: 18528 |
9 |
Correct |
316 ms |
2688 KB |
# of queries: 19701 |
10 |
Correct |
128 ms |
2808 KB |
# of queries: 8256 |
11 |
Incorrect |
6 ms |
2688 KB |
Wrong Answer [7] |
12 |
Correct |
6 ms |
2688 KB |
# of queries: 1 |
13 |
Correct |
6 ms |
2688 KB |
# of queries: 3 |
14 |
Correct |
6 ms |
2688 KB |
# of queries: 6 |
15 |
Correct |
7 ms |
2688 KB |
# of queries: 105 |
16 |
Correct |
12 ms |
2688 KB |
# of queries: 351 |
17 |
Execution timed out |
3014 ms |
2716 KB |
Time limit exceeded |
18 |
Execution timed out |
3032 ms |
2784 KB |
Time limit exceeded |
19 |
Execution timed out |
3040 ms |
2724 KB |
Time limit exceeded |
20 |
Execution timed out |
3018 ms |
2688 KB |
Time limit exceeded |
21 |
Execution timed out |
3101 ms |
2688 KB |
Time limit exceeded |
22 |
Execution timed out |
3053 ms |
2752 KB |
Time limit exceeded |
23 |
Execution timed out |
3094 ms |
2688 KB |
Time limit exceeded |
24 |
Incorrect |
1008 ms |
2688 KB |
Wrong Answer [3] |
25 |
Execution timed out |
3102 ms |
2784 KB |
Time limit exceeded |
26 |
Execution timed out |
3025 ms |
2808 KB |
Time limit exceeded |
27 |
Incorrect |
1004 ms |
2688 KB |
Wrong Answer [3] |
28 |
Execution timed out |
3007 ms |
2688 KB |
Time limit exceeded |
29 |
Execution timed out |
3015 ms |
2688 KB |
Time limit exceeded |
30 |
Execution timed out |
3069 ms |
2688 KB |
Time limit exceeded |