이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "dango3.h"
#include <bits/stdc++.h>
using namespace std;
void Solve(int n, int m) {
int len = n*m;
vector<int> comp[m+1];
int idx = 0;
comp[idx].push_back(1);
for(int x=2;x<=len;x++){
int pos = idx+1;
int left = 0, right = idx;
while(left <= right){
int mid = (left+right) >> 1;
bool exist[len+1];
fill(exist, exist+len+1, true);
exist[x] = false;
for(int y=0;y<=mid;y++){
for(auto idx : comp[y]){
exist[idx] = false;
}
}
vector<int> w;
for(int y=1;y<=len;y++){
if(exist[y]) w.push_back(y);
}
// cout << x << " " << idx << " -> " << " " << mid << " " << ask(w) << "\n";
if(Query(w) == m-(mid+1)){
pos = mid;
right = mid-1;
} else {
left = mid+1;
}
}
// cout << x << " = " << pos << "\n";
comp[pos].push_back(x);
idx = max(idx, pos);
}
for(int x=0;x<m;x++){
vector<int> w;
for(int y=0;y<n;y++){
w.push_back(comp[x][y]);
}
Answer(w);
}
}
# | 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... |