Submission #88681

# Submission time Handle Problem Language Result Execution time Memory
88681 2018-12-07T12:17:43 Z Badral Weighting stones (IZhO11_stones) C++17
0 / 100
2 ms 376 KB
#include <bits/stdc++.h>
using namespace std;
#define maxn 131072

struct asd{
    int de1, do1, de2, do2;
} m[maxn*2];

void lol(asd &q, asd &l, asd &r) {
	int pal1 = min(r.de1, l.do2);
	int pal2 = min(r.de2, l.do1);
	q.de1 = l.de1 + r.de1 - pal1; 
	q.do2 = l.do2 + r.do2 - pal1;
	q.de2 = l.de2 + r.de2 - pal2; 
	q.do1 = l.do1 + r.do1 - pal2;
}


int n;
int main() {
    cin >>n;
    while(n--) {
        int nn, tal;
        cin >>nn >>tal;
        int pp = 1000+nn;
        if (tal == 1) {
            m[pp].de1++;
            m[pp].do1++;
            while (pp /= 2) {lol(m[pp], m[pp*2], m[pp*2 + 1]); }
        } 
        else {
            m[pp].de2++;
            m[pp].do2++;
            while (pp /= 2) {lol(m[pp], m[pp*2], m[pp*2 + 1]); }
        }
        if (m[1].do1 == 0) cout <<"<\n";
        else if (m[1].do2 == 0) cout <<">\n";
        else cout <<"?\n";
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -