# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
596641 | 2022-07-14T23:14:51 Z | definitelynotmee | Floppy (RMI20_floppy) | C++17 | 1000 ms | 8024 KB |
#include <stdlib.h> #include <string.h> #include "floppy.h" #include<bits/stdc++.h> #define ff first #define ss second #define all(x) x.begin(), x.end() using namespace std; using ll = long long; using pii = pair<int,int>; using pll = pair<ll,ll>; template<typename T> using matrix = vector<vector<T>>; void read_array(int subtask_id, const std::vector<int> &v) { int n = v.size(); vector<int> jmp(n,-1); string bits; for(int i = 1; i < n; i++){ jmp[i] = i-1; while(jmp[i]!=-1 && v[jmp[i]] < v[i]) jmp[i] = jmp[jmp[i]], bits.push_back('0'); bits.push_back('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> answers(b.size()); vector<int> jmp(n,-1); int ptr = 0; for(int i = 1; i < n; i++){ jmp[i] = i-1; while(true){ if(bits[ptr++] == '0'){ jmp[i] = jmp[jmp[i]]; } else break; } } for(int i = 0; i < a.size(); i++){ int id = b[i]; while(jmp[id] >= a[i]) id = jmp[id]; answers[i] = id; } return answers; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 656 KB | Output is correct |
2 | Correct | 3 ms | 664 KB | Output is correct |
3 | Correct | 2 ms | 524 KB | Output is correct |
4 | Correct | 2 ms | 656 KB | Output is correct |
5 | Correct | 1 ms | 664 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 20 ms | 2336 KB | Output is correct |
2 | Correct | 22 ms | 2320 KB | Output is correct |
3 | Correct | 106 ms | 2328 KB | Output is correct |
4 | Correct | 30 ms | 2416 KB | Output is correct |
5 | Correct | 20 ms | 2316 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 75 ms | 8024 KB | Output is correct |
2 | Correct | 74 ms | 7988 KB | Output is correct |
3 | Execution timed out | 1102 ms | 7768 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |