# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
492338 | 2021-12-06T18:11:11 Z | Pety | Floppy (RMI20_floppy) | C++14 | 89 ms | 14116 KB |
#include <bits/stdc++.h> #include "floppy.h" using namespace std; int dp[17][40002]; void read_array(int subtask_id, const vector<int> &v) { string bits; stack<int>st; st.push(-1); for (int i = 0; i < v.size(); i++) { while (st.top() != -1 && v[st.top()] < v[i]) { bits += '0'; st.pop(); } st.push(i); bits += '1'; } save_to_floppy(bits); } vector<int> solve_queries(int subtask_id, int N, const string &bits, const vector<int>&a, const vector<int>&b) { stack<int>st; st.push(-1); int ind = 0; int ind2 = 0; while (ind < N) { while (bits[ind2] == '0') { ind2++; st.pop(); } dp[0][ind + 1] = st.top() + 1; st.push(ind); ind2++; ind++; } for (int i = 1; (1 << i) <= N; i++) for (int j = 1; j <= N; j++) dp[i][j] = dp[i - 1][dp[i - 1][j]]; vector<int>ans; for (int i = 0; i < a.size(); i++) { int poz = b[i] + 1; for (int pas = 15; pas >= 0; pas--) { if ((1 << pas) > N) continue; if (dp[pas][poz] >= a[i] + 1) { poz = dp[pas][poz]; } } ans.push_back(poz - 1); } return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 792 KB | Output is correct |
2 | Correct | 1 ms | 792 KB | Output is correct |
3 | Correct | 1 ms | 792 KB | Output is correct |
4 | Correct | 2 ms | 832 KB | Output is correct |
5 | Correct | 2 ms | 792 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 19 ms | 3908 KB | Output is correct |
2 | Correct | 19 ms | 3872 KB | Output is correct |
3 | Correct | 19 ms | 3840 KB | Output is correct |
4 | Correct | 20 ms | 3940 KB | Output is correct |
5 | Correct | 26 ms | 3856 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 87 ms | 14012 KB | Output is correct |
2 | Correct | 86 ms | 13952 KB | Output is correct |
3 | Correct | 81 ms | 14024 KB | Output is correct |
4 | Correct | 89 ms | 14052 KB | Output is correct |
5 | Correct | 82 ms | 14116 KB | Output is correct |