#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <functional>
#include <vector>
#include <deque>
#include <utility>
#include <bitset>
#include <limits.h>
#include <time.h>
using namespace std;
typedef long long ll;
typedef unsigned long long llu;
typedef double lf;
typedef unsigned int uint;
typedef long double llf;
typedef pair<int, int> pii;
const int LEAF = 8;
const int N_ = 100005;
int N;
struct node {
int sum, tag;
int mn, mx;
} Tree[LEAF+LEAF];
void spread (int nd, int len) {
if(nd < LEAF) {
for(int k = 0; k < 2; k++) {
Tree[nd+nd+k].sum += Tree[nd].tag * (len/2);
Tree[nd+nd+k].mn += Tree[nd].tag;
Tree[nd+nd+k].mx += Tree[nd].tag;
Tree[nd+nd+k].tag += Tree[nd].tag;
}
Tree[nd].tag = 0;
}
}
void update (int nd, int nl, int nr, int x, int y, int d) {
node &u = Tree[nd];
int nmid = (nl + nr) >> 1;
spread(nd, nr-nl+1);
if(x <= nl && nr <= y) {
u.sum += d * (nr-nl+1);
u.mn += d;
u.mx += d;
u.tag += d;
return;
}
if(x <= nmid)
update(nd+nd, nl, nmid, x, min(y, nmid), d);
if(y > nmid)
update(nd+nd+1, nmid+1, nr, max(x, nmid+1), y, d);
Tree[nd].sum = Tree[nd+nd].sum + Tree[nd+nd+1].sum;
Tree[nd].mn = min(Tree[nd+nd].mn, Tree[nd+nd+1].mn);
Tree[nd].mx = max(Tree[nd+nd].mx, Tree[nd+nd+1].mx);
Tree[nd].tag = 0;
}
void update (int p, int d) {
update(1, 1, LEAF, 1, p, d);
}
int main() {
int i, j, k;
scanf("%d", &N);
while(N--) {
int r, s; scanf("%d%d", &r, &s);
int v = (s == 1) ? 1 : -1;
update(r, v);
bool h1 = (Tree[1].mn >= 0);
bool h2 = (Tree[2].mx <= 0);
putchar((h1 ^ h2) ? (h1 ? '>' : '<') : '?');
putchar('\n');
// printf("%d %d\n", Tree[1].mn, Tree[1].mx);
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct - 2nd words differ - expected: '<', found: '?' |
2 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct - 2nd words differ - expected: '>', found: '?' |
3 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct - 1st words differ - expected: '>', found: '?' |
4 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct - 2nd words differ - expected: '>', found: '?' |
5 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct - 3rd words differ - expected: '?', found: '<' |
6 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct - 1st words differ - expected: '>', found: '?' |
7 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct - 2nd words differ - expected: '>', found: '?' |
8 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct - 3rd words differ - expected: '?', found: '<' |
9 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct - 2nd words differ - expected: '<', found: '?' |
10 |
Incorrect |
1 ms |
1084 KB |
Output isn't correct - 8th words differ - expected: '?', found: '<' |
11 |
Incorrect |
10 ms |
1084 KB |
Output isn't correct - 2nd words differ - expected: '<', found: '?' |
12 |
Incorrect |
23 ms |
1084 KB |
Output isn't correct - 1st words differ - expected: '>', found: '?' |
13 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct - 8th words differ - expected: '>', found: '?' |
14 |
Incorrect |
25 ms |
1084 KB |
Output isn't correct - 8th words differ - expected: '<', found: '?' |
15 |
Incorrect |
23 ms |
1084 KB |
Output isn't correct - 21st words differ - expected: '?', found: '<' |
16 |
Incorrect |
23 ms |
1084 KB |
Output isn't correct - 1st words differ - expected: '>', found: '?' |
17 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct - 1st words differ - expected: '>', found: '?' |
18 |
Incorrect |
26 ms |
1084 KB |
Output isn't correct - 4th words differ - expected: '?', found: '<' |
19 |
Incorrect |
21 ms |
1084 KB |
Output isn't correct - 10th words differ - expected: '<', found: '?' |
20 |
Incorrect |
19 ms |
1084 KB |
Output isn't correct - 4th words differ - expected: '<', found: '?' |
21 |
Incorrect |
29 ms |
1084 KB |
Output isn't correct - 1st words differ - expected: '>', found: '?' |
22 |
Incorrect |
27 ms |
1084 KB |
Output isn't correct - 2nd words differ - expected: '>', found: '?' |
23 |
Incorrect |
24 ms |
1084 KB |
Output isn't correct - 2nd words differ - expected: '>', found: '?' |
24 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct - 3rd words differ - expected: '?', found: '<' |
25 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct - 4th words differ - expected: '>', found: '?' |