제출 #1103696

#제출 시각아이디문제언어결과실행 시간메모리
1103696ortsacPolitical Development (BOI17_politicaldevelopment)C++17
77 / 100
3065 ms34696 KiB
#pragma GCC optmize("Ofast") #include <bits/stdc++.h> using namespace std; #define all(x) x.begin(), x.end() const int MAXN = 5e4 + 10; deque<int> adj[MAXN]; void merge(deque<int>& v1, deque<int>& v2, deque<int>& res) { int n = v1.size(), m = v2.size(); int p1 = 0, p2 = 0; while ((p1 < n) && (p2 < m)) { if (v1[p1] == v2[p2]) { res.push_back(v1[p1]); p1++; p2++; continue; } if (v1[p1] < v2[p2]) p1++; else p2++; } } int best(deque<int> pos) { int mx = 0; while (!pos.empty()) { auto u = pos.front(); pos.pop_front(); deque<int> nxt; merge(pos, adj[u], nxt); mx = max(mx, 1 + best(nxt)); } return mx; } int32_t main() { int n, k; cin >> n >> k; for (int i = 0; i < n; i++) { int x; cin >> x; while (x--) { int v; cin >> v; adj[i].push_back(v); } sort(adj[i].begin(), adj[i].end()); } int ans = 0; for (int i = 0; i < n; i++) { ans = max(ans, best(adj[i]) + 1); } cout << ans << "\n"; }

컴파일 시 표준 에러 (stderr) 메시지

politicaldevelopment.cpp:1: warning: ignoring '#pragma GCC optmize' [-Wunknown-pragmas]
    1 | #pragma GCC optmize("Ofast")
      |
#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...