# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
546178 | leaked | Super Dango Maker (JOI22_dango3) | C++17 | 257 ms | 1816 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 <vector>
#include <bits/stdc++.h>
#define f first
#define s second
#define vec vector
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pw(x) (1LL<<(x))
#define sz(x) (int)(x).size()
#define m_p make_pair
#define fast_prep ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef long double ld;
template<class T> bool umin(T &a,const T &b){return (a>b?a=b,1:0);}
template<class T> bool umax(T &a,const T &b){return (a<b?a=b,1:0);}
const int N=1e5+1;
const ll inf=1e18;
namespace {
int variable_example = 1;
} // namespace
vec<int> ids;
int n,m;
void rec(vec<int> vc){
if(sz(vc)==n){
Answer(vc);
return;
}
random_shuffle(all(vc));
vec<int> ask;
for(int i=0;i<sz(vc);i++){
ask.pb(vc[i]);
if(sz(ask)>=n){
if(Query(ask)==1){
for(int j=i+1;j<sz(vc);j++)
ids.pb(vc[j]);
rec(ask);
return;
}
}
}
}
void Solve(int n, int m) {
::n=n;::m=m;
// vec<int> ids;
for(int i=1;i<=n*m;i++) ids.pb(i);
// queue<vec<int>> q;
// q.push(ids);
int i=0;
while(sz(ids)){
vec<int> ask;
vec<int> vc=ids;
ids.clear();
// cerr<<"SZ "<<sz(ids)<<endl;
for(int i=0;i<sz(vc);i++){
ask.pb(vc[i]);
if(sz(ask)>=n){
if(Query(ask)==1){
rec(ask);
for(int j=i+1;j<sz(vc);j++)
ids.pb(vc[j]);
break;
}
}
}
}
}
/*
3 2
3 3 1 2 1 2
4 4
2 2 3 2 4 4 3 2 3 1 1 3 4 1 4 1
*/
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... |