# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
821770 | LucaLucaM | Floppy (RMI20_floppy) | C++17 | 71 ms | 12348 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "floppy.h"
using namespace std;
void read_array(int subtask_id, const std::vector<int> &v) {
int n = (int) v.size();
stack<int>st;
string bits = "";
for (int i = 0; i < n; i++) {
while (!st.empty() && v[i] >= v[st.top()]) {
st.pop();
bits += "0";
}
st.push(i);
bits += "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>answer;
int n = (int) bits.size();
n >>= 1;
vector<int>l(n + 1);
int sz = 0;
for (int i = 0, j = 0; i < (int) bits.size(); i++) {
if (bits[i] == '0') {
sz--;
} else {
l[++j] = sz;
}
}
for (int q = 0; q < N; q++) {
int st = a[q], dr = b[q];
int p = dr;
while (l[p] >= st)
p = l[p];
answer[q] = p;
}
return answer;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |