# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
47824 |
2018-05-08T04:36:56 Z |
Talant |
Library (JOI18_library) |
C++17 |
|
359 ms |
308 KB |
#include <cstdio>
#include <vector>
#include <bits/stdc++.h>
#include "library.h"
#define pb push_back
using namespace std;
int u[1005];
void Solve(int N)
{
vector<int> M(N);
int cur = 0;
vector<int> res;
res.pb(1);
u[cur] = 1;
for (int i = 0; i < N; i ++) {
M[cur] = 1;
for (int j = 0; j < N; j ++) {
if (!u[j] && j != cur) {
M[j] = 1;
int o = Query(M);
if (o == 1) {
u[j] = 1;
M[cur] = 0;
res.pb(j + 1);
cur = j;
break;
}
M[j] = 0;
}
}
}
reverse(res.begin(),res.end());
M[cur] = 0;
cur = 0;
for (int i = 0; i < N; i ++) {
M[cur] = 1;
for (int j = 0; j < N; j ++) {
if (!u[j]) {
M[j] = 1;
int o = Query(M);
if (o == 1) {
u[j] = 1;
M[cur] = 0;
res.pb(j + 1);
cur = j;
break;
}
M[j] = 0;
}
}
}
Answer(res);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
177 ms |
304 KB |
Output is correct |
2 |
Incorrect |
359 ms |
308 KB |
Wrong Answer [3] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
177 ms |
304 KB |
Output is correct |
2 |
Incorrect |
359 ms |
308 KB |
Wrong Answer [3] |
3 |
Halted |
0 ms |
0 KB |
- |