# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
464020 | CyberCow | Rack (eJOI19_rack) | C++17 | 13 ms | 8460 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <cmath>
#include <map>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <iterator>
#include <stack>
using namespace std;
using ll = long long;
int a[2000000];
int b[2000000];
int erk = 1;
void rec(int p, int qan)
{
if (p >= erk)
{
a[p - erk] = qan;
}
else
{
rec(p * 2, (qan + 1) / 2);
rec(p * 2 + 1, qan / 2);
}
}
void rec1(int p, int qan)
{
if (p >= erk)
{
b[p - erk] = qan;
}
else
{
rec1(p * 2, (qan + 1) / 2);
rec1(p * 2 + 1, qan / 2);
}
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, i, j, k;
cin >> n >> k;
for ( i = 0; i < n; i++)
{
erk *= 2;
}
rec(1, k);
rec1(1, k - 1);
i = 0;
while (a[i] == b[i])
{
i++;
}
cout << i + 1;
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |