Submission #1151504

#TimeUsernameProblemLanguageResultExecution timeMemory
1151504KluydQCONSUL (info1cup19_consul)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "grader.h"
 
#define respagold ios_base::sync_with_stdio(0), cin.tie(0);
#define ll long long
#define int2 __int128_t
#define FOR( i, x, n, d ) for( int i = x; i <= n; i += d )
#define FORR( i, x, n, d ) for( int i = x; i >= n; i -= d )
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x.size())
#define pb push_back
#define ins insert
#define lb lower_bound
#define ub upper_bound
#define pii pair <int, int>
#define mkp make_pair
 
using namespace std;
 
const int N1 = 2e5 + 123;
// const int inf = 1e18;
// const int MOD = 1e9 + 7;
// const int MOD1 = 998244353;
// const int P = 6547;
// const int lo = 1e15;
 
int a[N1], n, m, k, z, w, ans, x, y;

mt19937 rng( chrono::steady_clock::now().time_since_epoch().count());
 
int rand( int l, int r )
{
    uniform_int_distribution <int> uid( l, r );
    return uid( rng );
}
void solve( int N )
{
	n = N;
	int num = min( n, 30ll );
	
	FOR( i, 1, n, 1 ) a[i] = i;
	random_shuffle( a + 1, a + n + 1 );
	int ans = -1;
	
	FOR( i, 1, num, 1 )
	{
		x = kth(a[i]);
		y = cnt(x);
		
		if( y > n / 3 ) ans = x;
	}
	say_answer(ans);
}
//signed main() 
//{
////	freopen("connect.in", "r", stdin);
////	freopen("connect.out", "w", stdout);
//	    
//    respagold
//    
//    int test = 0;
//    
//    if( !test ) cin >> test;
//	
//	while( test -- )
//	{
//		solve();
//	}
//}
//// solved by KluydQ  

Compilation message (stderr)

consul.cpp: In function 'void solve(int)':
consul.cpp:41:22: error: no matching function for call to 'min(int&, long long int)'
   41 |         int num = min( n, 30ll );
      |                   ~~~^~~~~~~~~~~
In file included from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from consul.cpp:1:
/usr/include/c++/11/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/11/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
consul.cpp:41:22: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   41 |         int num = min( n, 30ll );
      |                   ~~~^~~~~~~~~~~
In file included from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from consul.cpp:1:
/usr/include/c++/11/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
consul.cpp:41:22: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   41 |         int num = min( n, 30ll );
      |                   ~~~^~~~~~~~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from consul.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3449:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3449 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3449:5: note:   template argument deduction/substitution failed:
consul.cpp:41:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   41 |         int num = min( n, 30ll );
      |                   ~~~^~~~~~~~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from consul.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3455:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3455 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3455:5: note:   template argument deduction/substitution failed:
consul.cpp:41:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   41 |         int num = min( n, 30ll );
      |                   ~~~^~~~~~~~~~~