Submission #448767

# Submission time Handle Problem Language Result Execution time Memory
448767 2021-08-01T12:36:14 Z UltraFalcon Rack (eJOI19_rack) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#define int int_128_t

using namespace std;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    const int limit = (1e9) + 7;

    int n, k;
    cin >> n >> k;

    k--;
    int i = n-1;
    int r = 1;

    while (i >= 0) {
        if (k % 2 == 1) {
            //assert(i < 60);
            r = (r + ((1ll << i) % limit)) % limit;
        }
        k /= 2;
        i--;
    }
    cout << r % limit << "\n";
}

Compilation message

rack.cpp: In function 'int main()':
rack.cpp:2:13: error: 'int_128_t' does not name a type; did you mean 'int32_t'?
    2 | #define int int_128_t
      |             ^~~~~~~~~
rack.cpp:10:11: note: in expansion of macro 'int'
   10 |     const int limit = (1e9) + 7;
      |           ^~~
rack.cpp:2:13: error: 'int_128_t' was not declared in this scope; did you mean 'int32_t'?
    2 | #define int int_128_t
      |             ^~~~~~~~~
rack.cpp:12:5: note: in expansion of macro 'int'
   12 |     int n, k;
      |     ^~~
rack.cpp:13:12: error: 'n' was not declared in this scope; did you mean 'yn'?
   13 |     cin >> n >> k;
      |            ^
      |            yn
rack.cpp:13:17: error: 'k' was not declared in this scope
   13 |     cin >> n >> k;
      |                 ^
rack.cpp:16:9: error: expected ';' before 'i'
   16 |     int i = n-1;
      |         ^
rack.cpp:17:9: error: expected ';' before 'r'
   17 |     int r = 1;
      |         ^
rack.cpp:19:12: error: 'i' was not declared in this scope
   19 |     while (i >= 0) {
      |            ^
rack.cpp:22:13: error: 'r' was not declared in this scope
   22 |             r = (r + ((1ll << i) % limit)) % limit;
      |             ^
rack.cpp:22:36: error: 'limit' was not declared in this scope
   22 |             r = (r + ((1ll << i) % limit)) % limit;
      |                                    ^~~~~
rack.cpp:27:13: error: 'r' was not declared in this scope
   27 |     cout << r % limit << "\n";
      |             ^
rack.cpp:27:17: error: 'limit' was not declared in this scope
   27 |     cout << r % limit << "\n";
      |                 ^~~~~