QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#359011 | #7940. Impossible Numbers | UNos_maricones | Compile Error | / | / | C++20 | 1.5kb | 2024-03-20 10:36:31 | 2024-03-20 10:36:32 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int M = 6;
const int D = 10;
int main() {
cin.tie( NULL );
ios_base::sync_with_stdio( 0 );
int n, k;
cin >> n >> k;
vector< int > cn( 1 << D );
for( int i = 0; i < n; ++ i )
{
int mask = 0;
for( int j = 0; j < M; ++ j )
{
int x;
cin >> x;
mask |= ( 1 << x );
}
for( int mk = 0; mk < ( 1 << D); ++ mk )
cn[mk] += ( (mk & mask ) != 0 );
}
string curr = "";
for( int d = 1; ; ++ d )
{
vector< pair< int16_t, int16_t > > r0;
for( int mk = 0; mk < ( 1 << D ); ++ mk )
r0.push_back( { mk, cn[mk] } );
auto solve = [&]( int rd, bool all, vector< pair< int16_t, int16_t > > rem ) -> void {
erase_if( rem, [&](pair< int16_t, int16_t > x ) { return x.second >= rd; } );
if( !all && rem.empty() ) return;
if( rd == 0 )
{
cout << curr;
--k;
if( k == 0 )
{
cout << '\n';
exit( 0 );
}
cout << ' ';
return;
}
for( int di = ( rd == d ); di < D; ++di )
{
curr.push_back( '0' + di );
if( all )
{
solve( rd - 1, true, rem, solve );
}
else
{
bool n_all = all;
vector< pair< int16_t, int16_t > > n_rem = rem;
for( auto &[mk,del]: n_rem )
{
del -= ( mk >> di & 1 );
if( del < 0 )
{
n_all = true;
n_rem.clear();
break;
}
}
solve( rd - 1, n_all, n_rem, solve );
}
curr.pop_back();
}
};
solve( d, false, r0, solve );
}
return 0;
}
Details
answer.code: In lambda function: answer.code:59:41: error: use of ‘solve’ before deduction of ‘auto’ 59 | solve( rd - 1, true, rem, solve ); | ^~~~~ answer.code:59:67: error: use of ‘solve’ before deduction of ‘auto’ 59 | solve( rd - 1, true, rem, solve ); | ^~~~~ answer.code:75:41: error: use of ‘solve’ before deduction of ‘auto’ 75 | solve( rd - 1, n_all, n_rem, solve ); | ^~~~~ answer.code:75:70: error: use of ‘solve’ before deduction of ‘auto’ 75 | solve( rd - 1, n_all, n_rem, solve ); | ^~~~~ answer.code: In function ‘int main()’: answer.code:81:22: error: no match for call to ‘(main()::<lambda(int, bool, std::vector<std::pair<short int, short int> >)>) (int&, bool, std::vector<std::pair<short int, short int> >&, main()::<lambda(int, bool, std::vector<std::pair<short int, short int> >)>&)’ 81 | solve( d, false, r0, solve ); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~ answer.code:36:30: note: candidate: ‘main()::<lambda(int, bool, std::vector<std::pair<short int, short int> >)>’ 36 | auto solve = [&]( int rd, bool all, vector< pair< int16_t, int16_t > > rem ) -> void { | ^ answer.code:36:30: note: candidate expects 3 arguments, 4 provided