Submission #546178

# Submission time Handle Problem Language Result Execution time Memory
546178 2022-04-06T15:19:38 Z leaked Super Dango Maker (JOI22_dango3) C++17
2 / 100
257 ms 1816 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();
//        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;
      |     ^~~~~~~~~~~~~~~~
# Verdict Execution time Memory 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 1 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 58 ms 808 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 115 ms 1816 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 257 ms 1140 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -