QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#877779#9051. ABC StringBoyuridodWA 4ms3968kbC++201.8kb2025-02-01 07:48:282025-02-01 07:48:28

Judging History

This is the latest submission verdict.

  • [2025-02-01 07:48:28]
  • Judged
  • Verdict: WA
  • Time: 4ms
  • Memory: 3968kb
  • [2025-02-01 07:48:28]
  • Submitted

answer

// https://vjudge.net/contest/689473#problem/A

#include <bits/stdc++.h>

using namespace std;

#define A 0
#define B 1
#define C 2
#define AB 3
#define AC 4
#define BC 5

int main(){

    int beleza = 0, i = 0;
    string palavra = "";
    vector<int> combinacao(6, 0);

    cin >> palavra;

    for(i = 0; i < palavra.size(); i++){

        if(palavra[i] == 'A'){

            if(combinacao[BC] >= 1){

                combinacao[BC]--;

                beleza++;

            }

            else if(combinacao[B] >= 1){

                combinacao[AB]++;

                combinacao[B]--;

            }

            else if(combinacao[C] >= 1){

                combinacao[AC]++;

                combinacao[C]--;

            }

            else{

                combinacao[A]++;

            }

        }

        else if(palavra[i] == 'B'){

            if(combinacao[AC] >= 1){

                combinacao[AC]--;

                beleza++;

            }

            else if(combinacao[A] >= 1){

                combinacao[AB]++;

                combinacao[A]--;

            }

            else if(combinacao[C] >= 1){

                combinacao[BC]++;

                combinacao[C]--;

            }

            else{

                combinacao[B]++;

            }

        }

        else if(palavra[i] == 'C'){

            if(combinacao[AB] >= 1){

                combinacao[AB]--;

                beleza++;

            }

            else if(combinacao[A] >= 1){

                combinacao[AC]++;

                combinacao[A]--;

            }

            else if(combinacao[B] >= 1){

                combinacao[BC]++;

                combinacao[B]--;

            }

            else{

                combinacao[C]++;

            }

        }

    }

    cout << beleza/2 << endl;

    return 0;

}

詳細信息

Test #1:

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

input:

ABACBCAACCBB

output:

2

result:

ok single line: '2'

Test #2:

score: -100
Wrong Answer
time: 4ms
memory: 3968kb

input:

BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

output:

50000

result:

wrong answer 1st lines differ - expected: '100000', found: '50000'