Submission #7899530
Source Code Expand
#pragma GCC optimize("Ofast") #include<bits/stdc++.h> using namespace std; template <typename T> vector<T> dijkstra(int s,vector<vector<pair<int, T> > > & G){ const T INF = numeric_limits<T>::max(); using P = pair<T, int>; int n=G.size(); vector<T> d(n,INF); vector<int> b(n,-1); priority_queue<P,vector<P>,greater<P> > q; d[s]=0; q.emplace(d[s],s); while(!q.empty()){ P p=q.top();q.pop(); int v=p.second; if(d[v]<p.first) continue; for(auto& e:G[v]){ int u=e.first; T c=e.second; if(d[u]>d[v]+c){ d[u]=d[v]+c; b[u]=v; q.emplace(d[u],u); } } } return d; } signed main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int n,m,k,l; string ans="YES"; cin>>n>>m; priority_queue<int> pque; using P=pair<int,int>; vector<vector<P>> L(n+m); for(int i=0;i<n;i++){ cin>>k; for(int j=0;j<k;j++){ cin>>l; L[i].emplace_back(l+n-1,1); L[l+n-1].emplace_back(i,1); } } for(int i=1;i<n;i++){ pque.push(dijkstra(0,L)[i]); } if(pque.top()==numeric_limits<int>::max()){ans="NO";} cout<<ans; }
Submission Info
Submission Time | |
---|---|
Task | C - Interpretation |
User | zono819 |
Language | C++14 (GCC 5.4.1) |
Score | 200 |
Code Size | 1185 Byte |
Status | TLE |
Exec Time | 2104 ms |
Memory | 12296 KB |
Judge Result
Set Name | sample | dataset1 | dataset2 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | 0 / 200 | ||||||||
Status |
|
|
|
Set Name | Test Cases |
---|---|
sample | sample-01.txt, sample-02.txt |
dataset1 | sample-01.txt, sample-02.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt |
dataset2 | sample-01.txt, sample-02.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 02-01.txt, 02-02.txt, 02-03.txt, 02-04.txt, 02-05.txt, 02-06.txt, 02-07.txt, 02-08.txt, 02-09.txt, 02-10.txt, 02-11.txt, 02-12.txt, 02-13.txt, sample-01.txt, sample-02.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01-01.txt | AC | 1 ms | 256 KB |
01-02.txt | AC | 4 ms | 384 KB |
01-03.txt | AC | 2 ms | 384 KB |
01-04.txt | AC | 55 ms | 384 KB |
01-05.txt | AC | 37 ms | 384 KB |
01-06.txt | AC | 31 ms | 384 KB |
01-07.txt | AC | 30 ms | 384 KB |
01-08.txt | AC | 32 ms | 384 KB |
01-09.txt | AC | 33 ms | 384 KB |
01-10.txt | AC | 61 ms | 384 KB |
02-01.txt | TLE | 2104 ms | 7756 KB |
02-02.txt | TLE | 2104 ms | 8416 KB |
02-03.txt | TLE | 2104 ms | 5680 KB |
02-04.txt | TLE | 2104 ms | 8760 KB |
02-05.txt | TLE | 2104 ms | 7480 KB |
02-06.txt | TLE | 2104 ms | 8720 KB |
02-07.txt | TLE | 2104 ms | 7640 KB |
02-08.txt | TLE | 2104 ms | 8264 KB |
02-09.txt | TLE | 2104 ms | 12296 KB |
02-10.txt | TLE | 2104 ms | 8928 KB |
02-11.txt | TLE | 2104 ms | 8924 KB |
02-12.txt | TLE | 2104 ms | 7460 KB |
02-13.txt | TLE | 2104 ms | 7552 KB |
sample-01.txt | AC | 1 ms | 256 KB |
sample-02.txt | AC | 1 ms | 256 KB |