# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
104898 |
2019-04-09T13:50:00 Z |
WLZ |
케이크 (CEOI14_cake) |
C++17 |
|
78 ms |
8712 KB |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, a;
cin >> n >> a;
vector< pair<int, int> > d(n);
for (int i = 0; i < n; i++) {
cin >> d[i].first;
d[i].second = i + 1;
}
sort(d.rbegin(), d.rend());
vector<int> top10;
vector<int> v;
for (int i = 0; i < min(10, n); i++) {
top10.push_back(d[i].second);
}
for (int i = n; i >= 10; i--) {
v.push_back(d[i].second);
}
int q;
cin >> q;
while (q--) {
char t;
cin >> t;
if (t == 'F') {
int b;
cin >> b;
int cur = n;
vector<int> num(n + 1, -1);
for (auto& x : top10) {
if (num[x] == -1) {
num[x] = cur--;
}
}
for (int i = (int) v.size() - 1; i >= 0; i--) {
if (num[v[i]] == -1) {
num[v[i]] = cur--;
}
}
assert(cur == 0);
priority_queue< pair<int, int>, vector< pair<int, int> >, greater< pair<int, int> > > pq;
pq.push({num[a], a});
int cnt = 0;
while (!pq.empty()) {
int x = pq.top().second;
pq.pop();
num[x] = -1;
if (x == b) {
cout << cnt << '\n';
}
cnt++;
if (x > 1 && num[x - 1] != -1) {
pq.push({num[x - 1], x - 1});
}
if (x < n && num[x + 1] != -1) {
pq.push({num[x + 1], x + 1});
}
}
} else {
int i, e;
cin >> i >> e;
auto it = top10.begin();
for (int j = 0; j < e - 1; j++) {
it = next(it);
}
top10.insert(it, i);
v.push_back(top10.back());
top10.pop_back();
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
256 KB |
Output is correct |
2 |
Runtime error |
3 ms |
640 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
5 ms |
896 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Runtime error |
7 ms |
1024 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Runtime error |
7 ms |
1024 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
4 |
Runtime error |
5 ms |
896 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
5 |
Runtime error |
12 ms |
1536 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
6 |
Runtime error |
12 ms |
1408 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
7 |
Runtime error |
9 ms |
1408 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
8 |
Runtime error |
9 ms |
1408 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
31 ms |
3956 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Runtime error |
22 ms |
3936 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Runtime error |
37 ms |
3828 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
4 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
5 |
Runtime error |
78 ms |
8652 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
6 |
Runtime error |
75 ms |
8712 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
7 |
Runtime error |
76 ms |
8620 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
4 ms |
768 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Runtime error |
5 ms |
816 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Runtime error |
15 ms |
2304 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
4 |
Runtime error |
21 ms |
2560 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
5 |
Runtime error |
4 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
6 |
Runtime error |
20 ms |
2816 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
7 |
Runtime error |
6 ms |
896 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
8 |
Runtime error |
29 ms |
3964 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
9 |
Runtime error |
78 ms |
8688 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
10 |
Runtime error |
3 ms |
640 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
11 |
Runtime error |
9 ms |
1280 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
12 |
Runtime error |
65 ms |
6980 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
13 |
Runtime error |
71 ms |
8560 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |