結果
| 問題 |
No.3184 Make Same
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-06-20 22:15:32 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,010 bytes |
| コンパイル時間 | 1,551 ms |
| コンパイル使用メモリ | 173,312 KB |
| 実行使用メモリ | 16,072 KB |
| 最終ジャッジ日時 | 2025-06-20 22:15:45 |
| 合計ジャッジ時間 | 5,650 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | TLE * 1 -- * 23 |
コンパイルメッセージ
main.cpp: In function ‘void solve()’:
main.cpp:35:18: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions]
35 | for(auto [l, r, x] : op){
| ^
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define fi first
#define se second
mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());
const ll MOD1000000007 = 1000000007;
const ll MOD998244353 = 998244353;
const ll MOD[3] = {999727999, 1070777777, 1000000007};
const ll LINF = 1LL << 60LL;
const int IINF = (1 << 30) - 1;
void solve(){
int n; cin >> n;
vector<ll> a(n); for(int i=0; i<n; i++) cin >> a[i];
vector<tuple<int, int, ll>> op;
while(true){
int r;
for(r=n-1; r>=0; r--) if(a[r] < a[n-1]) break;
if(r == -1) break;
int m = (r+2)/2;
op.emplace_back(1, m, a[n-1]-a[m-1]);
for(int i=0; i<m; i++) a[i] += a[n-1]-a[m-1];
sort(all(a));
}
cout << (int)op.size() << '\n';
for(auto [l, r, x] : op){
cout << l << ' ' << r << ' ' << x << '\n';
}
}
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
int T=1;
//cin >> T;
while(T--) solve();
}