結果

問題 No.3184 Make Same
ユーザー iastm
提出日時 2025-07-11 12:13:59
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 550 bytes
コンパイル時間 980 ms
コンパイル使用メモリ 92,436 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2025-07-11 12:14:15
合計ジャッジ時間 14,490 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 4 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <tuple>

int main() {
    int N;
    std::cin >> N;
    std::vector<int> A(N);
    for (int &a : A) std::cin >> a;
    int max = A.back();
    std::vector<std::tuple<int, int, int>> output;
    output.reserve(N - 1);
    for (int i = N - 2; i >= 0; i--) {
        if (A[i] == max) continue;
        output.emplace_back(1, i + 1, max - A[i]);
        max = A[i];
    }
    std::cout << output.size() << std::endl;
    for (auto &[l, r, v] : output) std::cout << l << ' ' << r << ' ' << v << std::endl;
}
0