Submission #672847


Source Code Expand

#include<bits/stdc++.h>
using namespace std;

#define int long long
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}


void solve(){
    int N;cin>>N;
    vint v(60);
    rep(i,N)v[i]=N>>i&1;
    for(int i=59;i>0;i--){
        if(!v[i])continue;
        if(!v[i-1])continue;
        v[i]=0;
    }
    int ans=0;
    rep(i,60)ans|=v[i]<<i;
    cout<<ans<<endl;
}

signed main(){
    int T;cin>>T;
    while(T--)solve();
    return 0;
}

Submission Info

Submission Time
Task H - Bit Count
User latte0119
Language C++11 (GCC 4.9.2)
Score 0
Code Size 914 Byte
Status RE
Exec Time 283 ms
Memory 1048 KB

Judge Result

Set Name All
Score / Max Score 0 / 300
Status
AC × 1
RE × 8
Set Name Test Cases
All 00_sample.txt, 10_small_00.txt, 20_medium_01.txt, 20_medium_02.txt, 20_medium_03.txt, 30_large_04.txt, 30_large_05.txt, 30_large_06.txt, 80_power_of_2.txt
Case Name Status Exec Time Memory
00_sample.txt AC 27 ms 912 KB
10_small_00.txt RE 278 ms 760 KB
20_medium_01.txt RE 277 ms 800 KB
20_medium_02.txt RE 281 ms 928 KB
20_medium_03.txt RE 277 ms 796 KB
30_large_04.txt RE 279 ms 1048 KB
30_large_05.txt RE 271 ms 812 KB
30_large_06.txt RE 283 ms 864 KB
80_power_of_2.txt RE 279 ms 928 KB