Submission #970567

# Submission time Handle Problem Language Result Execution time Memory
970567 2024-04-26T17:44:52 Z Ludissey Rack (eJOI19_rack) C++14
40 / 100
1 ms 348 KB
#include <bits/stdc++.h>
#define int long long
#define sz(a) (int)a.size()
#define all(x) (x).begin(), (x).end()
using namespace std;

const int mod=1e9+7;
vector<vector<pair<int,int>>> edges;
vector<vector<pair<int,int>>> edges2;
vector<int> topo;
vector<int> ssc;
map<string,int> mp;

vector<vector<int>> circle;
vector<int> visited;
vector<int> dp;
vector<set<pair<int,int>>> contr_edges;
vector<set<pair<int,int>>> contr_edges_inv;

int MOD(int x){
    return ((x+mod)%mod);
}

int fast_pow(int x, int p){
    if(p==1) return x;
    if(p==0) return 1;
    if(p%2==0) return MOD(MOD(fast_pow(x,p/2))*MOD(fast_pow(x,p/2)));
    else return MOD(MOD(fast_pow(x,p-1))*x);
}

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
    int n,k; cin >> n>>k;
    k--;
    int sum=1;
    for (int i = 1; i <= n; i++)
    {
        if(k&(1<<(i-1))) sum=MOD(sum+fast_pow(2, (n-i)));
    }
    cout << sum << "\n";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Incorrect 1 ms 348 KB Output isn't correct
12 Halted 0 ms 0 KB -