# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
999890 | 2024-06-16T08:25:55 Z | vjudge1 | Rack (eJOI19_rack) | C++17 | 0 ms | 348 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long #define f first #define s second #define pb push_back #define pf push_front #define pi pair<int,int> const int mod = 1e9+7; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll n,m; cin >> n >> m; ll cnt = 0; char c; ll keep = 0; ll add, sub; ll b,bb; b = (1<<(n-1)); bb = (1<<(n-2)); if((1<<n)/2<m){ m-= (1<<n)/2; if(m%2==0){ add = (m/4) *bb +2+b; add %=mod; sub =(1^((m+1)%2)) * bb; sub%=mod; cout << (add+ sub)%mod<< endl; } else{ add = ((m/4)) *bb +2; add %=mod; if(m>2) sub =(1^((m+1)%2)) * bb; else sub = 0; sub%=mod; cout << (add+ sub)%mod<< endl; } } else{ if(m%2==0){ add = (m/4) *bb +1+b; // cout << add %=mod; sub =(1^((m+1)%2)) * bb; sub%=mod; cout << (add+ sub)%mod<< endl; } else{ add = ((m/4)) *bb +1; add %=mod; if(m>2) sub =(1^((m+1)%2)) * bb; else sub = 0; sub%=mod; cout << (add+ sub)%mod<< endl; } } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |