Submission #999886

# Submission time Handle Problem Language Result Execution time Memory
999886 2024-06-16T08:16:41 Z vjudge1 Rack (eJOI19_rack) C++17
0 / 100
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 MAX  = 2e5+1;

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;
            // cout << 
          
          
            sub =(1^((m+1)%2)) * bb;
            cout << add+ sub<< endl;
        }
        else{
            add = ((m/4)) *bb +2;
           
            if(m>2) sub =(1^((m+1)%2)) * bb;
            else sub = 0;
            cout << add+ sub<< endl;
        }
    }
    else{
        
         if(m%2==0){
             add = (m/4) *bb +1+b;
            // cout << 
          
          
            sub =(1^((m+1)%2)) * bb;
            cout << add+ sub<< endl;
        }
        else{
            add = ((m/4)) *bb +1;
           
            if(m>2) sub =(1^((m+1)%2)) * bb;
            else sub = 0;
            cout << add+ sub<< endl;
        }
    }
    
}

Compilation message

rack.cpp: In function 'int main()':
rack.cpp:18:8: warning: unused variable 'cnt' [-Wunused-variable]
   18 |     ll cnt = 0;
      |        ^~~
rack.cpp:19:10: warning: unused variable 'c' [-Wunused-variable]
   19 |     char c;
      |          ^
rack.cpp:20:8: warning: unused variable 'keep' [-Wunused-variable]
   20 |     ll keep = 0;
      |        ^~~~
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -