# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
821770 | 2023-08-11T16:06:30 Z | LucaLucaM | Floppy (RMI20_floppy) | C++17 | 71 ms | 12348 KB |
#include <bits/stdc++.h> #include "floppy.h" using namespace std; void read_array(int subtask_id, const std::vector<int> &v) { int n = (int) v.size(); stack<int>st; string bits = ""; for (int i = 0; i < n; i++) { while (!st.empty() && v[i] >= v[st.top()]) { st.pop(); bits += "0"; } st.push(i); bits += "1"; } save_to_floppy(bits); } std::vector<int> solve_queries(int subtask_id, int N, const std::string &bits, const std::vector<int> &a, const std::vector<int> &b) { vector<int>answer; int n = (int) bits.size(); n >>= 1; vector<int>l(n + 1); int sz = 0; for (int i = 0, j = 0; i < (int) bits.size(); i++) { if (bits[i] == '0') { sz--; } else { l[++j] = sz; } } for (int q = 0; q < N; q++) { int st = a[q], dr = b[q]; int p = dr; while (l[p] >= st) p = l[p]; answer[q] = p; } return answer; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 808 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 17 ms | 3484 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 71 ms | 12348 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |