結果
問題 |
No.3184 Make Same
|
ユーザー |
|
提出日時 | 2025-06-20 21:27:11 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 326 ms / 2,000 ms |
コード長 | 463 bytes |
コンパイル時間 | 769 ms |
コンパイル使用メモリ | 76,996 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-06-20 21:27:26 |
合計ジャッジ時間 | 14,067 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:23:17: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 23 | for(auto[x,y,z]:T)cout<<x<<" "<<y<<" "<<z<<"\n"; | ^
ソースコード
#include<iostream> #include<vector> #include<tuple> #include<algorithm> #include<cassert> using namespace std; int N,A[2<<17]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin>>N; for(int i=0;i<N;i++)cin>>A[i]; vector<tuple<int,int,int> >T; for(int k=30;k--;) { int r=0; while(r<N&&!(A[r]>>k&1))A[r]+=1<<k,r++; if(r)T.emplace_back(1,r,1<<k); sort(A,A+N); } cout<<T.size()<<"\n"; for(auto[x,y,z]:T)cout<<x<<" "<<y<<" "<<z<<"\n"; }