結果

問題 No.3184 Make Same
コンテスト
ユーザー ふやけももんが
提出日時 2025-11-13 16:25:32
言語 C++17
(gcc 13.3.0 + boost 1.89.0)
結果
WA  
実行時間 -
コード長 682 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,038 ms
コンパイル使用メモリ 208,612 KB
実行使用メモリ 13,056 KB
最終ジャッジ日時 2025-11-13 16:25:51
合計ジャッジ時間 18,149 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 4 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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



int main(){
   int n;
    cin >> n;
    map<int,int> nums;
    for(int i = 0;i<n;i++){
        int a;
        cin >> a;
        nums[a] ++;
    }
    vector<tuple<int,int,int>> answer; 
    while(nums.size() >= 2){
        auto itr = nums.begin();
        pair<int,int> left = *itr;
        itr++;
        pair<int,int> right = *itr;
        answer.push_back( {1,left.second,right.first-left.first} );
        itr->second += left.second;
        nums.erase(left.first);
    }

    cout << answer.size() << endl;
    for(tuple<int,int,int> x : answer){
        cout << get<0>(x) << " " << get<1>(x) << " " << get<2>(x) << endl;
    }
}
0