# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
923770 | 2024-02-07T18:14:16 Z | n3rm1n | Ball Machine (BOI13_ballmachine) | C++17 | 50 ms | 14024 KB |
#include<bits/stdc++.h> #define endl '\n' using namespace std; const int MAXN = 1e5 + 10; void speed() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } int n, que; int p[MAXN], root; vector < int > g[MAXN]; void read() { cin >> n >> que; for (int i = 1; i <= n; ++ i) { cin >> p[i]; if(!p[i])root = i; g[p[i]].push_back(i); } } int points[MAXN], cnt; void dfs0(int beg) { int nb; for (int i = 0; i < g[beg].size(); ++ i) { nb = g[beg][i]; if(!points[nb])dfs0(nb); } cnt ++; points[beg] = cnt; } int used[MAXN]; priority_queue < pair < int, int > > q; int query_type1(int x) { int v = 0; while(x --) { v = q.top().second; //cout << v << endl; used[v] = 1; q.pop(); } return v; } int main() { speed(); read(); dfs0(root); for (int i = 1; i <= n; ++ i) q.push(make_pair(-points[i], i)); int t, x; while(que --) { cin >> t >> x; if(t == 1) cout << query_type1(x) << endl; else { cout << 0 << endl; } } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 3416 KB | Output isn't correct |
2 | Incorrect | 32 ms | 6616 KB | Output isn't correct |
3 | Incorrect | 32 ms | 6844 KB | Output isn't correct |
4 | Incorrect | 1 ms | 3164 KB | Output isn't correct |
5 | Incorrect | 1 ms | 3420 KB | Output isn't correct |
6 | Incorrect | 1 ms | 3420 KB | Output isn't correct |
7 | Incorrect | 2 ms | 3672 KB | Output isn't correct |
8 | Incorrect | 2 ms | 3420 KB | Output isn't correct |
9 | Incorrect | 3 ms | 3660 KB | Output isn't correct |
10 | Incorrect | 8 ms | 4188 KB | Output isn't correct |
11 | Incorrect | 31 ms | 6612 KB | Output isn't correct |
12 | Incorrect | 31 ms | 6860 KB | Output isn't correct |
13 | Incorrect | 39 ms | 6612 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 18 ms | 5848 KB | Output isn't correct |
2 | Incorrect | 43 ms | 10568 KB | Output isn't correct |
3 | Incorrect | 40 ms | 7656 KB | Output isn't correct |
4 | Incorrect | 21 ms | 6308 KB | Output isn't correct |
5 | Incorrect | 21 ms | 5980 KB | Output isn't correct |
6 | Incorrect | 21 ms | 6104 KB | Output isn't correct |
7 | Incorrect | 21 ms | 5728 KB | Output isn't correct |
8 | Incorrect | 18 ms | 5844 KB | Output isn't correct |
9 | Incorrect | 43 ms | 10964 KB | Output isn't correct |
10 | Incorrect | 43 ms | 10636 KB | Output isn't correct |
11 | Incorrect | 44 ms | 10700 KB | Output isn't correct |
12 | Incorrect | 42 ms | 9344 KB | Output isn't correct |
13 | Incorrect | 39 ms | 12996 KB | Output isn't correct |
14 | Incorrect | 38 ms | 7640 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 22 ms | 7388 KB | Output isn't correct |
2 | Incorrect | 43 ms | 9412 KB | Output isn't correct |
3 | Incorrect | 32 ms | 11812 KB | Output isn't correct |
4 | Incorrect | 30 ms | 9412 KB | Output isn't correct |
5 | Incorrect | 30 ms | 8916 KB | Output isn't correct |
6 | Incorrect | 31 ms | 8996 KB | Output isn't correct |
7 | Incorrect | 29 ms | 8148 KB | Output isn't correct |
8 | Incorrect | 33 ms | 11740 KB | Output isn't correct |
9 | Incorrect | 50 ms | 10964 KB | Output isn't correct |
10 | Incorrect | 44 ms | 10980 KB | Output isn't correct |
11 | Incorrect | 43 ms | 10696 KB | Output isn't correct |
12 | Incorrect | 44 ms | 9420 KB | Output isn't correct |
13 | Incorrect | 48 ms | 14020 KB | Output isn't correct |
14 | Incorrect | 36 ms | 7888 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 48 ms | 10960 KB | Output isn't correct |
2 | Incorrect | 44 ms | 9416 KB | Output isn't correct |
3 | Incorrect | 49 ms | 14020 KB | Output isn't correct |
4 | Incorrect | 49 ms | 10956 KB | Output isn't correct |
5 | Incorrect | 42 ms | 10500 KB | Output isn't correct |
6 | Incorrect | 43 ms | 10700 KB | Output isn't correct |
7 | Incorrect | 44 ms | 9548 KB | Output isn't correct |
8 | Incorrect | 43 ms | 14024 KB | Output isn't correct |
9 | Incorrect | 33 ms | 7624 KB | Output isn't correct |