# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
622628 |
2022-08-04T12:46:43 Z |
froxyy |
Rack (eJOI19_rack) |
C++14 |
|
107 ms |
102400 KB |
#include <bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;typedef long double ld;typedef pair<int,int> pii;
#define F first
#define S second
#define PB push_back
#define MP make_pair
const ll mod = 1e9+7, N = 2e6+7, M = 2e6+7, INF = INT_MAX/10;
ll powe(ll x, ll y){ x = x%mod, y=y%(mod-1);ll ans = 1;while(y>0){if (y&1){ans = (1ll * x * ans)%mod;}y>>=1;x = (1ll * x * x)%mod;}return ans;}
void solve(){
ll n, k;
cin >> n >> k;
vector<ll> v = {1};
vector<ll> ans = {1};
ll x = pow(2, n-1);
while(x >= 1 || ans.size() < k)
{
for(size_t i=0; i<v.size(); i++)
ans.PB(v[i] + x);
x /= 2;
for(size_t i=v.size(); i<ans.size(); i++)
v.PB(ans[i]);
}
cout << ans[k-1] << '\n';
//for(size_t i=0; i<ans.size(); i++)
//cout << ans[i] << ' ';
}
signed main(){
fast;
int t = 1;
//cin >> t;
while(t--){
solve();
}
return 0;
}
Compilation message
rack.cpp: In function 'void solve()':
rack.cpp:22:32: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'll' {aka 'long long int'} [-Wsign-compare]
22 | while(x >= 1 || ans.size() < k)
| ~~~~~~~~~~~^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
320 KB |
Output is correct |
2 |
Correct |
0 ms |
324 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
320 KB |
Output is correct |
2 |
Correct |
0 ms |
324 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
468 KB |
Output is correct |
8 |
Correct |
2 ms |
1484 KB |
Output is correct |
9 |
Correct |
4 ms |
4668 KB |
Output is correct |
10 |
Correct |
22 ms |
16940 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
320 KB |
Output is correct |
2 |
Correct |
0 ms |
324 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
468 KB |
Output is correct |
8 |
Correct |
2 ms |
1484 KB |
Output is correct |
9 |
Correct |
4 ms |
4668 KB |
Output is correct |
10 |
Correct |
22 ms |
16940 KB |
Output is correct |
11 |
Runtime error |
107 ms |
102400 KB |
Execution killed with signal 9 |
12 |
Halted |
0 ms |
0 KB |
- |