#include <bits/stdc++.h>
using namespace std;
const int maxN = 1000;
int points[maxN+1];
bool used[maxN+1]={0};
vector<int> adj[maxN+1];
int main()
{
int t, n, s, len, temp;
cin>>t>>n>>s;
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> a;
for(int i = 1; i <= n; i++){
cin>>len;
for(int x = 0; x < len; x++){
cin>>temp;
points[temp]++;
adj[i].push_back(temp);
}
}
for(int i = 1; i <= n; i++){
a.push({points[i], i});
}
pair<int, int> v;
while(a.size()!=0){
v = a.top();
a.pop();
if(used[v.second]) continue;
cout<<v.second<<'\n';
for(auto i : adj[v.second]){
points[i]--;
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
131 ms |
2884 KB |
Output isn't correct |
2 |
Partially correct |
1 ms |
332 KB |
Output is partially correct |
3 |
Partially correct |
2 ms |
332 KB |
Output is partially correct |
4 |
Partially correct |
3 ms |
332 KB |
Output is partially correct |
5 |
Partially correct |
2 ms |
332 KB |
Output is partially correct |
6 |
Partially correct |
3 ms |
332 KB |
Output is partially correct |
7 |
Partially correct |
20 ms |
772 KB |
Output is partially correct |
8 |
Partially correct |
133 ms |
2664 KB |
Output is partially correct |
9 |
Partially correct |
19 ms |
552 KB |
Output is partially correct |
10 |
Partially correct |
1 ms |
332 KB |
Output is partially correct |