結果
| 問題 |
No.3184 Make Same
|
| コンテスト | |
| ユーザー |
umezo
|
| 提出日時 | 2025-06-21 02:21:38 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 295 ms / 2,000 ms |
| コード長 | 837 bytes |
| コンパイル時間 | 3,399 ms |
| コンパイル使用メモリ | 284,632 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-06-21 02:21:55 |
| 合計ジャッジ時間 | 15,508 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
template <class T> using V=vector<T>;
template <class T> using VV=V<V<T>>;
using u128=__int128_t;
using ll=long long;
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n;
cin>>n;
V<int> A(n);
rep(i,n) cin>>A[i];
V<int> L,R,C;
for(int i=29;i>=0;i--){
int t=(1<<i);
if((A[0]>>i)&1) continue;
int r=-1;
rep(j,n){
if(((A[j]>>i)&1)==0){
r=j;
A[j]|=t;
}
}
L.push_back(0);
R.push_back(r);
C.push_back(t);
sort(ALL(A));
}
int m=L.size();
cout<<m<<endl;
rep(i,m) cout<<L[i]+1<<" "<<R[i]+1<<" "<<C[i]<<endl;
return 0;
}
umezo