# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1079477 | 2024-08-28T15:35:56 Z | andrei_iorgulescu | Political Development (BOI17_politicaldevelopment) | C++14 | 11 ms | 26716 KB |
#include <bits/stdc++.h> using namespace std; int n,k; bitset<50005> bs[50005]; vector<int> g[50005]; int deg[50005]; bool luat[50005]; int cn; vector<int> o; bool iau[15]; int ans = 1; void afis() { for (int i = 0; i < o.size(); i++) for (int j = i + 1; j < o.size(); j++) if (iau[i] and iau[j] and !bs[o[i]][o[j]]) return; ans = max(ans, 1 + (int)o.size()); } void bkt(int pos) { if (pos == o.size()) afis(); else { iau[pos] = false; bkt(pos + 1); iau[pos] = true; bkt(pos + 1); } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n >> k; for (int i = 0; i < n; i++) { int cati; cin >> cati; while (cati--) { int x; cin >> x; g[i].push_back(x); bs[i][x] = 1; } } set<pair<int,int>> cmn; for (int i = 0; i < n; i++) { deg[i] = g[i].size(); cmn.insert({deg[i], i}); } while (!cmn.empty()) { pair<int,int> pr = *cmn.begin(); cmn.erase(pr); luat[pr.second] = true; for (auto vec : g[pr.second]) { if (!luat[vec]) { cmn.erase({deg[vec], vec}); deg[vec]--; cmn.insert({deg[vec], vec}); } } vector<int> oameni; for (auto it : g[pr.second]) if (!luat[it]) oameni.push_back(it); o = oameni; cn = pr.second; bkt(0); } cout << ans; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2396 KB | Output is correct |
2 | Correct | 1 ms | 2396 KB | Output is correct |
3 | Correct | 11 ms | 24924 KB | Output is correct |
4 | Correct | 10 ms | 23900 KB | Output is correct |
5 | Correct | 10 ms | 24412 KB | Output is correct |
6 | Correct | 10 ms | 24412 KB | Output is correct |
7 | Correct | 11 ms | 24412 KB | Output is correct |
8 | Correct | 1 ms | 2652 KB | Output is correct |
9 | Correct | 1 ms | 2392 KB | Output is correct |
10 | Correct | 1 ms | 6748 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2396 KB | Output is correct |
2 | Correct | 1 ms | 2396 KB | Output is correct |
3 | Correct | 11 ms | 24924 KB | Output is correct |
4 | Correct | 10 ms | 23900 KB | Output is correct |
5 | Correct | 10 ms | 24412 KB | Output is correct |
6 | Correct | 10 ms | 24412 KB | Output is correct |
7 | Correct | 11 ms | 24412 KB | Output is correct |
8 | Correct | 1 ms | 2652 KB | Output is correct |
9 | Correct | 1 ms | 2392 KB | Output is correct |
10 | Correct | 1 ms | 6748 KB | Output is correct |
11 | Correct | 9 ms | 26712 KB | Output is correct |
12 | Correct | 10 ms | 26716 KB | Output is correct |
13 | Incorrect | 1 ms | 2396 KB | Output isn't correct |
14 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2648 KB | Output is correct |
2 | Incorrect | 1 ms | 2396 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2396 KB | Output is correct |
2 | Correct | 1 ms | 2396 KB | Output is correct |
3 | Correct | 11 ms | 24924 KB | Output is correct |
4 | Correct | 10 ms | 23900 KB | Output is correct |
5 | Correct | 10 ms | 24412 KB | Output is correct |
6 | Correct | 10 ms | 24412 KB | Output is correct |
7 | Correct | 11 ms | 24412 KB | Output is correct |
8 | Correct | 1 ms | 2652 KB | Output is correct |
9 | Correct | 1 ms | 2392 KB | Output is correct |
10 | Correct | 1 ms | 6748 KB | Output is correct |
11 | Correct | 9 ms | 26712 KB | Output is correct |
12 | Correct | 10 ms | 26716 KB | Output is correct |
13 | Incorrect | 1 ms | 2396 KB | Output isn't correct |
14 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2396 KB | Output is correct |
2 | Correct | 1 ms | 2396 KB | Output is correct |
3 | Correct | 11 ms | 24924 KB | Output is correct |
4 | Correct | 10 ms | 23900 KB | Output is correct |
5 | Correct | 10 ms | 24412 KB | Output is correct |
6 | Correct | 10 ms | 24412 KB | Output is correct |
7 | Correct | 11 ms | 24412 KB | Output is correct |
8 | Correct | 1 ms | 2652 KB | Output is correct |
9 | Correct | 1 ms | 2392 KB | Output is correct |
10 | Correct | 1 ms | 6748 KB | Output is correct |
11 | Correct | 9 ms | 26712 KB | Output is correct |
12 | Correct | 10 ms | 26716 KB | Output is correct |
13 | Incorrect | 1 ms | 2396 KB | Output isn't correct |
14 | Halted | 0 ms | 0 KB | - |