結果
問題 |
No.3184 Make Same
|
ユーザー |
|
提出日時 | 2025-06-20 22:26:27 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 343 ms / 2,000 ms |
コード長 | 676 bytes |
コンパイル時間 | 1,965 ms |
コンパイル使用メモリ | 204,440 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-06-20 22:26:45 |
合計ジャッジ時間 | 16,298 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; vector<int> A(N); for(auto &a : A) cin >> a; vector<tuple<int,int,int>> answer; while(answer.size() < 30){ sort(A.begin(),A.end()); int mina = A.at(0),maxa = A.back(); int add = (maxa-mina+1)/2; int r = N-1; for(int i=0; i<N; i++) if(A.at(i)+add > maxa){r = i-1; break;} answer.push_back({0,r,add}); for(int i=0; i<=r; i++) A.at(i) += add; } cout << answer.size() << "\n"; for(auto &[l,r,v] : answer) cout << l+1 << " " << r+1 << " " << v << "\n"; }