Submission #453636

#TimeUsernameProblemLanguageResultExecution timeMemory
453636KiprasFire drill (LMIO18_sauga)C++14
30.75 / 100
133 ms2884 KiB
#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 timeMemoryGrader output
Fetching results...