Submission #1053421

# Submission time Handle Problem Language Result Execution time Memory
1053421 2024-08-11T11:33:25 Z Zicrus Bit Shift Registers (IOI21_registers) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "registers.h"
using namespace std;

typedef long long ll;

void n2k1() {
    append_move(1, 0);
	append_right(1, 1, 1);
	append_and(0, 0, 1);
}

vector<bool> num(ll num) {
    vector<bool> res(2000);
    for (int i = 0; i < 2000; i++) {
        ll numBit = min((unsigned long long)i, sizeof(ll)-1);
        res[i] = (num >> numBit) & 1;
    }
    return res;
}

void construct_instructions(int s, int n, int k, int q) {
	if (n == 2 && k == 1) return n2k1();

    append_store(99, num(3));
    append_right(1, 0, 1);
    append_and(0, 0, 99);
    append_store(99, num(1));
    append_not(2, 1);
    append_add(2, 2, 99);
    append_add(2, 0, 2);
    append_right(2, 2, 10);
    append_and(1, 1, 2);
    append_not(2, 2);
    append_and(0, 0, 2);
    append_or(0, 0, 1);
}

Compilation message

registers.cpp: In function 'std::vector<bool> num(ll)':
registers.cpp:16:60: error: no matching function for call to 'min(long long unsigned int, long unsigned int)'
   16 |         ll numBit = min((unsigned long long)i, sizeof(ll)-1);
      |                                                            ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from registers.cpp:1:
/usr/include/c++/10/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++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
registers.cpp:16:60: note:   deduced conflicting types for parameter 'const _Tp' ('long long unsigned int' and 'long unsigned int')
   16 |         ll numBit = min((unsigned long long)i, sizeof(ll)-1);
      |                                                            ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from registers.cpp:1:
/usr/include/c++/10/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++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
registers.cpp:16:60: note:   deduced conflicting types for parameter 'const _Tp' ('long long unsigned int' and 'long unsigned int')
   16 |         ll numBit = min((unsigned long long)i, sizeof(ll)-1);
      |                                                            ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from registers.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
registers.cpp:16:60: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long unsigned int'
   16 |         ll numBit = min((unsigned long long)i, sizeof(ll)-1);
      |                                                            ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from registers.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed:
registers.cpp:16:60: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long unsigned int'
   16 |         ll numBit = min((unsigned long long)i, sizeof(ll)-1);
      |                                                            ^