Submission #464954

# Submission time Handle Problem Language Result Execution time Memory
464954 2021-08-14T14:44:41 Z oscar1f Rack (eJOI19_rack) C++17
100 / 100
26 ms 16192 KB
#include<bits/stdc++.h>
using namespace std; 

#define int long long

const int MODULO=1000*1000*1000+7,MAX_N=1000*1000+1;
int n,k,rep;
int multi[MAX_N];
vector<int> kBin;

signed main() {
   ios_base::sync_with_stdio(false);
   cin>>n>>k;
   k--;
   multi[0]=1;
   for (int i=1;i<n;i++) {
      multi[i]=multi[i-1]*2;
      multi[i]%=MODULO;
   }
   for (int i=0;i<n;i++) {
      kBin.push_back(k%2);
      k/=2;
   }
   for (int i=n-1;i>=0;i--) {
      rep+=multi[i]*kBin[n-i-1];
      rep%=MODULO;
   }
   cout<<rep+1<<endl;
   return 0;
}
   
   
     
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 320 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 320 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 320 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 2 ms 332 KB Output is correct
13 Correct 1 ms 460 KB Output is correct
14 Correct 3 ms 1360 KB Output is correct
15 Correct 26 ms 16192 KB Output is correct