# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
453636 | Kipras | Fire drill (LMIO18_sauga) | C++14 | 133 ms | 2884 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|---|---|---|---|
Fetching results... |