58 lines
1.3 KiB
C++
58 lines
1.3 KiB
C++
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
int main(int argc, char *argv[]) {
|
|
string inName = "test.in";
|
|
string outName = "test.out";
|
|
|
|
if (argc > 1) {
|
|
inName = argv[1];
|
|
cout << "Using \"" << inName << "\" for test name" << endl;
|
|
} else {
|
|
cout << "Warning: no in name provided, defaulting to test.in" << endl;
|
|
}
|
|
|
|
if (argc > 2) {
|
|
outName = argv[2];
|
|
cout << "Using \"" << outName << "\" for out name" << endl;
|
|
} else {
|
|
cout << "Warning: no out name proviced, defaulting to test.out" << endl;
|
|
}
|
|
|
|
ifstream in(inName);
|
|
ofstream out(outName);
|
|
|
|
// ***************** SOLUTION START HERE *****************
|
|
|
|
int m, n;
|
|
in >> n;
|
|
in >> m;
|
|
|
|
string accessStrings[m];
|
|
// set to ""
|
|
for (int i = 0; i < m; i++) {
|
|
accessStrings[i] = "";
|
|
}
|
|
|
|
int canAccessCounter;
|
|
int userID;
|
|
for (int i = 0; i < n; i++) {
|
|
in >> canAccessCounter;
|
|
for (int j = 0; j < canAccessCounter; j++) {
|
|
in >> userID;
|
|
accessStrings[userID - 1] += to_string(i);
|
|
}
|
|
}
|
|
|
|
unordered_set<string> group_permissions;
|
|
for (int i = 0; i < m; i++) {
|
|
group_permissions.insert(accessStrings[i]);
|
|
}
|
|
out << group_permissions.size() << endl;
|
|
|
|
return 0;
|
|
}
|