結果

問題 No.3786 Four Triplets, One Pair
コンテスト
ユーザー t98slider
提出日時 2026-11-06 21:24:29
言語 C++23
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 963 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,187 ms
コンパイル使用メモリ 345,780 KB
実行使用メモリ 9,924 KB
最終ジャッジ日時 2026-11-06 21:24:34
合計ジャッジ時間 4,076 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 17 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

template<class T> istream& operator >> (istream& is, vector<T>& vec) {
    for(T& x : vec) is >> x;
    return is;
}

template<class T> ostream& operator << (ostream& os, const vector<T>& vec) {
    if(vec.empty()) return os;
    os << vec[0];
    for(auto it = vec.begin(); ++it != vec.end(); ) os << ' ' << *it;
    return os;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    array<int, 10> cnt{}, ary;
    fill(ary.begin(), ary.end(), 0);
    ary[2] = 2;
    ary[3] = 4;
    vector<int> b(13);
    for(auto &&v : b) cin >> v;
    sort(b.begin(), b.end());
    for(int i = 0; i < 13; ){
        int p = i;
        while(i < 13 && b[i] == b[p]) i++;
        cnt[i - p]++;
    } 
    vector<int> ans;
    for(int i = 1; i <= 9; i++){
        cnt[i]++;
        if(cnt == ary) ans.push_back(i);
        cnt[i]--;
    }
    cout << ans.size() << '\n';
    cout << ans << '\n';
}
0