| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1092114 | juicy | 돌 무게 재기 (IZhO11_stones) | C++17 | 43 ms | 5468 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif
const int N = 1e5 + 5;
int n;
struct Segtree {
int s[4 * N], lz[4 * N];
Segtree() = default;
void app(int id, int x) {
s[id] += x;
lz[id] += x;
}
void psh(int id) {
if (lz[id]) {
app(id * 2, lz[id]);
app(id * 2 + 1, lz[id]);
lz[id] = 0;
}
}
void upd(int u, int v, int x, int id, int l, int r) {
if (u <= l && r <= v) {
app(id, x);
return;
}
psh(id);
int m = (l + r) / 2;
if (u <= m) {
upd(u, v, x, id * 2, l, m);
}
if (m < v) {
upd(u, v, x, id * 2 + 1, m + 1, r);
}
s[id] = min(s[id * 2], s[id * 2 + 1]);
}
void upd(int u, int v, int x) {
upd(u, v, x, 1, 1, n);
}
} tree[2];
bool win(int s) {
return tree[s].s[1] >= 0;
}
int main() {
ios::sync_with_stdio(false); cin.tie(nullptr);
cin >> n;
for (int i = 0; i < n; ++i) {
int r, s; cin >> r >> s; --s;
tree[s].upd(1, r, -1);
tree[s ^ 1].upd(1, r, 1);
cout << (win(0) ? '<' : (win(1) ? '>' : '?')) << "\n";
}
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
