| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 333016 | Boaba | Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) | C++14 | 1231 ms | 109104 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <cstdio>
#include <vector>
#define Max(a, b) (((a) < (b)) ? (b) : (a))
#pragma GCC optimize ("O3")
const int nmax = 1e6 + 5;
struct day {
int st, dr, ind, k;
};
int v[nmax], aib[nmax], n, m;
bool ans[nmax];
std::vector<int>st, last[nmax];
std::vector<day>skema[nmax];
void update(int poz, int val) {
for (; poz <= n; poz += poz & (-poz))
aib[poz] = Max(aib[poz], val);
}
int query(int poz) {
int ans = 0;
for (; poz > 0; poz -= poz & (-poz))
ans = Max(ans, aib[poz]);
return ans;
}
int main() {
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; i++){
scanf("%d", &v[i]);
while (!st.empty() and v[st.back()] <= v[i]) st.pop_back();
if (!st.empty()) last[st.back()].push_back(i);
st.push_back(i);
}
for (int i = 1; i <= m; i++) {
day aux;
scanf("%d %d %d", &aux.st, &aux.dr, &aux.k);
aux.ind = i;
skema[aux.st].push_back(aux);
}
for (int i = n; i > 0; i--) {
for (int x : last[i]) update(x, v[x] + v[i]);
for (day aux : skema[i]) ans[aux.ind] = (query(aux.dr) <= aux.k);
}
for (int i = 1; i <= m; i++) printf("%d\n", ans[i]);
return 0;
}
컴파일 시 표준 에러 (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... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
