답안 #237666

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
237666 2020-06-08T08:15:29 Z tb_03 Rack (eJOI19_rack) C++14
40 / 100
5 ms 384 KB
#include <iostream>
 
using namespace std;
typedef unsigned long long ll;
 
const ll modulo = 1000000007;
ll n, k;
bool ans[1000005];
 
void recursiva(int level, int 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

rack.cpp: In function 'void recursiva(int, int)':
rack.cpp:12:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (level == n)
       ~~~~~~^~~~
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++)
                   ~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Correct 4 ms 256 KB Output is correct
5 Correct 4 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Correct 4 ms 256 KB Output is correct
5 Correct 4 ms 256 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 4 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Correct 4 ms 256 KB Output is correct
5 Correct 4 ms 256 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 4 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 4 ms 384 KB Output is correct
12 Incorrect 5 ms 384 KB Output isn't correct
13 Halted 0 ms 0 KB -