結果
| 問題 |
No.5001 排他的論理和でランニング
|
| ユーザー |
tecchaxn
|
| 提出日時 | 2018-03-16 22:59:41 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 59 ms / 1,500 ms |
| コード長 | 824 bytes |
| コンパイル時間 | 1,097 ms |
| 実行使用メモリ | 7,424 KB |
| スコア | 35,933,375 |
| 最終ジャッジ日時 | 2020-03-12 19:29:27 |
|
ジャッジサーバーID (参考情報) |
judge9 / |
| 純コード判定しない問題か言語 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 50 |
ソースコード
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
//-----------------------------------------------------------------------
signed main()
{
int N,M; cin>>N>>M;
vector<int> a(N);
vector<int> v[30];
REP(i,N){
cin>>a[i];
int x=a[i],cnt=0;
while(x>0){
cnt++;
x>>=1;
}
v[cnt].push_back(a[i]);
}
vector<int> ans;
for(int i=29;i>=0;i--){
if(v[i].size()>0){
ans.push_back(v[i][0]);
break;
}
}
sort(ALL(a));
REP(i,N){
if(a[i]!=ans[0] and ans.size()<M) ans.push_back(a[i]);
}
REP(i,M){
if(i) cout<<' ';
cout<<ans[i];
}
cout<<endl;
}
tecchaxn