Submission #237667

#TimeUsernameProblemLanguageResultExecution timeMemory
237667tb_03Rack (eJOI19_rack)C++14
100 / 100
9 ms384 KiB
#include <iostream> using namespace std; typedef unsigned long long ll; const ll modulo = 1000000007; ll n, k; bool ans[1000005]; void recursiva(ll level, ll casacos) { if (level == n) return; if (casacos % 2 == 0) recursiva(level + 1, casacos / 2); else { ans[level] = true; recursiva(level + 1, (casacos - 1) / 2); } } int main() { cin >> n >> k; recursiva(0, k - 1); ll res = 0; for (int i = 0; i < n; i++) res = ((res << 1) | ans[i]) % modulo; cout << res + 1 << endl; return 0; }

Compilation message (stderr)

rack.cpp: In function 'int main()':
rack.cpp:30:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < n; i++)
                   ~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...