# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
805446 | 2023-08-03T16:42:58 Z | Navas | Floppy (RMI20_floppy) | C++14 | 881 ms | 11900 KB |
#include <bits/stdc++.h> #include "floppy.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; #define fi first #define se second #define mp make_pair void read_array(int subtask_id, const vector<int> &v) { string bits; vector<int> idx; for(int i = 0 ; i < v.size(); i ++ ){ bits.push_back('1'); while(!idx.empty() && v[idx.back()] < v[i]){ bits.push_back('0'); idx.pop_back(); } idx.push_back(i); } save_to_floppy(bits); } vector<int> solve_queries(int subtask_id, int n, const string &bits, const vector<int> &a, const vector<int> &b) { vector<int> answers = {}; int p = 0; vector<int> L(n); vector<int> st; for(int i = 0 ; i < n; i ++ ){ p ++ ; while(p < bits.size() && bits[p] == '0'){ st.pop_back(); p ++ ; } if(st.empty()) L[i] = -1; else L[i] = st.back(); st.push_back(i); } int m = a.size(); int big; for(int i = 0 ; i < m ; i ++ ){ big = -1; for(int j = a[i]; j <= b[i]; j ++ ){ if(L[j] < a[i]){ big = j; } } answers.push_back(big); } return answers; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 772 KB | Output is correct |
2 | Correct | 1 ms | 672 KB | Output is correct |
3 | Correct | 2 ms | 676 KB | Output is correct |
4 | Correct | 2 ms | 668 KB | Output is correct |
5 | Correct | 2 ms | 700 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 51 ms | 3140 KB | Output is correct |
2 | Correct | 38 ms | 3196 KB | Output is correct |
3 | Correct | 67 ms | 3244 KB | Output is correct |
4 | Correct | 66 ms | 3108 KB | Output is correct |
5 | Correct | 39 ms | 3228 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 411 ms | 9120 KB | Output is correct |
2 | Correct | 407 ms | 11676 KB | Output is correct |
3 | Correct | 792 ms | 11900 KB | Output is correct |
4 | Correct | 881 ms | 11760 KB | Output is correct |
5 | Correct | 404 ms | 11724 KB | Output is correct |