| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 870606 | sleepntsheep | Alternating Heights (CCO22_day1problem1) | C++17 | 240 ms | 25684 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <deque>
#include <set>
#include <utility>
#include <array>
using namespace std;
#define ALL(x) x.begin(), x.end()
#define ShinLena cin.tie(nullptr)->sync_with_stdio(false);
using i64 = long long;
#define N 3005
#define Q 1000005
int n, k, q, a[N], b[N], d[N], e[N][N][2];
array<int, 3> c[Q];
void upd(int p, int k) { for (;p<N;p+=p&-p) b[p]+=k; }
int qry(int p) { int z = 0; for (;p;p-=p&-p) z += b[p]; return z;}
int main()
{
ShinLena;
cin >> n >> k >> q;
for (int i = (*a = -86, 1); i <= n; ++i) cin >> a[i];
for (int i = 0; i < q; ++i) cin >> c[i][0] >> c[i][1], c[i][2] = i;
sort(c, c+q);
for (int i = n, j = q-1; i; --i)
{
if (a[i] == a[i+1]) upd(i+1, 1);
int x = a[i], y = a[i+1];
if (e[x][y][i&1^1]) upd(e[x][y][i&1^1], 1);
if (e[y][x][i&1]) upd(e[y][x][i&1], 1);
e[x][y][i&1] = i+1;
e[y][x][i&1^1] = i+1;
for (; j >= 0 && c[j][0] >= i; --j) d[c[j][2]] = qry(c[j][1]);
}
for (int i = 0; i < q; ++i) cout << (d[i] ? "NO\n": "YES\n");
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... | ||||
