Submission #13230

# Submission time Handle Problem Language Result Execution time Memory
13230 2015-02-05T09:44:21 Z dohyun0324 Weighting stones (IZhO11_stones) C++
36 / 100
69 ms 8112 KB
#include<stdio.h>
#include<algorithm>
using namespace std;
int n,x,y,t=1,p;
struct data
{
    int maxi,mini,ch;
}tree[600010];
void update(int x,int y,int k,int s,int e)
{
    if(tree[k].ch)
    {
        tree[k].maxi+=tree[k].ch; tree[k].mini=tree[k].ch;
        tree[k*2].ch+=tree[k].ch; tree[k*2+1].ch+=tree[k].ch; tree[k].ch=0;
    }
    if(s<=x && y<=e)
    {
        tree[k].maxi+=p; tree[k].mini+=p; tree[k*2].ch+=p; tree[k*2+1].ch+=p;
        return;
    }
    if(s>y || e<x) return;
    update(x,(x+y)/2,k*2,s,e);
    update((x+y)/2+1,y,k*2+1,s,e);
    tree[k].maxi=max(tree[k*2].maxi,tree[k*2+1].maxi);
    tree[k].mini=min(tree[k*2].mini,tree[k*2+1].mini);
}
int main()
{
    int i;
    scanf("%d",&n);
    for(;;){if(t>=n) break; t*=2;}
    for(i=1;i<=n;i++)
    {
        scanf("%d %d",&x,&y);
        if(y==1) p=1; else p=-1;
        update(1,t,1,1,x);
        if(tree[1].maxi<=0) printf("<\n");
        else if(tree[1].mini>=0) printf(">\n");
        else printf("?\n");
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 8112 KB Output isn't correct - 22nd words differ - expected: '?', found: '>'
2 Incorrect 0 ms 8112 KB Output isn't correct - 17th words differ - expected: '?', found: '>'
3 Incorrect 0 ms 8112 KB Output isn't correct - 12th words differ - expected: '?', found: '>'
4 Correct 0 ms 8112 KB Output is correct - 21 tokens
5 Incorrect 0 ms 8112 KB Output isn't correct - 16th words differ - expected: '?', found: '>'
6 Correct 0 ms 8112 KB Output is correct - 492 tokens
7 Incorrect 0 ms 8112 KB Output isn't correct - 263rd words differ - expected: '?', found: '>'
8 Incorrect 1 ms 8112 KB Output isn't correct - 27th words differ - expected: '>', found: '?'
9 Incorrect 0 ms 8112 KB Output isn't correct - 10th words differ - expected: '?', found: '>'
10 Correct 4 ms 8112 KB Output is correct - 8921 tokens
11 Incorrect 39 ms 8112 KB Output isn't correct - 23rd words differ - expected: '>', found: '?'
12 Incorrect 68 ms 8112 KB Output isn't correct - 1348th words differ - expected: '?', found: '>'
13 Correct 56 ms 8112 KB Output is correct - 100000 tokens
14 Correct 56 ms 8112 KB Output is correct - 100000 tokens
15 Incorrect 61 ms 8112 KB Output isn't correct - 25th words differ - expected: '?', found: '>'
16 Incorrect 62 ms 8112 KB Output isn't correct - 10th words differ - expected: '>', found: '?'
17 Correct 52 ms 8112 KB Output is correct - 100000 tokens
18 Correct 65 ms 8112 KB Output is correct - 99999 tokens
19 Correct 69 ms 8112 KB Output is correct - 99999 tokens
20 Correct 63 ms 8112 KB Output is correct - 99999 tokens
21 Incorrect 39 ms 8112 KB Output isn't correct - 7th words differ - expected: '>', found: '?'
22 Incorrect 60 ms 8112 KB Output isn't correct - 9th words differ - expected: '>', found: '?'
23 Incorrect 56 ms 8112 KB Output isn't correct - 31st words differ - expected: '>', found: '?'
24 Incorrect 55 ms 8112 KB Output isn't correct - 24th words differ - expected: '?', found: '>'
25 Incorrect 54 ms 8112 KB Output isn't correct - 63rd words differ - expected: '>', found: '?'