QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#538043#2967. Snowball Fightstasio6TL 0ms3708kbC++142.8kb2024-08-30 21:34:482024-08-30 21:34:49

Judging History

你现在查看的是最新测评结果

  • [2024-08-30 21:34:49]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:3708kb
  • [2024-08-30 21:34:48]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define rep(i,a,b) for(int i = a; i < (b); i++)
#define sz(x) (int)(x).size()
#define all(x) begin(x), end(x)
#define PB push_back
#define FS first
#define SD second
template<class X, class Y> void cmn(X &a, Y b) { a=min<X>(a, b); }
template<class X, class Y> void cmx(X &a, Y b) { a=max<X>(a, b); }
typedef pair<int, int> pii;
typedef vector<int> vi;

signed main() {
	cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit);
    pii s[3];
    cin >> s[0].FS >> s[1].FS >> s[2].FS;
    for (int i = 0; i < 3; i++) {
        s[i].SD = i;
    }
    while (s[2].FS >= 0) {
        sort(s, s+3, greater<>());
//        cerr << s[0].FS << " " << s[1].FS << " " << s[2].FS << "\n";
        if (s[0].FS == 0) {
            cout << "Rubble!\n";
            break;
        }
        if (s[1].FS == 0) {
            cout << char('A' + s[0].SD) << " " << s[0].FS << "\n";
            break;
        }
        if (s[2].FS == 0) {
            if (s[1].FS == s[0].FS) {
                cout << "Rubble!\n";
            } else {
                cout << char('A' + s[0].SD) << " " << s[0].FS - s[1].FS << "\n";
            }
            break;
        }
        if (s[0].FS == s[2].FS) {
            cout << "Rubble!\n";
            break;
        }
        int diff1 = s[0].FS - s[1].FS, diff2 = s[1].FS - s[2].FS;
        if (diff1 != 0 && diff2 != 0) {
            int diff = min(diff1, diff2);
            s[0].FS -= 2*diff;
            s[1].FS -= diff;
            continue;
        }
        if (diff1 == 0 && min(diff2, s[2].FS) >= 3) {
            int diff = min(diff2, s[2].FS - 1);
            diff = diff / 3 * 3;
            s[0].FS -= diff;
            s[1].FS -= diff;
            continue;
        }
        if (diff2 == 0 && min(diff1, s[2].FS) >= 3) {
            int diff = min(diff1 / 3, s[2].FS - 1);
            s[0].FS -= 4 * diff;
            s[1].FS -= diff;
            s[2].FS -= diff;
            continue;
        }
        if (diff1 + diff2 == 1 && s[2].FS >= 3) {
            int diff = s[2].FS / 3;
            diff *= 3;
            s[0].FS -= diff;
            s[1].FS -= diff;
            s[2].FS -= diff;
            continue;
        }
        int hp[3] = {0, 0, 0};
        int hit[3] = {0, 0, 0};
        for (int i = 0; i < 3; i++) {
            hp[s[i].SD] = s[i].FS;
        }
        if (hp[1] < hp[2])
            hit[2]++;
        else
            hit[1]++;
        if (hp[2] < hp[0])
            hit[0]++;
        else
            hit[2]++;
        if (hp[0] < hp[1])
            hit[1]++;
        else
            hit[0]++;
        for (int i = 0; i < 3; i++) {
            s[i] = {hp[i] - hit[i], i};
        }
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3624kb

input:

10 3 1

output:

A 3

result:

ok single line: 'A 3'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3708kb

input:

3 2 1

output:

Rubble!

result:

ok single line: 'Rubble!'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3628kb

input:

2 3 2

output:

C 1

result:

ok single line: 'C 1'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3556kb

input:

100 101 100

output:

A 1

result:

ok single line: 'A 1'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3556kb

input:

100 99 100

output:

Rubble!

result:

ok single line: 'Rubble!'

Test #6:

score: 0
Accepted
time: 0ms
memory: 3628kb

input:

1000 5000 1000

output:

B 1001

result:

ok single line: 'B 1001'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

2000 1000 1000

output:

C 1

result:

ok single line: 'C 1'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3708kb

input:

1000000000000000 2000000000000000 4000000000000000

output:

B 1

result:

ok single line: 'B 1'

Test #9:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

1000000000000000 2000000000000000 4000000000000001

output:

Rubble!

result:

ok single line: 'Rubble!'

Test #10:

score: 0
Accepted
time: 0ms
memory: 3664kb

input:

1 1 1

output:

Rubble!

result:

ok single line: 'Rubble!'

Test #11:

score: 0
Accepted
time: 0ms
memory: 3504kb

input:

1000000000000000000 1000000000000000000 1000000000000000000

output:

Rubble!

result:

ok single line: 'Rubble!'

Test #12:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

1000000000000000000 1000000000000000000 999999999999999999

output:

Rubble!

result:

ok single line: 'Rubble!'

Test #13:

score: 0
Accepted
time: 0ms
memory: 3632kb

input:

999999999999999999 999999999999999999 1000000000000000000

output:

C 1

result:

ok single line: 'C 1'

Test #14:

score: 0
Accepted
time: 0ms
memory: 3624kb

input:

1000000000000000000 666666666666666666 333333333333333343

output:

Rubble!

result:

ok single line: 'Rubble!'

Test #15:

score: -100
Time Limit Exceeded

input:

1000000000000000000 1000000000000000000 1

output:


result: