75982024-01-10 00:48:38TuruTamasAutókódoláscpp14Forditási hiba
#include <bits/stdc++.h>
using namespace std;

#ifdef DEBUG
ifstream in_file("minta/be1.txt");
#define input in_file
#define INTHENAMEOFGOD
#else
#define input cin
#define INTHENAMEOFGOD \
    ios::sync_with_stdio(0); \
    cin.tie(0); \
    cout.tie(0);
#endif
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<ll, ll> pii;

ll N;

int main() {
    INTHENAMEOFGOD
    input >> N;
    bitset bits = bitset<64>(N);
    bool big = false, small = false;
    ll r_b = -1, r_s = -1;
    for (int i = 0; i < 63; i++) {
        if (!small && !bits[i] && bits[i+1]) {
            small = true;
            bitset b = bits;
            b[i] = true;
            b[i+1] = false;
            int first_before = 0;
            for (int k = 0; k < i; k++) {
                if (b[k])
                    first_before = k;
            }
            
            bitset<64> mask((b >> i) << i);
            b = (b << 64-i) >> 64-i;
            b <<= i-first_before-1;
            b |= mask;            
            r_s = b.to_ullong();
        }
        if (!big && bits[i] && !bits[i+1]) {
            big = true;
            bitset b = bits;
            b[i] = false;
            b[i+1] = true;
            size_t first = b._Find_first();
            bitset mask = (b >> i) << i;
            b <<= 64-i;
            b >>= 64-i+first;
            b |= mask;
            r_b = b.to_ullong();
        }
    }
    cout << r_s << "\n" << r_b << endl;
}
Forditási hiba
exit status 1
main.cpp: In function 'int main()':
main.cpp:26:12: error: missing template arguments before 'bits'
   26 |     bitset bits = bitset<64>(N);
      |            ^~~~
main.cpp:30:24: error: 'bits' was not declared in this scope
   30 |         if (!small && !bits[i] && bits[i+1]) {
      |                        ^~~~
main.cpp:32:20: error: missing template arguments before 'b'
   32 |             bitset b = bits;
      |                    ^
main.cpp:33:13: error: 'b' was not declared in this scope
   33 |             b[i] = true;
      |             ^
main.cpp:47:21: error: 'bits' was not declared in this scope
   47 |         if (!big && bits[i] && !bits[i+1]) {
      |                     ^~~~
main.cpp:49:20: error: missing template arguments before 'b'
   49 |             bitset b = bits;
      |                    ^
main.cpp:50:13: error: 'b' was not declared in this scope
   50 |             b[i] = false;
      |             ^
main.cpp:53:20: error: missing template arguments before 'mask'
   53 |       ...