Submission #8835

# Submission time Handle Problem Language Result Execution time Memory
8835 2014-09-21T07:58:00 Z baneling100 Weighting stones (IZhO11_stones) C++
8 / 100
57 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) {
        Max[Loc] += Idx[Loc] + Value;
        Min[Loc] += Idx[Loc] + Value;
        Idx[Loc] = 0;
    }
    else {
        Idx[2 * Loc] += Idx[Loc];
        Idx[2 * Loc + 1] += Idx[Loc];
        Idx[Loc] = 0;
        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(Max[1] >= 0 && Min[1] >= 0)
            printf(">\n");
        else if(Max[1] <= 0 && Min[1] <= 0)
            printf("<\n");
        else
            printf("?\n");
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 4156 KB Output isn't correct - 4th words differ - expected: '<', found: '?'
2 Incorrect 0 ms 4156 KB Output isn't correct - 4th words differ - expected: '>', found: '?'
3 Incorrect 0 ms 4156 KB Output isn't correct - 7th words differ - expected: '<', found: '?'
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 - 3rd words differ - expected: '?', found: '>'
6 Incorrect 0 ms 4156 KB Output isn't correct - 3rd 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 - 13th words differ - expected: '?', found: '>'
9 Incorrect 0 ms 4156 KB Output isn't correct - 2nd words differ - expected: '<', found: '?'
10 Incorrect 4 ms 4156 KB Output isn't correct - 5th words differ - expected: '<', found: '?'
11 Incorrect 27 ms 4156 KB Output isn't correct - 2nd words differ - expected: '<', found: '?'
12 Incorrect 56 ms 4156 KB Output isn't correct - 25193rd words differ - expected: '<', found: '?'
13 Correct 46 ms 4156 KB Output is correct - 100000 tokens
14 Correct 42 ms 4156 KB Output is correct - 100000 tokens
15 Incorrect 47 ms 4156 KB Output isn't correct - 5th words differ - expected: '<', found: '?'
16 Incorrect 57 ms 4156 KB Output isn't correct - 3rd words differ - expected: '>', found: '?'
17 Incorrect 44 ms 4156 KB Output isn't correct - 2nd words differ - expected: '>', found: '<'
18 Incorrect 38 ms 4156 KB Output isn't correct - 16th words differ - expected: '<', found: '?'
19 Incorrect 44 ms 4156 KB Output isn't correct - 5th words differ - expected: '<', found: '?'
20 Incorrect 37 ms 4156 KB Output isn't correct - 3rd words differ - expected: '<', found: '?'
21 Incorrect 26 ms 4156 KB Output isn't correct - 5th words differ - expected: '>', found: '?'
22 Incorrect 43 ms 4156 KB Output isn't correct - 7th words differ - expected: '>', found: '?'
23 Incorrect 49 ms 4156 KB Output isn't correct - 5th words differ - expected: '>', found: '?'
24 Incorrect 38 ms 4156 KB Output isn't correct - 11th words differ - expected: '<', found: '?'
25 Incorrect 35 ms 4156 KB Output isn't correct - 3rd words differ - expected: '<', found: '?'