# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
746307 | 2023-05-22T09:28:25 Z | doowey | Floppy (RMI20_floppy) | C++14 | 968 ms | 12204 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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 672 KB | Output is correct |
2 | Correct | 2 ms | 672 KB | Output is correct |
3 | Correct | 2 ms | 672 KB | Output is correct |
4 | Correct | 2 ms | 684 KB | Output is correct |
5 | Correct | 2 ms | 656 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 44 ms | 3172 KB | Output is correct |
2 | Correct | 44 ms | 3176 KB | Output is correct |
3 | Correct | 66 ms | 3216 KB | Output is correct |
4 | Correct | 77 ms | 3140 KB | Output is correct |
5 | Correct | 46 ms | 3240 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 455 ms | 11596 KB | Output is correct |
2 | Correct | 451 ms | 11648 KB | Output is correct |
3 | Correct | 787 ms | 12204 KB | Output is correct |
4 | Correct | 968 ms | 12048 KB | Output is correct |
5 | Correct | 459 ms | 11640 KB | Output is correct |