# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
464020 |
2021-08-12T08:42:46 Z |
CyberCow |
Rack (eJOI19_rack) |
C++17 |
|
13 ms |
8460 KB |
#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;
}
Compilation message
rack.cpp: In function 'int main()':
rack.cpp:47:15: warning: unused variable 'j' [-Wunused-variable]
47 | int n, i, j, k;
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
316 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
320 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
316 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
320 KB |
Output is correct |
6 |
Correct |
0 ms |
332 KB |
Output is correct |
7 |
Correct |
1 ms |
332 KB |
Output is correct |
8 |
Correct |
1 ms |
716 KB |
Output is correct |
9 |
Correct |
4 ms |
2380 KB |
Output is correct |
10 |
Correct |
13 ms |
8460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
316 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
320 KB |
Output is correct |
6 |
Correct |
0 ms |
332 KB |
Output is correct |
7 |
Correct |
1 ms |
332 KB |
Output is correct |
8 |
Correct |
1 ms |
716 KB |
Output is correct |
9 |
Correct |
4 ms |
2380 KB |
Output is correct |
10 |
Correct |
13 ms |
8460 KB |
Output is correct |
11 |
Incorrect |
1 ms |
448 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |