# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
923172 | alexdd | Super Dango Maker (JOI22_dango3) | C++17 | 172 ms | 848 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 "dango3.h"
#include <bits/stdc++.h>
using namespace std;
int n,m;
vector<int> ord;
void scoate_unu()
{
int ult=-1;
vector<int> aux;
for(int i=0;i<ord.size();i++)
{
aux.push_back(ord[i]);
if(Query(aux)==1)
{
ult=i;
break;
}
}
aux.clear();
for(int i=ult;i>=0;i--)
{
vector<int> cv = aux;
for(int j=i-1;j>=0;j--)
cv.push_back(ord[j]);
if((int)aux.size()+i+1==n || i==ult || Query(cv)==0)
{
aux.push_back(ord[i]);
ord.erase(ord.begin()+i);
}
}
///scoate din ord
Answer(aux);
}
void Solve(int N, int M)
{
n=N;
m=M;
for(int i=1;i<=n*m;i++)
ord.push_back(i);
random_shuffle(ord.begin(),ord.end());
for(int i=1;i<m;i++)
{
scoate_unu();
}
Answer(ord);
}
/**
3 2
3 3 1 2 1 2
*/
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |