#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC target ("avx2")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma comment (linker, "/STACK: 16777216")
#define f first
#define s second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define int long long
using namespace std;
using namespace __gnu_pbds;
template <typename T> inline bool umax(T &a, const T &b) { if(a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool umin(T &a, const T &b) { if(a > b) { a = b; return 1; } return 0; }
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
template <typename T> using oset = tree<T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
ll mod = 998244353;
const ll base = 1e6 + 5;
const ll inf = 1e18;
const int MAX = 1e6;
const int lg = 20;
random_device rd;
mt19937 gen(rd());
uniform_int_distribution<ll> dis(1, inf);
struct node {
int s = 0;
int sf = 0;
int sm = 0;
};
node combine(node a, node b) {
node res;
res.s = a.s + b.s;
res.sf = max(b.sf, a.sf + b.s);
res.sm = min(b.sm, a.sm + b.s);
return res;
}
int n;
vector<node> t;
void update(int i, int x, int v = 0, int l = 0, int r = n) {
if(r - l == 1) {
t[v].s = x;
t[v].sm = min(x, 0LL);
t[v].sf = max(x, 0LL);
return;
}
int m = (l + r) / 2;
if(i < m) update(i, x, 2 * v + 1, l, m);
else update(i, x, 2 * v + 2, m, r);
t[v] = combine(t[2 * v + 1], t[2 * v + 2]);
}
void solve() {
cin >> n;
t.resize(4 * n + 5);
for(int it = 0; it < n; it++) {
int i, x;
cin >> i >> x;
i--;
if(x == 2) x = 1;
else x = -1;
update(i, x);
if(t[0].sf > 0 && t[0].sm < 0) cout << "?\n";
else if(t[0].sf > 0) cout << "<\n";
else if(t[0].sm < 0) cout << ">\n";
}
}
signed main() {
freopen("stones.in", "r", stdin); freopen("stones.out", "w", stdout);
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int ttt = 1;
// cin >> ttt;
while(ttt--) {
solve();
}
return 0;
}
Compilation message
stones.cpp:8: warning: ignoring '#pragma comment ' [-Wunknown-pragmas]
8 | #pragma comment (linker, "/STACK: 16777216")
|
stones.cpp: In function 'int main()':
stones.cpp:86:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
86 | freopen("stones.in", "r", stdin); freopen("stones.out", "w", stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
stones.cpp:86:46: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
86 | freopen("stones.in", "r", stdin); freopen("stones.out", "w", stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |