이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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
void Solve(int n, int m) {
// ::n=n;::m=m;
// vec<int> dif;
vec<vec<int>> who(m,vec<int>());
vec<bool>used(n*m+1,0);
auto ask=[&](vec<int> ids,int x){
vec<int> wt;
for(auto &i : ids){
for(auto &j : who[i]){
used[j]=1;
}
}
used[x]=1;
for(int i=1;i<=n*m;i++){
if(!used[i]) wt.pb(i);
}
for(auto &i : ids){
for(auto &j : who[i]){
used[j]=0;
}
}
used[x]=0;
return Query(wt);
// vec<boo
};
vec<int> ids;
for(int i=1;i<=n*m;i++) ids.pb(i);
for(int i=1;i<=n*m;i++){
vec<int> me;
for(int j=0;j<m;j++){
if(sz(who[j])!=n) me.pb(j);
}
vec<int> cand=me;
while(sz(cand)!=1){
vec<int> lft,rgt;
for(int j=0;j<(sz(cand)+1)/2;j++) lft.pb(cand[j]);
for(int j=sz(lft);j<sz(cand);j++) rgt.pb(cand[j]);
if(ask(lft,i)==(m-sz(lft)-1)) cand=rgt;
else cand=lft;
}
who[cand[0]].pb(i);
}
for(int j=0;j<m;j++){
// vec<int> wow;
// for(int i=0;i<n;i++)
// wow.pb(who[i][j]);
Answer(who[j]);
}
}
/*
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
*/
컴파일 시 표준 에러 (stderr) 메시지
dango3.cpp:26:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
26 | int variable_example = 1;
| ^~~~~~~~~~~~~~~~
# | 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... |