| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 876703 | VahanAbraham | 돌 무게 재기 (IZhO11_stones) | C++14 | 1 ms | 348 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <sstream>
#include <map>
#include <stack>
#include <set>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <math.h>
#include <cmath>
#include <vector>
#include <iomanip>
#include <random>
#include <chrono>
using namespace std;
#define ll long long
#define fr first
#define sc second
#define pb push_back
#define US freopen("milkvisits.in", "r", stdin); freopen("milkvisits.out", "w", stdout);
ll gcd(ll a, ll b)
{
if (a == 0 || b == 0) {
return max(a, b);
}
if (a <= b) {
return gcd(a, b % a);
}
else {
return gcd(a % b, b);
}
}
ll lcm(ll a, ll b) {
return (a / gcd(a, b)) * b;
}
const int N = 300005;
const ll oo = 1000000000000000, MOD = 1000000007;
int sz = 1,t[3 * N][3];
void init(int n) {
while (sz < n) {
sz *= 2;
}
}
int get(int l, int r, int i, int lx, int rx, int x) {
if (lx - rx == 0) {
t[x][i] = 0;
return lx;
}
int m = (lx + rx) / 2, y = 1;
if (t[2 * x + 1][i] > 0) {
y = get(l, r, i, m + 1, rx, 2 * x + 1);
}
else {
y= get(l, r, i, lx, m, 2 * x);
}
t[x][i] = t[2 * x][i] + t[2 * x + 1][i];
return y;
}
void seet(int ind, int i, int l, int r, int x) {
if (r == l) {
t[x][i] = 1;
return;
}
int m = (l + r) / 2;
if (ind <= m) {
seet(ind, i, l, m, 2 * x);
}
else {
seet(ind, i, m + 1, r, 2 * x + 1);
}
t[x][i] = t[2 * x][i] + t[2 * x + 1][i];
}
void solve() {
int q;
cin >> q;
int y = 0, mx = 0;
init(q);
while (q--) {
int r, s;
cin >> r >> s;
if (r > mx) {
mx = r, y = s;
}
if (s == 2) {
int x = get(1, r, 1, 1, sz, 1);
seet(r,2, 1, sz, 1);
}
else {
int x=get(1, r, 2, 1, sz, 1);
seet(r, 1, 1, sz, 1);
}
if (y == 2) {
if (t[1][1] > 0) {
cout << "?" << endl;
}
else {
cout << "<" << endl;
}
}
else {
if (t[1][2] > 0) {
cout << "?" << endl;
}
else {
cout << ">" << endl;
}
}
}
}
int main() {
ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
//US
int tt = 1;
//cin >> tt;
while (tt--) {
solve();
}
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
