답안 #546193

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
546193 2022-04-06T15:45:21 Z leaked Super Dango Maker (JOI22_dango3) C++17
22 / 100
4594 ms 760 KB
#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(n,vec<int>());
    vec<int> clr(n*m+1);
    vec<bool>used(n*m+1,0);
    auto ask=[&](vec<int> ids){
        vec<int> wt;
        for(auto &i : ids) used[i]=1;
        for(int i=1;i<=n*m;i++){
            if(!used[i]) wt.pb(i);
        }
        for(auto &i : ids) used[i]=0;
        return Query(wt);
//        vec<boo
    };
    for(int i=1;i<=n*m;i++){
        vec<int> me=dif;
        me.pb(i);
//        cout<<"HEY "<<
        if(ask(me)==m-1){
            who[sz(dif)].pb(i);
            clr[i]=sz(dif);
            dif.pb(i);
//            cout<<"NE "<<i<<endl;
            continue;
        }
        vec<int> cand=dif;
        while(sz(cand)!=1){
            vec<int> lft,rgt;
            for(int j=0;j<sz(cand)/2;j++) lft.pb(cand[j]);
            for(int j=sz(lft);j<sz(cand);j++) rgt.pb(cand[j]);
            lft.pb(i);rgt.pb(i);

//            cout<<"WOW "<<endl;
//            for(auto &z : lft) cout<<z<<' ';
//            cout<<endl;
//            cout<<ask(lft)<<' '<<m-1<<endl;

            if(ask(lft)!=(m-2)) cand=rgt;
            else cand=lft;
            cand.pop_back();
        }
//        cout<<"YO "<<i<<' '<<clr[i]<<endl;
        clr[i]=clr[cand[0]];
//        cout<<"YO "<<i<<' '<<clr[i]<<endl;

        who[clr[i]].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(wow);
    }
}
/*
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

*/

Compilation message

dango3.cpp:26:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
   26 | int variable_example = 1;
      |     ^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 73 ms 340 KB Output is correct
2 Correct 71 ms 392 KB Output is correct
3 Correct 64 ms 364 KB Output is correct
4 Correct 65 ms 360 KB Output is correct
5 Correct 71 ms 340 KB Output is correct
6 Correct 75 ms 372 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1886 ms 628 KB Output is correct
2 Correct 1943 ms 636 KB Output is correct
3 Correct 1710 ms 576 KB Output is correct
4 Correct 1684 ms 600 KB Output is correct
5 Correct 1808 ms 500 KB Output is correct
6 Correct 1938 ms 520 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4594 ms 760 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -