Submission #892239

# Submission time Handle Problem Language Result Execution time Memory
892239 2023-12-25T05:38:10 Z vjudge1 Super Dango Maker (JOI22_dango3) C++17
2 / 100
74 ms 1116 KB
#include <bits/stdc++.h>

#include "dango3.h"

using namespace std;

#define all(x) x.begin(), x.end()
#define ar array
#define pb push_back
#define ln '\n'
//#define int long long

using i64 = long long;

template <class F, class _S>
bool chmin(F &u, const _S &v){
    bool flag = false;
    if ( u > v ){
        u = v; flag |= true;
    }
    return flag;
}

template <class F, class _S>
bool chmax(F &u, const _S &v){
    bool flag = false;
    if ( u < v ){
        u = v; flag |= true;
    }
    return flag;
}

void Solve(int n, int m){
    if ( true || n == 4 ){ // subtask #1
        vector <int> us(n * m + 1), tmp;
        auto dfs = [&](auto dfs, int pos) -> void{
            if ( pos == n * m + 1 || tmp.size() == n ){
                int q = 0;
                bool flag = false;
                for ( auto &x: tmp ){
                    flag |= us[x];
                }
                if ( tmp.size() == n && !flag ){
                    q = Query(tmp);
                }
                if ( q > 0 ){
                    Answer(tmp);
                    for ( auto &j: tmp ){
                        us[j] = true;
                    }
                } return;
            }
            if ( !us[pos] ){
                tmp.pb(pos);
                dfs(dfs, pos + 1);
                tmp.pop_back();
            }
            dfs(dfs, pos + 1);
        };
        dfs(dfs, 1);
        return;
    }
}

Compilation message

dango3.cpp: In instantiation of 'Solve(int, int)::<lambda(auto:23, int)> [with auto:23 = Solve(int, int)::<lambda(auto:23, int)>]':
dango3.cpp:60:19:   required from here
dango3.cpp:37:49: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   37 |             if ( pos == n * m + 1 || tmp.size() == n ){
      |                                      ~~~~~~~~~~~^~~~
dango3.cpp:43:33: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   43 |                 if ( tmp.size() == n && !flag ){
      |                      ~~~~~~~~~~~^~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 348 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 38 ms 856 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 74 ms 1116 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -