Submission #672848


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,60)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 915 Byte
Status WA
Exec Time 28 ms
Memory 924 KB

Judge Result

Set Name All
Score / Max Score 0 / 300
Status
AC × 1
WA × 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 26 ms 796 KB
10_small_00.txt WA 25 ms 792 KB
20_medium_01.txt WA 28 ms 792 KB
20_medium_02.txt WA 28 ms 796 KB
20_medium_03.txt WA 26 ms 924 KB
30_large_04.txt WA 28 ms 920 KB
30_large_05.txt WA 28 ms 920 KB
30_large_06.txt WA 24 ms 924 KB
80_power_of_2.txt WA 23 ms 924 KB