結果

問題 No.3184 Make Same
ユーザー srjywrdnprkt
提出日時 2025-07-25 17:03:38
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 52 ms / 2,000 ms
コード長 910 bytes
コンパイル時間 3,583 ms
コンパイル使用メモリ 277,292 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-07-25 17:03:50
合計ジャッジ時間 11,991 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
//#include <atcoder/modint>

using namespace std;
//using namespace atcoder;
using ll = long long;
//using mint = modint998244353;

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    /*
       二進数

       001010
       001010
       100101
       110101
       111000

       i=29,...,0の順に
       2^iを足す。毎回ソートされるので
       ibit目が0のものは前半に来る。
    */

    int N;
    cin >> N;
    vector<int> A(N);
    cout << 30 << endl;
    for (int i=0; i<N; i++) cin >> A[i];
    for (int i=29; i>=0; i--){
        int cnt=0;
        for (int j=0; j<N; j++){
            if (!((A[j]>>i) & 1)) cnt++;
        }
        if (cnt){
            cout << 1 << " " << 1+cnt-1 << " " << (1<<i) << endl;
        }
        else{
            cout << 1 << " " << N << " " << (1<<i) << endl;
        }
    }

    return 0;
}
0