# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
924414 | 2024-02-09T03:23:01 Z | Muhammad_Aneeq | Political Development (BOI17_politicaldevelopment) | C++17 | 3000 ms | 5736 KB |
/* بسم الله الرحمن الرحيم Author: (:Muhammad Aneeq:) */ #include <iostream> #include <vector> using namespace std; int const N=6e4+10; vector<int>nei[N]={}; int res[N]={}; int ans=0; bool valid(vector<int>f) { for (auto i:f) { for (auto j:nei[i]) res[j]++; } bool w=0; for (auto i:f) { if (res[i]<f.size()-1) { w=1; break; } } for (auto i:f) res[i]=0; return (!w); } void check(int n) { vector<int>f=nei[n]; for (int i=0;i<=(1<<f.size());i++) { vector<int>z; for (int j=0;j<f.size();j++) { if ((1<<j)&i) z.push_back(f[j]); } z.push_back(n); if (valid(z)) ans=max(ans,int(z.size())); } } inline void solve() { int n,k; cin>>n>>k; for (int i=0;i<n;i++) { int d; cin>>d; while (d--) { int x; cin>>x; nei[i].push_back(x); } } for (int i=1;i<=n;i++) check(i); cout<<ans<<endl; } int main() { ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); solve(); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1628 KB | Output is correct |
2 | Correct | 1 ms | 1628 KB | Output is correct |
3 | Correct | 12 ms | 2056 KB | Output is correct |
4 | Incorrect | 16 ms | 2108 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1628 KB | Output is correct |
2 | Correct | 1 ms | 1628 KB | Output is correct |
3 | Correct | 12 ms | 2056 KB | Output is correct |
4 | Incorrect | 16 ms | 2108 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1884 KB | Output is correct |
2 | Correct | 1 ms | 1628 KB | Output is correct |
3 | Correct | 1 ms | 1628 KB | Output is correct |
4 | Correct | 1 ms | 1624 KB | Output is correct |
5 | Correct | 1 ms | 1880 KB | Output is correct |
6 | Correct | 1 ms | 1628 KB | Output is correct |
7 | Correct | 1 ms | 1628 KB | Output is correct |
8 | Correct | 1 ms | 1628 KB | Output is correct |
9 | Correct | 1 ms | 1624 KB | Output is correct |
10 | Correct | 1 ms | 1628 KB | Output is correct |
11 | Execution timed out | 3082 ms | 5736 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1628 KB | Output is correct |
2 | Correct | 1 ms | 1628 KB | Output is correct |
3 | Correct | 12 ms | 2056 KB | Output is correct |
4 | Incorrect | 16 ms | 2108 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1628 KB | Output is correct |
2 | Correct | 1 ms | 1628 KB | Output is correct |
3 | Correct | 12 ms | 2056 KB | Output is correct |
4 | Incorrect | 16 ms | 2108 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |