fork download
  1. #include <iostream>
  2. using namespace std;
  3. #include <bits/stdc++.h>
  4. #include<utility>
  5. #include <algorithm>
  6. #include<iterator>
  7. #define go return 0
  8. #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  9. #define rep(i,n) for(int i=0;i<n;++i)
  10. #define rep(j,n) for(int j=0;j<n;++j)
  11. #define REP(i,n) for(int i=1;i<=n;++i)
  12. #define all(v) ((v).begin()), ((v).end())
  13. #define len(s) ((int)s.size())
  14. #define F first
  15. #define S second
  16. #define pb push_back
  17. #define pf push_front
  18. #define m_p make_pair
  19. typedef long long ll;
  20. typedef double db;
  21. typedef vector<ll> ve;
  22. typedef vector<pair<ll, ll> > vepa;
  23. typedef set<ll>se;
  24. typedef map<ll,ll> mpp;
  25. const ll N=1e6,OO=1e14,MOD=1e9+7;
  26. const int di[]={1,-1,0,0};
  27. const int dj[]={0,0,1,-1};
  28. int TC,n,m,k,a,b,c,d,x,y,l,r,cnt,anss,mx,mn,arr[N];
  29. bool vis[N],f;
  30. ve adj[N];
  31. int main(){
  32. IOS;
  33. //freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
  34. cin>>TC;
  35. while(TC--){
  36. cout<<"Case #"<<++b<<":\n";
  37. ve v[4],v2[4];
  38. mpp mp;
  39. rep(i,3){
  40. cin>>n;
  41. rep(j,n){
  42. cin>>a;
  43. mp[a]++;
  44. v[i].pb(a);
  45. }
  46. //sort(v[i].begin(),v[i].end());
  47. }
  48. rep(i,3){
  49. rep(j,v[i].size()){
  50. if(mp[ v[i][j] ]==1 )v2[i].pb(v[i][j]);
  51. }
  52. }
  53. if(v2[0].size()>=v2[1].size()&&v2[0].size()>=v2[2].size()){
  54. cout<<"1 "<<v2[0].size()<<" ";
  55. rep(i,v2[0].size())cout<<v2[0][i]<<" ";
  56. cout<<"\n";
  57. }
  58. if(v2[1].size()>=v2[0].size()&&v2[1].size()>=v2[2].size()){
  59. cout<<"2 "<<v2[1].size()<<" ";
  60. rep(i,v2[1].size())cout<<v2[1][i]<<" ";
  61. cout<<"\n";
  62. }
  63. if(v2[2].size()>=v2[1].size()&&v2[2].size()>=v2[0].size()){
  64. cout<<"3 "<<v2[2].size()<<" ";
  65. rep(i,v2[2].size())cout<<v2[2][i]<<" ";
  66. cout<<"\n";
  67. }
  68. }
  69.  
  70. go;
  71. }
  72.  
Success #stdin #stdout 0.01s 27004KB
stdin
Standard input is empty
stdout
Standard output is empty