# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
46826 | MatheusLealV | Library (JOI18_library) | C++17 | 2096 ms | 676 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define Nmax 1005
#include "library.h"
using namespace std;
#define f first
#define s second
typedef pair<int, int> pii;
int n, used[Nmax], conta = 0;
void Solve(int N_)
{
n = N_;
if(n == 1)
{
vector<int> aux(1);
aux[0] = 1;
return Answer(aux);
}
vector<int> ans;
for(int i = 1; i <= n; i++)
{
vector<int> v(n);
for(int j = 0; j < n; j++) v[j] = 1;
v[i - 1] = 0;
if(Query(v) == 1)
{
used[i] = 1;
ans.push_back(i);
break;
}
}
for(int i = 1; i < n; i++)
{
for(int j = 1; j <= n; j++)
{
if(used[j]) continue;
vector<int> atual(n);
for(int z = 0; z < ans.size(); z++)
{
atual[ ans[z] - 1] = 1;
}
atual[j - 1] = 1;
if(Query(atual) == 1)
{
used[j] = 1;
ans.push_back(j);
break;
}
}
}
Answer(ans);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |