# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
790422 | 2023-07-22T15:59:32 Z | 1075508020060209tc | Friends (BOI17_friends) | C++14 | 0 ms | 212 KB |
#pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx,popcnt,sse4,abm") #include <bits/stdc++.h> using namespace std; int n;int p;int q; vector<int>e[20]; vector<int>gps[20]; int odgr[20]; int gpid[20]; void chk(){ if(gps[2].size()==0){return;} for(int i=1;i<=n;i++){ odgr[i]=0; } for(int i=1;i<=n;i++){ for(int j=0;j<e[i].size();j++){ int v=e[i][j]; if(gpid[v]!=gpid[i]){ odgr[gpid[i]]++; if(odgr[gpid[i]]>q){return;} } } } cout<<"home\n"; int cnt=0; for(int i=1;i<=n+1;i++){ if(gps[i].size()==0){ cnt=i-1;break; } } cout<<cnt<<endl; for(int i=1;i<=cnt;i++){ cout<<gps[i].size()<<" "; for(int j=0;j<gps[i].size();j++){ cout<<gps[i][j]-1<<" "; }cout<<endl; } exit(0); } void dfs(int nw){ if(nw==n+1){ chk(); return; } for(int i=1;i<=n;i++){ if(gps[i].size()>=p){continue;} gps[i].push_back(nw); gpid[nw]=i; dfs(nw+1); gps[i].pop_back(); if(gps[i].size()==0){break;} } } signed main() { cin>>n>>p>>q; for(int i=1;i<=n;i++){ int k; cin>>k; for(int j=0;j<k;j++){ int v; cin>>v; v++; e[i].push_back(v); } } dfs(1); cout<<"detention\n"; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Failed | 0 ms | 212 KB | EMERGENCY!!! contestant found solution when jury didn't |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Failed | 0 ms | 212 KB | EMERGENCY!!! contestant found solution when jury didn't |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Failed | 0 ms | 212 KB | EMERGENCY!!! contestant found solution when jury didn't |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Failed | 0 ms | 212 KB | EMERGENCY!!! contestant found solution when jury didn't |
2 | Halted | 0 ms | 0 KB | - |