Submission #693200

# Submission time Handle Problem Language Result Execution time Memory
693200 2023-02-02T13:04:29 Z testttt Rack (eJOI19_rack) C++14
0 / 100
1 ms 300 KB
#include <bits/stdc++.h>

using namespace std;

#define ll long long

const ll mod = 1e9 + 7;

long long exp(long long x, long long y, long long p) {
	long long res = 1; x %= p;
	while (y) {
		if (y & 1) {
			res *= x; res %= p; 
		}
		x *= x; x %= p;
		y >>= 1;
	}
	return res;
}

int main(){
    ll n , k;cin >> n >> k;
    -- k;
    ll ans = 1;
    for(int i = 0;i <= log(k) + 1;i ++){
        if((1 << i) & k){
            (ans += exp(2 , n - i - 1 , mod)) % mod;
        }
    }
    cout << ans << endl;
}

Compilation message

rack.cpp: In function 'int main()':
rack.cpp:27:47: warning: value computed is not used [-Wunused-value]
   27 |             (ans += exp(2 , n - i - 1 , mod)) % mod;
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 300 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 300 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 300 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -