Submission #8836

# Submission time Handle Problem Language Result Execution time Memory
8836 2014-09-21T08:07:09 Z baneling100 Weighting stones (IZhO11_stones) C++
12 / 100
60 ms 4156 KB
#include <stdio.h>
#include <algorithm>

using namespace std;

int N, R, S, M, Value, Max[262144], Min[262144], Idx[262144];

void SegTree(int Left, int Right, int Loc) {

    int Mid = (Left + Right) / 2;

    if(Right <= R)
        Idx[Loc] += Value;
    Idx[2 * Loc] += Idx[Loc];
    Idx[2 * Loc + 1] += Idx[Loc];
    Max[Loc] += Idx[Loc];
    Min[Loc] += Idx[Loc];
    Idx[Loc] = 0;
    if(Right > R) {
        SegTree(Left, Mid, 2 * Loc);
        if(Mid + 1 <= R)
            SegTree(Mid + 1, Right, 2 * Loc + 1);
        Max[Loc] = max(Max[2 * Loc], Max[2 * Loc + 1]);
        Min[Loc] = min(Min[2 * Loc], Min[2 * Loc + 1]);
    }
}

int main(void) {

    int i;

    scanf("%d", &N);
    for(M = 1 ; M < N ; M *= 2);
    for(i = 1 ; i <= N ; i++) {
        scanf("%d %d", &R, &S);
        if(S == 1)
            Value = 1;
        else
            Value = -1;
        SegTree(1, M, 1);
        if(Min[1] >= 0)
            printf(">\n");
        else if(Max[1] <= 0)
            printf("<\n");
        else
            printf("?\n");
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 4156 KB Output is correct - 73 tokens
2 Incorrect 0 ms 4156 KB Output isn't correct - 5th words differ - expected: '>', found: '?'
3 Correct 0 ms 4156 KB Output is correct - 221 tokens
4 Incorrect 0 ms 4156 KB Output isn't correct - 3rd words differ - expected: '?', found: '<'
5 Incorrect 0 ms 4156 KB Output isn't correct - 8th words differ - expected: '<', found: '?'
6 Incorrect 0 ms 4156 KB Output isn't correct - 5th words differ - expected: '<', found: '?'
7 Incorrect 0 ms 4156 KB Output isn't correct - 4th words differ - expected: '<', found: '?'
8 Incorrect 0 ms 4156 KB Output isn't correct - 14th words differ - expected: '>', found: '?'
9 Incorrect 0 ms 4156 KB Output isn't correct - 6th words differ - expected: '>', found: '?'
10 Incorrect 6 ms 4156 KB Output isn't correct - 5th words differ - expected: '<', found: '?'
11 Incorrect 36 ms 4156 KB Output isn't correct - 8th words differ - expected: '<', found: '?'
12 Incorrect 60 ms 4156 KB Output isn't correct - 25193rd words differ - expected: '<', found: '?'
13 Incorrect 59 ms 4156 KB Output isn't correct - 4th words differ - expected: '>', found: '?'
14 Correct 58 ms 4156 KB Output is correct - 100000 tokens
15 Incorrect 45 ms 4156 KB Output isn't correct - 5th words differ - expected: '<', found: '?'
16 Incorrect 55 ms 4156 KB Output isn't correct - 3rd words differ - expected: '>', found: '?'
17 Incorrect 57 ms 4156 KB Output isn't correct - 3rd words differ - expected: '?', found: '<'
18 Incorrect 59 ms 4156 KB Output isn't correct - 17th words differ - expected: '<', found: '?'
19 Incorrect 55 ms 4156 KB Output isn't correct - 5th words differ - expected: '<', found: '?'
20 Incorrect 46 ms 4156 KB Output isn't correct - 3rd words differ - expected: '<', found: '?'
21 Incorrect 59 ms 4156 KB Output isn't correct - 7th words differ - expected: '>', found: '?'
22 Incorrect 55 ms 4156 KB Output isn't correct - 7th words differ - expected: '>', found: '?'
23 Incorrect 59 ms 4156 KB Output isn't correct - 25th words differ - expected: '>', found: '?'
24 Incorrect 58 ms 4156 KB Output isn't correct - 26th words differ - expected: '>', found: '?'
25 Incorrect 56 ms 4156 KB Output isn't correct - 3rd words differ - expected: '<', found: '?'