# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
453049 | 2021-08-04T07:43:42 Z | jurgis | Fire drill (LMIO18_sauga) | C++14 | 1000 ms | 5492 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(){ pii order[n]; queue<pii> q; for(int i=1; i<=n; i++){ order[i-1]= {laipsniai[i], i}; //cout << " i = " << i << " laipsniai = " << laipsniai[i] << endl; } sort(order, order+n); q.push(order[0]); order[0].first = inf; // cout<<laipsniai[1]<<endl; while(!q.empty()){ int v = q.front().second; int laip = q.front().first; q.pop(); result.push_back(v); for(auto u :adj[v]){ laipsniai[u]--; for(int i =0; i<n; i++){if(order[i].second ==u){order[i].first--;}} sort(order, order+n); if(result.size()<n){q.push(order[0]);order[0].first = inf; } } } } 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*/
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1086 ms | 5492 KB | Time limit exceeded |
2 | Incorrect | 115 ms | 332 KB | Extra information in the output file |
3 | Incorrect | 185 ms | 524 KB | Extra information in the output file |
4 | Incorrect | 516 ms | 408 KB | Extra information in the output file |
5 | Incorrect | 195 ms | 392 KB | Extra information in the output file |
6 | Incorrect | 561 ms | 468 KB | Extra information in the output file |
7 | Execution timed out | 1079 ms | 1648 KB | Time limit exceeded |
8 | Execution timed out | 1047 ms | 5104 KB | Time limit exceeded |
9 | Incorrect | 14 ms | 716 KB | Unexpected end of file - int32 expected |
10 | Incorrect | 1 ms | 332 KB | Unexpected end of file - int32 expected |