# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
744091 | 2023-05-18T08:00:52 Z | MilosMilutinovic | Political Development (BOI17_politicaldevelopment) | C++14 | 3000 ms | 2788 KB |
#include <bits/stdc++.h> using namespace std; int n,k,id[50005]; vector<int> g[50005]; signed main() { scanf("%d%d",&n,&k); for(int d,i=0;i<n;i++) { scanf("%d",&d); for(int x,j=0;j<d;j++) { scanf("%d",&x); g[i].push_back(x); g[x].push_back(i); } } for(int i=0;i<n;i++) id[i]=-1; int ans=1; for(int i=0;i<n;i++) { int deg=(int)g[i].size(); for(int j=0;j<deg;j++) id[g[i][j]]=j+1; id[i]=0; deg++; vector<int> a; for(int x:g[i]) { int f=(1<<id[x]); for(int y:g[x]) if(id[y]!=-1) f+=(1<<id[y]); a.push_back(f); } for(int mask=0;mask<(1<<deg);mask++) { bool ok=true; for(int j=0;j<deg;j++) if(mask>>j&1) if((mask&a[j])!=mask) ok=false; if(ok) ans=max(ans,__builtin_popcount(mask)+1); } for(int j=0;j<deg;j++) id[g[i][j]]=-1; } printf("%d\n",ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1364 KB | Output is correct |
2 | Correct | 1 ms | 1480 KB | Output is correct |
3 | Execution timed out | 3082 ms | 1620 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1364 KB | Output is correct |
2 | Correct | 1 ms | 1480 KB | Output is correct |
3 | Execution timed out | 3082 ms | 1620 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 2788 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1364 KB | Output is correct |
2 | Correct | 1 ms | 1480 KB | Output is correct |
3 | Execution timed out | 3082 ms | 1620 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1364 KB | Output is correct |
2 | Correct | 1 ms | 1480 KB | Output is correct |
3 | Execution timed out | 3082 ms | 1620 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |