結果
| 問題 |
No.3184 Make Same
|
| コンテスト | |
| ユーザー |
a01sa01to
|
| 提出日時 | 2025-06-24 00:41:06 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 356 ms / 2,000 ms |
| コード長 | 944 bytes |
| コンパイル時間 | 3,577 ms |
| コンパイル使用メモリ | 288,836 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-06-24 00:41:25 |
| 合計ジャッジ時間 | 18,081 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "settings/debug.cpp"
#else
#define Debug(...) void(0)
#endif
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int n;
cin >> n;
vector<int> a(n);
rep(i, n) cin >> a[i];
a.push_back((1 << 30) - 1); // 番兵
vector<tuple<int, int, int>> ans;
for (int b = 29; b >= 0; --b) {
sort(a.begin(), a.end());
for (int i = 0; i <= n; ++i) {
if (a[i] & (1 << b)) {
if (i != 0) {
ans.push_back({ 1, i, 1 << b });
for (int j = 0; j < i; ++j) a[j] += (1 << b);
}
break;
}
}
rep(i, n) assert(a[i] & (1 << b));
}
sort(a.begin(), a.end());
assert(a.front() == a.back());
cout << ans.size() << '\n';
for (auto [x, y, z] : ans) cout << x << ' ' << y << ' ' << z << '\n';
return 0;
}
a01sa01to