# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
453636 | Kipras | Fire drill (LMIO18_sauga) | C++14 | 133 ms | 2884 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |