結果
問題 |
No.3184 Make Same
|
ユーザー |
|
提出日時 | 2025-07-03 01:59:45 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 346 ms / 2,000 ms |
コード長 | 766 bytes |
コンパイル時間 | 2,035 ms |
コンパイル使用メモリ | 198,524 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-07-03 02:00:03 |
合計ジャッジ時間 | 16,928 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
#include <bits/stdc++.h> #define INF 1000000001LL #define LNF 1000000000000000001LL #define MOD 1000000007LL #define MAX 200000 #define long long long #define all(x) x.begin(),x.end() using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; vector<int> arr(n); for(int i = 0; i<n; i++) cin >> arr[i]; cout << 30 << "\n"; for(int i = 29; i >=0; i--) { int end = n; for(int j = 0; j<n; j++) { if(arr[j]&(1<<i)) { end = j; break; } arr[j]|=(1<<i); } sort(all(arr)); cout << 1 << " " << end+(end == 0) << " " << (1<<i)*(end != 0) << "\n"; } return 0; }