답안 #546180

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
546180 2022-04-06T15:20:40 Z leaked Super Dango Maker (JOI22_dango3) C++17
2 / 100
263 ms 1868 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
vec<int> ids;
int n,m;
void rec(vec<int> vc){
    if(sz(vc)==n){
        Answer(vc);
        return;
    }
    random_shuffle(all(vc));
    vec<int> ask;
    for(int i=0;i<sz(vc);i++){
        ask.pb(vc[i]);
        if(sz(ask)>=n){
            if(Query(ask)==1){
                for(int j=i+1;j<sz(vc);j++)
                    ids.pb(vc[j]);

                rec(ask);

                return;
            }
        }
    }

}
void Solve(int n, int m) {
    ::n=n;::m=m;
//    vec<int> ids;
    for(int i=1;i<=n*m;i++) ids.pb(i);
//    queue<vec<int>> q;
//    q.push(ids);
    int i=0;
    while(sz(ids)){
        vec<int> ask;
        vec<int> vc=ids;
        ids.clear();
        random_shuffle(all(ids));
//        cerr<<"SZ "<<sz(ids)<<endl;
        for(int i=0;i<sz(vc);i++){
            ask.pb(vc[i]);
            if(sz(ask)>=n){
                if(Query(ask)==1){
                    rec(ask);
                    for(int j=i+1;j<sz(vc);j++)
                        ids.pb(vc[j]);
                    break;
                }
            }
        }
    }
}
/*
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: In function 'void Solve(int, int)':
dango3.cpp:59:9: warning: unused variable 'i' [-Wunused-variable]
   59 |     int i=0;
      |         ^
dango3.cpp: At global scope:
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 0 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 Incorrect 60 ms 792 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 104 ms 1868 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 263 ms 1236 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -