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;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
long long a, b;
pair<long long, bool> c, d, e, f, g, h, i, j;
a = 0;
b = 0;
c.first = -1;
c.second = 0;
d.first = -1;
d.second = 0;
e.first = -1;
e.second = 0;
f.first = -1;
f.second = 0;
g.first = -1;
g.second = 0;
h.first = -1;
h.second = 0;
i.first = -1;
i.second = 0;
j.first = -1;
j.second = 0;
long long k;
cin>>k;
while(k--){
long long l, m, n;
cin>>l>>m>>n;
switch(m){
case 1:
a += 100;
if(c.first != -1){
if(l - c.first <= 10){
c.second = 1;
a += 50 * c.second;
} else {
c.second = 0;
}
} else {
c.second = 1;
}
c.first = l;
break;
case 2:
a += 100;
if(d.first != -1){
if(l - d.first <= 10){
d.second = 1;
a += 50 * d.second;
} else {
d.second = 0;
}
} else {
d.second = 1;
}
d.first = l;
break;
case 3:
a += 100;
if(e.first != -1){
if(l - e.first <= 10){
e.second = 1;
a += 50 * e.second;
} else {
e.second = 0;
}
} else {
e.second = 1;
}
e.first = l;
break;
case 4:
a += 100;
if(f.first != -1){
if(l - f.first <= 10){
c.second = 1;
a += 50 * f.second;
} else {
f.second = 0;
}
} else {
f.second = 1;
}
f.first = l;
break;
case 5:
b += 100;
if(g.first != -1){
if(l - g.first <= 10){
g.second = 1;
b += 50 * g.second;
} else {
g.second = 0;
}
} else {
g.second = 1;
}
g.first = l;
break;
case 6:
b += 100;
if(h.first != -1){
if(l - h.first <= 10){
h.second = 1;
b += 50 * h.second;
} else {
h.second = 0;
}
} else {
h.second = 1;
}
h.first = l;
break;
case 7:
b += 100;
if(i.first != -1){
if(l - i.first <= 10){
i.second = 1;
b += 50 * i.second;
} else {
i.second = 0;
}
} else {
i.second = 1;
}
i.first = l;
break;
case 8:
b += 100;
if(j.first != -1){
if(l - j.first <= 10){
j.second = 1;
b += 50 * j.second;
} else {
j.second = 0;
}
} else {
j.second = 1;
}
j.first = l;
}
}
cout<<a<<" "<<b;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |