# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
344019 |
2021-01-05T04:45:48 Z |
Kerim |
Library (JOI18_library) |
C++17 |
|
285 ms |
620 KB |
#include <cstdio>
#include <vector>
#include "library.h"
#define pb(x) push_back(x)
#define ppb() pop_back()
#define tr(ii,c) for(__typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++)
using namespace std;
#define N 1003
int val[N];
vector<int>adj[N],res;
void add(int x,int y){
adj[x].pb(y);
adj[y].pb(x);
}
void dfs(int nd,int pr){
res.pb(nd);
tr(it,adj[nd])
if(*it!=pr)
dfs(*it,nd);
}
void Solve(int n){
vector<int> M(n);
for(int i=1;i<n;i++){
for(int j=0;j<n;j++)M[j]=0;
int last=1,cur=0;M[i]=1;
for(int j=i-1;j>=0;j--){cur+=val[j];
M[j]=1;int tmp=Query(M)+cur;
if(tmp<=last)
add(j+1,i+1),val[j]++;
last=tmp;
}
}
for(int i=1;i<=n;i++)
if(adj[i].size()==1){
dfs(i,-1);
break;
}
Answer(res);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
260 ms |
492 KB |
# of queries: 18336 |
2 |
Correct |
244 ms |
620 KB |
# of queries: 18145 |
3 |
Correct |
272 ms |
492 KB |
# of queries: 19900 |
4 |
Correct |
273 ms |
492 KB |
# of queries: 19900 |
5 |
Correct |
232 ms |
492 KB |
# of queries: 19900 |
6 |
Correct |
285 ms |
492 KB |
# of queries: 19900 |
7 |
Correct |
273 ms |
620 KB |
# of queries: 19900 |
8 |
Correct |
274 ms |
412 KB |
# of queries: 18528 |
9 |
Correct |
256 ms |
620 KB |
# of queries: 19701 |
10 |
Correct |
123 ms |
492 KB |
# of queries: 8256 |
11 |
Incorrect |
0 ms |
364 KB |
Wrong Answer [4] |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
260 ms |
492 KB |
# of queries: 18336 |
2 |
Correct |
244 ms |
620 KB |
# of queries: 18145 |
3 |
Correct |
272 ms |
492 KB |
# of queries: 19900 |
4 |
Correct |
273 ms |
492 KB |
# of queries: 19900 |
5 |
Correct |
232 ms |
492 KB |
# of queries: 19900 |
6 |
Correct |
285 ms |
492 KB |
# of queries: 19900 |
7 |
Correct |
273 ms |
620 KB |
# of queries: 19900 |
8 |
Correct |
274 ms |
412 KB |
# of queries: 18528 |
9 |
Correct |
256 ms |
620 KB |
# of queries: 19701 |
10 |
Correct |
123 ms |
492 KB |
# of queries: 8256 |
11 |
Incorrect |
0 ms |
364 KB |
Wrong Answer [4] |
12 |
Halted |
0 ms |
0 KB |
- |