답안 #453106

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
453106 2021-08-04T08:03:09 Z jurgis Fire drill (LMIO18_sauga) C++14
0 / 100
1000 ms 132148 KB
#include <iostream>
#include <bits/stdc++.h>

using namespace std;
typedef  pair<int, int> pii;
int n, t, s;
int laipsniai[1001];
vector<int> adj[1001];
vector<int> result;

int isnaudotapak = 0;
const int inf = 1e8;
void toposort(){
    priority_queue<pair<int, int> > q;
    for(int i = 1; i <= n; i++){
        q.push({laipsniai[i], i});
    }
    while(!q.empty()){
        int v = q.top().second;
        int laip = q.top().first;
        q.pop();
        if(laip != laipsniai[v]) continue;

        for(auto x : adj[v]){
            laipsniai[x]--;
            q.push({laipsniai[x], x});
        }
    }
}
int main()
{
    cin>>t>>n>>s;

    for(int i=0; i<n; i++){

        int num; cin>>num;
        laipsniai[i+1] = num;
        for(int a=0; a<num; a++){
            int u; cin>>u; adj[u].push_back(i+1);
        }
    }
    toposort();
    for(auto i: result){
        cout<<i<<"\n";
    }
}
/* test case
0 4 1
2 2 3
0
 1 4
 1 1*/
# 결과 실행 시간 메모리 Grader output
1 Incorrect 404 ms 7216 KB Unexpected end of file - int32 expected
2 Execution timed out 1083 ms 16840 KB Time limit exceeded
3 Execution timed out 1090 ms 16916 KB Time limit exceeded
4 Execution timed out 1091 ms 16868 KB Time limit exceeded
5 Execution timed out 1098 ms 16888 KB Time limit exceeded
6 Execution timed out 1089 ms 16856 KB Time limit exceeded
7 Execution timed out 1100 ms 132148 KB Time limit exceeded
8 Execution timed out 1089 ms 36088 KB Time limit exceeded
9 Execution timed out 1086 ms 33476 KB Time limit exceeded
10 Execution timed out 1076 ms 332 KB Time limit exceeded