# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
554612 | Arvin | Super Dango Maker (JOI22_dango3) | C++17 | 409 ms | 604 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "dango3.h"
#include <bits/stdc++.h>
using namespace std;
//namespace {
// int variable_example = 1;
//} // namespace
void Solve(int n, int m) {
int len = n*m;
vector<int> v;
for(int x=0;x<len;x++){
v.push_back(x+1);
}
int lst = len-1;
for(int x=len-1;x>=0;x--){
int res = Query(v);
if(res >= 1){
lst = x;
}
v.pop_back();
}
bool valid[len];
fill(valid, valid+len, false);
for(int x=0;x<=lst;x++) valid[x] = true;
for(int x=0;x<=lst;x++){
valid[x] ^= 1;
vector<int> w;
for(int y=0;y<=lst;y++){
if(valid[y]){
w.push_back(y+1);
}
}
int res = Query(w);
if(res >= 1){
continue;
}
valid[x] ^= 1;
}
int c[len];
fill(c, c+len, -1);
v.clear();
for(int x=0;x<=lst;x++){
if(valid[x]){
v.push_back(x+1);
}
}
for(int x=0;x<v.size();x++){
c[v[x]-1] = x;
}
for(int x=0;x<v.size()-1;x++){
vector<int> w;
for(int y=0;y<x;y++){
w.push_back(v[y]);
}
for(int y=x+1;y<v.size();y++){
w.push_back(v[y]);
}
int cnt = 1;
for(int y=0;y<len&&cnt<m;y++){
if(c[y] == -1){
w.push_back(y+1);
if(Query(w) >= 1){
cnt++;
c[y] = c[v[x]-1];
}
w.pop_back();
}
}
}
for(int x=0;x<len;x++){
if(c[x] == -1){
c[x] = c[v.back()-1];
}
}
vector<int> ans[n];
for(int x=0;x<len;x++){
ans[c[x]].push_back(x);
}
for(int x=0;x<m;x++){
vector<int> w;
for(int y=0;y<n;y++){
w.push_back(ans[y][x]+1);
}
Answer(w);
}
// vector<int> x(3);
// x[0] = 1;
// x[1] = 2;
// x[2] = 3;
// variable_example = Query(x);
// for (int i = 0; i < M; i++) {
// std::vector<int> a(N);
// for (int j = 0; j < N; j++) {
// a[j] = N * i + j + 1;
// }
// Answer(a);
// }
}
컴파일 시 표준 에러 (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... |