Submission #924548

#TimeUsernameProblemLanguageResultExecution timeMemory
924548Sir_Ahmed_ImranPolitical Development (BOI17_politicaldevelopment)C++17
0 / 100
1481 ms524288 KiB
///~~~LOTA~~~/// #include <bits/stdc++.h> using namespace std; #define ll long long #define append push_back #define add insert #define nl "\n" #define ff first #define ss second #define pii pair<int,int> #define all(x) (x).begin(),(x).end() #define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL) #define N 50000 vector<int> a[N]; map<int,int> x[N]; void solve(){ int n,m,o,p,q; cin>>n>>m; for(int i=o=0;i<n;i++){ cin>>p; if(p>0) o=1; while(p--){ cin>>q; x[i][q]=1; a[i].append(q); } } for(int i=0;i<n;i++){ for(auto& j:a[i]){ for(auto& k:a[j]){ if(x[i][k]){ cout<<min(3,m); return; } } } } cout<<min(o+1,m); } int main(){ L0TA; solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...