# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
650013 | 2022-10-11T21:15:46 Z | taulant | Floppy (RMI20_floppy) | C++14 | 82 ms | 15508 KB |
#include "bits/stdc++.h" #include "floppy.h" using namespace std; array<int, 2> t[16][42069]; int mx(int l, int r){ int y = 0, k = 1; while(k+k <= r-l) ++y, k *= 2; return max(t[y][l], t[y][r-k])[1]; } void read_array(int _, const vector<int> &v){ stack<int> s; string b; for(int i : v){ while(s.size() && s.top() < i){s.pop(); b += '0';} s.push(i); b += '1'; } save_to_floppy(b); } vector<int> solve_queries(int _, int n, const string &b, const vector<int> &l, const vector<int> &r){ vector<int> v, ans; int x = 69420; for(char c : b){ if(c > 48) v.push_back(--x); else ++x; } for(int i = 0; i < n; ++i) t[0][i] = {v[i], i}; for(int y = 0; y < 15; ++y){ int p = 1 << y; for(int i = 0; i+p+p <= n; ++i) t[y+1][i] = max(t[y][i], t[y][i+p]); } for(int i = 0; i < l.size(); ++i) ans.push_back(mx(l[i], r[i]+1)); return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 808 KB | Output is correct |
2 | Correct | 2 ms | 816 KB | Output is correct |
3 | Correct | 2 ms | 812 KB | Output is correct |
4 | Correct | 2 ms | 764 KB | Output is correct |
5 | Correct | 2 ms | 804 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 20 ms | 4248 KB | Output is correct |
2 | Correct | 20 ms | 4276 KB | Output is correct |
3 | Correct | 19 ms | 4228 KB | Output is correct |
4 | Correct | 20 ms | 4244 KB | Output is correct |
5 | Correct | 22 ms | 4364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 82 ms | 13996 KB | Output is correct |
2 | Correct | 79 ms | 15400 KB | Output is correct |
3 | Correct | 74 ms | 15216 KB | Output is correct |
4 | Correct | 82 ms | 15508 KB | Output is correct |
5 | Correct | 82 ms | 15472 KB | Output is correct |