結果

問題 No.1372 Median of Submasks
コンテスト
ユーザー y61mpnl
提出日時 2021-02-20 20:49:41
言語 C++17
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 339 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,047 ms
コンパイル使用メモリ 208,712 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-06-18 05:01:02
合計ジャッジ時間 2,425 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 10 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<bits/stdc++.h>
#define REP(i,b,e) for(int i=b;i<e;i++)
using ll = int_fast64_t;

int main(){
	unsigned long n;
	scanf("%lu", &n);
	unsigned long cnt = __builtin_popcount(n);
	unsigned long a = (1lu << cnt) / 2, ans = 0;
	REP(i, 0, 60) if((n>>i)&1lu) {
		if(a&1lu) ans |= (1lu<<i);
		a >>= 1;
	}
	printf("%lu\n", ans);
	return 0;
}
0