Code Submission Evaluation System Login

HIIT Open 2018

Start:2018-05-26 11:00:00
End:2018-05-26 16:00:00
 

Tasks | Messages | Scoreboard | Statistics


CSES - HIIT Open 2018 - Results
History
2018-05-26 13:33:05
2018-05-26 13:32:44
2018-05-26 12:19:46
Task:Coins
Sender:Tefyn virallinen maajoukkue
Submission time:2018-05-26 13:33:05
Language:C++
Status:READY
Result:WRONG ANSWER

Test results

testverdicttime (s)
#1WRONG ANSWER0.46 / 1.00details
#2WRONG ANSWER0.41 / 1.00details
#3WRONG ANSWER0.42 / 1.00details
#4ACCEPTED0.34 / 1.00details
#5WRONG ANSWER0.47 / 1.00details

Code

#include <bits/stdc++.h>

using namespace std;

struct seg{
    const int pn = 1<<18;
    vector<int> p;
    void init(){
        p = vector<int>(2*pn, 0);
    }
    void set(int i){
        i+=pn;
        p[i] = 1;
        i/=2;
        while(i > 0){
            p[i] = p[2*i]+p[2*i+1];
            i/=2;
        }
    }
    
    int get(int i, int a, int b, int l, int r){
       // cout << i << " " << a << " " << b << " " << l << " " << r << endl;
        if(i >= 2*pn || b <= l || a >= r){
            //cout << "r1" << endl;
            return 0;
        }
        if(l >= a && r <= b){
           // cout << "r2" << endl;
            return p[i];
        }
        //cout << "r3" << endl;
        return get(i*2, a, b, l, (l+r)/2) + get(i*2+1, a, b, (l+r)/2, b);
    }
    int get2(int a, int b){
        return get(1, a, b, 0, pn);
    }
};
int main(){
    int n; cin >> n;
    
    seg p1, p2;
    p1.init();
    p2.init();
    int s1 = 0, s2 = 0;
    int ma1 = 0, ma2 = 0;
    for(int i = 0; i < n; ++i){
        int c, s; cin >> c >> s;
        if(s == 1){
            p1.set(c);
            ++s1;
            ma1 = max(ma1, c);
        }
        else{
            p2.set(c);
            ++s2;
            ma2 = max(ma2, c);
        }
        int su1 = p1.get2(ma2, n+1);
        int su2 = p2.get2(ma1, n+1);
        if(su1 >= s2)
            cout << ">" << endl;
        else if(su2 >= s1)
            cout << "<" << endl;
        else
            cout << "?" << endl;
    }
    
    return 0;
}

/*
 * int mi1 = 1000000000, mi2 = 1000000000;
    int ma1 = 0, ma2 = 0;
    int s1 = 0, s2 = 0;
    for(int i = 0; i < n; ++i){
        int c, s; cin >> c >> s;
        
        if(s == 1){
            s1++;
            mi1 = min(mi1, c);
            ma1 = max(ma1, c);
        }
        else{
            s2++;
            mi2 = min(mi2, c);
            ma2 = max(ma2, c);
        }
        if(s1 >= s2 && mi1 >= ma2)
            cout << ">" << endl;
        else if(s2 >= s1 && mi2 >= ma1)
            cout << "<" << endl;
        else
            cout << "?" << endl;
    }*/

Test details

Test 1

Verdict: WRONG ANSWER

input
200000
175878 1
146174 1
4939 2
181388 1
27963 2
28393 1
101955 2
129380 1
53446 1
56883 2
41641 2
52574 1
185690 2
17672 2
187 2
29223 1
116434 2
81263 2
153912 2
...
view   save

correct output
>
>
>
>
>
>
>
>
>
>
>
>
?
?
?
?
?
?
?
?
...
view   save

user output
>
>
>
>
>
>
>
>
>
>
?
?
?
?
?
?
?
?
?
?
...
view   save

Test 2

Verdict: WRONG ANSWER

input
200000
1 2
2 1
3 2
4 1
5 2
6 1
7 2
8 1
9 2
10 1
11 2
12 1
13 2
14 1
15 2
16 1
17 2
18 1
19 2
...
view   save

correct output
<
>
<
>
<
>
<
>
<
>
<
>
<
>
<
>
<
>
<
>
...
view   save

user output
<
>
<
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
...
view   save

Test 3

Verdict: WRONG ANSWER

input
200000
1 1
2 1
3 1
4 1
5 1
6 2
7 2
8 2
9 2
10 2
11 1
12 1
13 1
14 1
15 1
16 2
17 2
18 2
19 2
...
view   save

correct output
>
>
>
>
>
?
?
?
?
<
?
?
?
?
>
?
?
?
?
<
...
view   save

user output
>
>
>
>
>
>
?
?
?
<
?
?
?
?
>
?
?
?
?
?
...
view   save

Test 4

Verdict: ACCEPTED

input
200000
1 1
2 1
3 1
4 1
5 1
6 1
7 1
8 1
9 1
10 1
11 1
12 1
13 1
14 1
15 1
16 1
17 1
18 1
19 1
...
view   save

correct output
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
...
view   save

user output
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
...
view   save

Test 5

Verdict: WRONG ANSWER

input
200000
188909 2
58944 1
26824 1
143263 2
108129 2
170746 1
129857 2
151652 1
92616 1
5122 1
85017 2
133713 2
130510 1
23167 2
55879 2
81852 1
117028 1
185678 1
5335 2
...
view   save

correct output
<
<
?
<
<
<
<
?
?
?
?
?
?
?
?
?
?
?
?
?
...
view   save

user output
<
<
?
<
<
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
...
view   save