QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#23812 | #2967. Snowball Fight | maze# | WA | 3ms | 3848kb | C++14 | 1.2kb | 2022-03-19 15:51:32 | 2022-04-30 04:10:29 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll, ll>
pll in[3];
bool cmp(pll a, pll b)
{
return a.first > b.first;
}
int main()
{
for (ll i = 0; i < 3; i++)
{
ll x;
scanf("%lld", &x);
in[i] = make_pair(x, i);
}
sort(in, in + 3, cmp);
if (in[0].first >= in[1].first * 2 + in[2].first * 2)
{
printf("%c %d\n", in[0].second + 'A', in[0].first + 1 - in[1].first * 2 - in[2].first * 2);
return 0;
}
ll x = in[0].first - 2 * in[1].first + in[2].first;
if ((x % 3 + 3) % 3 == 0 || (x % 3 + 3) % 3 == 2)
{
puts("Rubble!");
}
else
{
if (x > 0)
{
in[0].first -= (in[1].first - in[2].first) * 2;
in[1].first = in[2].first;
}
else
{
in[0].first -= (in[0].first - in[1].first) * 2;
in[1].first -= (in[0].first - in[1].first);
}
// printf("%lld\n", (abs((x - 1) / 3) + 2 * in[0].first + in[0].second + 1));
ll ans = (abs((x - 1) / 3) + 2 * in[0].first + in[0].second + 1) % 3;
printf("%c %d\n", ans + 'A', 1);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3772kb
input:
10 3 1
output:
A 3
result:
ok single line: 'A 3'
Test #2:
score: 0
Accepted
time: 2ms
memory: 3512kb
input:
3 2 1
output:
Rubble!
result:
ok single line: 'Rubble!'
Test #3:
score: 0
Accepted
time: 2ms
memory: 3640kb
input:
2 3 2
output:
C 1
result:
ok single line: 'C 1'
Test #4:
score: 0
Accepted
time: 2ms
memory: 3848kb
input:
100 101 100
output:
A 1
result:
ok single line: 'A 1'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3512kb
input:
100 99 100
output:
Rubble!
result:
ok single line: 'Rubble!'
Test #6:
score: 0
Accepted
time: 2ms
memory: 3784kb
input:
1000 5000 1000
output:
B 1001
result:
ok single line: 'B 1001'
Test #7:
score: 0
Accepted
time: 2ms
memory: 3772kb
input:
2000 1000 1000
output:
C 1
result:
ok single line: 'C 1'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3776kb
input:
1000000000000000 2000000000000000 4000000000000000
output:
B 1
result:
ok single line: 'B 1'
Test #9:
score: 0
Accepted
time: 2ms
memory: 3720kb
input:
1000000000000000 2000000000000000 4000000000000001
output:
Rubble!
result:
ok single line: 'Rubble!'
Test #10:
score: 0
Accepted
time: 2ms
memory: 3712kb
input:
1 1 1
output:
Rubble!
result:
ok single line: 'Rubble!'
Test #11:
score: 0
Accepted
time: 3ms
memory: 3712kb
input:
1000000000000000000 1000000000000000000 1000000000000000000
output:
Rubble!
result:
ok single line: 'Rubble!'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3716kb
input:
1000000000000000000 1000000000000000000 999999999999999999
output:
Rubble!
result:
ok single line: 'Rubble!'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3764kb
input:
999999999999999999 999999999999999999 1000000000000000000
output:
C 1
result:
ok single line: 'C 1'
Test #14:
score: 0
Accepted
time: 3ms
memory: 3716kb
input:
1000000000000000000 666666666666666666 333333333333333343
output:
Rubble!
result:
ok single line: 'Rubble!'
Test #15:
score: 0
Accepted
time: 3ms
memory: 3708kb
input:
1000000000000000000 1000000000000000000 1
output:
Rubble!
result:
ok single line: 'Rubble!'
Test #16:
score: 0
Accepted
time: 1ms
memory: 3784kb
input:
1000000000000000000 1 1000000000000000000
output:
Rubble!
result:
ok single line: 'Rubble!'
Test #17:
score: 0
Accepted
time: 1ms
memory: 3516kb
input:
1 1000000000000000000 1000000000000000000
output:
Rubble!
result:
ok single line: 'Rubble!'
Test #18:
score: -100
Wrong Answer
time: 3ms
memory: 3760kb
input:
1 1 1000000000000000000
output:
C -1486618627
result:
wrong answer 1st lines differ - expected: 'C 999999999999999997', found: 'C -1486618627'