# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
952062 | goodspeed0208 | Super Dango Maker (JOI22_dango3) | C++17 | 52 ms | 1108 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>
#include <vector>
using namespace std;
namespace {
int variable_example = 1;
} // namespace
void Solve(int n, int m) {
srand(time(NULL));
vector<int>used(n*m+1, 0);
for (int k = 1 ; k <= m ; k++) {
vector<int>rd(n*m+1);
for (int i = 0 ; i <= n*m ; i++) rd[i] = i;
random_shuffle(rd.begin()+1, rd.end());
vector<int>v;
vector<int>ans;
for (int i = 1 ; i <= n*m ; i++) if (!used[rd[i]]) v.push_back(rd[i]);
int num = 0;
for (int i = 1 ; i <= n*m ; i++) {
if (used[rd[i]]) continue;
v.erase(find(v.begin(), v.end(), rd[i]));
// cout << rd[i] <<"\n";
int q = Query(v);
num++;
if (q == m-k) {
ans.push_back(rd[i]);
used[rd[i]] = 1;
} else {
v.push_back(rd[i]);
}
if (ans.size() == n) break;
}
assert(num <= n*5);
Answer(ans);
}
}
//g++ -std=gnu++14 -O2 -o grader grader.cpp dango3.cpp
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... |