Last active
September 1, 2020 10:29
-
-
Save abap34/32b9a2d01853564a4b67397415a663b6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _GLIBCXX_DEBUG | |
#include <bits/stdc++.h> | |
using namespace std; | |
using Graph = vector<vector<int>>; | |
#define rep(i, n) for (int i = 0; i < (int)(n); i++) | |
#define ALL(a) (a).begin(), (a).end() | |
template <typename T> | |
void output_2d_arr(vector<T> A) | |
{ | |
for (T vec_a : A) | |
{ | |
for (auto a : vec_a) | |
{ | |
cout << a << " "; | |
} | |
cout << endl; | |
} | |
cout << endl; | |
} | |
template <typename T> | |
void output_2d_set(set<T> A) | |
{ | |
for (T aa : A) | |
{ | |
for (auto a : aa) | |
{ | |
cout << a << " "; | |
} | |
cout << endl; | |
} | |
cout << endl; | |
} | |
int main() | |
{ | |
cout << "===========" << endl; | |
int n; | |
while (true) | |
{ | |
cin >> n; | |
if (n == 0) | |
break; | |
vector<vector<string>> colors(n, vector<string>(6)); | |
rep(i, n) | |
{ | |
rep(j, 6) | |
{ | |
cin >> colors[i][j]; | |
} | |
} | |
cout << "input:" << endl; | |
output_2d_arr(colors); | |
cout << "sorted" << endl; | |
rep(i, n){ | |
sort(colors[i].begin(), colors[i].end()); | |
} | |
output_2d_arr(colors); | |
cout << "unique:" << endl; | |
set<vector<string>> unique_colors(ALL(colors)); | |
output_2d_set(unique_colors); | |
cout << "result:" << endl; | |
cout << (n - unique_colors.size()) << endl; | |
cout << "----------" << endl; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment