Submission #284088

# Submission time Handle Problem Language Result Execution time Memory
284088 2020-08-26T18:06:06 Z Patrusheva_Anna Rack (eJOI19_rack) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")

#define ll long long
#define pb push_back
#define F first
#define S second
#define ull unsigned long long
#define pii pair < int, int >
#define ld long double


using namespace std;
using namespace __gnu_pbds;

mt19937 gen(time(0));
template <typename T>
using ordered_set=tree<T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;

ll n;
void Solve(ll k)
{


    vector < ll > p;
    for (int i = min(n - 1, (long long)60); i >= 1; i--) p.pb((1ll << i));

    ll ans = 1;
    for (int i = 0; i < min((long long)60, (int)p.size()); i++)
    {
        if ((1ll << i) > k) break;
        ll kol = k / (1ll << i);
        ll ost = k % (1ll << i);

        if (kol % 2 == 1 && ost > 0)
            ans = (ans + p[i]) % 1000000007;
        else
            if (kol % 2 == 0 && ost == 0)
            ans = (p[i] + ans) % 1000000007;
    }

    cout << ans<< "\n";
}

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);


#ifdef LOCAL
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#else

#endif


    cin >> n;

    ll k;
    cin >> k;
    Solve(k);








    return 0;

}

Compilation message

rack.cpp: In function 'void Solve(long long int)':
rack.cpp:34:57: error: no matching function for call to 'min(long long int, int)'
   34 |     for (int i = 0; i < min((long long)60, (int)p.size()); i++)
      |                                                         ^
In file included from /usr/include/c++/9/bits/char_traits.h:39,
                 from /usr/include/c++/9/ios:40,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from rack.cpp:1:
/usr/include/c++/9/bits/stl_algobase.h:198:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  198 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:198:5: note:   template argument deduction/substitution failed:
rack.cpp:34:57: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   34 |     for (int i = 0; i < min((long long)60, (int)p.size()); i++)
      |                                                         ^
In file included from /usr/include/c++/9/bits/char_traits.h:39,
                 from /usr/include/c++/9/ios:40,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from rack.cpp:1:
/usr/include/c++/9/bits/stl_algobase.h:246:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  246 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:246:5: note:   template argument deduction/substitution failed:
rack.cpp:34:57: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   34 |     for (int i = 0; i < min((long long)60, (int)p.size()); i++)
      |                                                         ^
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from rack.cpp:1:
/usr/include/c++/9/bits/stl_algo.h:3444:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3444 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3444:5: note:   template argument deduction/substitution failed:
rack.cpp:34:57: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   34 |     for (int i = 0; i < min((long long)60, (int)p.size()); i++)
      |                                                         ^
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from rack.cpp:1:
/usr/include/c++/9/bits/stl_algo.h:3450:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3450 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3450:5: note:   template argument deduction/substitution failed:
rack.cpp:34:57: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   34 |     for (int i = 0; i < min((long long)60, (int)p.size()); i++)
      |                                                         ^