# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
971786 | 12345678 | Super Dango Maker (JOI22_dango3) | C++17 | 2304 ms | 1404 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;
const int nx=1e4+5;
int m, mx;
int max_cardinality(vector<int> v)
{
int d[nx];
for (int i=1; i<=mx; i++) d[i]=1;
for (auto x:v) d[x]=0;
vector<int> qrs;
for (int i=1; i<=mx; i++) if (d[i]) qrs.push_back(i);
return m-Query(qrs);
}
void solve(int x, vector<int> v)
{
//cout<<"size "<<x<<' '<<v.size()<<'\n';
if (x==1) return Answer(v), void();
vector<int> t, l, r;
int k=x/2;
for (int i=0; i<v.size(); i++)
{
t.push_back(v[i]);
/*
cout<<"query ";
for (auto y:t) cout<<y<<' ';
cout<<'\n';
cout<<"result "<<max_cardinality(t)<<'\n';
*/
if (max_cardinality(t)>k) t.pop_back(), r.push_back(v[i]);
else l.push_back(v[i]);
}
solve(k, l);
solve(x-k, r);
}
void Solve(int N, int M) {
m=M;
mx=N*M;
vector<int> v;
for (int i=1; i<=mx; i++) v.push_back(i);
solve(M, v);
}
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... |