結果

問題 No.3184 Make Same
ユーザー 蜜蜂
提出日時 2025-06-14 02:00:41
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 298 ms / 2,000 ms
コード長 601 bytes
コンパイル時間 1,250 ms
コンパイル使用メモリ 105,512 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-06-18 02:05:07
合計ジャッジ時間 13,669 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }

  cout << 30 << endl;
  for(int i = 0; i < 30; i++){
    int r = n, add = (1 << (29 - i));
    for(int j = 0; j < n; j++){
      if(a[j] >= add){
        r = min(r, j);
        a[j] -= add;
      }
    }
    if(r == 0) cout << 1 << " " << n << " " << 0 << endl;
    else cout << 1 << " " << r << " " << add << endl;
    sort(a.begin(), a.end());
  }
}
0