結果

問題 No.3786 Four Triplets, One Pair
コンテスト
ユーザー Nihonielse
提出日時 2026-11-06 21:28:58
言語 C++23(gcc16)
(gcc 16.2.0 + boost 1.92.0 + ACL)
コンパイル:
g++-16 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc16.so -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 2,000 ms
+ 795µs
コード長 3,612 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,954 ms
コンパイル使用メモリ 357,924 KB
実行使用メモリ 9,872 KB
最終ジャッジ日時 2026-11-06 21:29:03
合計ジャッジ時間 4,841 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge7_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#line 1 "lib/core.hpp"
// Library and Editor Setting is here: https://github.com/Nihonielse/competitive-library

#ifndef CORE_FILE
#define CORE_FILE

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

using ll = long long;
using ull = unsigned long long;

#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n, s) for (int i = s; i < n; i++)

#define vall(v) v.begin(), v.end()

constexpr int INF = 1 << 30;
constexpr int NEG_INF = -INF;
constexpr ll LINF = 1ll << 62;
constexpr ll NEG_LINF = -LINF;

template <typename T> inline bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

template <typename T> inline bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

template <typename T>
using min_priority_queue = priority_queue<T,vector<T>,greater<T>>;

#endif
#line 1 "lib/inout.hpp"



#line 1 "lib/core.hpp"
// Library and Editor Setting is here: https://github.com/Nihonielse/competitive-library

#ifndef CORE_FILE
#define CORE_FILE

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

using ll = long long;
using ull = unsigned long long;

#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n, s) for (int i = s; i < n; i++)

#define vall(v) v.begin(), v.end()

constexpr int INF = 1 << 30;
constexpr int NEG_INF = -INF;
constexpr ll LINF = 1ll << 62;
constexpr ll NEG_LINF = -LINF;

template <typename T> inline bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

template <typename T> inline bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

template <typename T>
using min_priority_queue = priority_queue<T,vector<T>,greater<T>>;

#endif
#line 5 "lib/inout.hpp"

inline void yn(const bool &tf) {
    if(tf)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

inline void YN(const bool &tf) {
    if(tf)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}

inline void Yes() { cout << "Yes" << endl; }
inline void YES() { cout << "YES" << endl; }
inline void No() { cout << "No" << endl; }
inline void NO() { cout << "NO" << endl; }

template <typename T,typename S>
istream& operator>>(istream& is,pair<T,S>& pa){
    is >> pa.first >> pa.second;
    return is;
}

template <typename T,typename S>
ostream& operator<<(ostream& os,pair<T,S>& pa){
    os << pa.first << " " << pa.second;
    return os;
}

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

template <typename T>
ostream& operator<<(ostream& os,vector<T>& vec){
    for(int i=0;i<vec.size();i++){
        if(i) os << " ";
        os << vec[i];
    }
    return os;
}
template <typename T>
ostream& operator<<(ostream& os,vector<vector<T>>& vec){
    for(int i=0;i<vec.size();i++){
        os << vec[i];
        if(i<vec.size()-1)os << endl;
    }
    return os;
}

template <typename T,typename S>
ostream& operator<<(ostream& os,vector<pair<T,S>>& vec){
    for(int i=0;i<vec.size();i++){
        os << vec[i];
        if(i<vec.size()-1)os << endl;
    }
    return os;
}


#line 3 "codes/A.cpp"

int main(){
	vector<int> count(10,0);
	rep(i,13){
		int a;
		cin>>a;
		count[a]++;
	}
	vector<int> countcount(15,0);
	rep(i,10){
		countcount[count[i]]++;
	}
	if(countcount[3]==3&&countcount[2]==2){
		cout<<2<<endl;
		int a=0;
		rep(i,10){
			if(count[i]==2){
				if(a==1)cout<<" ";
				cout<<i;
				a++;
			}
		}
		cout<<endl;
	}else if(countcount[3]==4){
		cout<<1<<endl;
		rep(i,10){
			if(count[i]==1){
				cout<<i<<endl;
			}
		}
	}else{
		cout<<0<<endl<<endl;
	}
}

0