# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
88680 | Badral | Weighting stones (IZhO11_stones) | C++17 | 2 ms | 376 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|---|---|---|---|
Fetching results... |