結果

問題 No.3184 Make Same
ユーザー yu23578
提出日時 2025-06-20 21:59:10
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 107 ms / 2,000 ms
コード長 531 bytes
コンパイル時間 2,297 ms
コンパイル使用メモリ 205,400 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-06-20 21:59:36
合計ジャッジ時間 11,272 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define int long long

int N;

signed main(){
  cin>>N;
  int M = 0;
  vector<string> ans;
  vector<int> A(N);
  for(int i = 0; i < N; i++) cin>>A[i];
  for(int i = 29; i >= 0; i--){
    int now = (1<<i);
    int cnt = 0;
    for(int j = 0; j < N; j++){
      if(!(A[j] & now)) cnt++;
    }
    if(cnt == 0) continue;
    M++;
    ans.push_back(to_string(1) + " " + to_string(cnt) + " " + to_string(now));
  }
  cout << M << endl;
  for(int i = 0; i < M; i++) cout << ans[i] << endl;
}
0