QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#602154#7034. Honeycombucup-team5071#WA 0ms3712kbC++201.4kb2024-09-30 20:20:442024-09-30 20:20:45

Judging History

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

  • [2024-09-30 20:20:45]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3712kb
  • [2024-09-30 20:20:44]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long 
void Solve(){   
    int h1,h2,a1,a2;
    cin>>h1>>h2>>a1>>a2;
    int s=0,m1=0,p1=0,n1=0,m2=0,p2=0,n2=0,min_p2=0;
    while(1){
        ++m1;
        s+=m1;
        if(s>=h1){
            p1=s-h1;
            break;
        }
    }
    n1=m1;
    s=p1;
    while(1){
        ++n1;
        s+=n1;
        if(s>=h2){
            if(s-h2>=p1)p1=0;   
            break;
        }
    }
    s=0;
    while(1){
        ++m2;
        s+=m2;
        if(s>=h2){
            p2=s-h2;
            break;
        }
    }
    n2=m2;
    s=p2;
    while(1){
        ++n2;
        s+=n2;
        if(s>=h1){
            min_p2=p2-(s-h1);
            break;
        }
    }
    if(a1*m1+a2*n1<=a2*m2+a1*n2){
        cout<<a1*m1+a2*n1<<" ";
        for(int i=1;i<=m1;i++){
            if(i==p1)cout<<'B';
            else cout<<'A';
        }
        for(int i=m1+1;i<=n1;i++)
            cout<<'B';
    }
    else {  
        cout<<a2*m2+a1*n2<<" ";
        for(int i=1;i<=m2;i++){
            if(i==min_p2)cout<<'A';
            else cout<<'B';
        }
        for(int i=m2+1;i<=n2;i++)   
            cout<<'A';
    }
    cout<<endl;
}
signed main(){
    ios::sync_with_stdio(false),cin.tie(0);
    int T;
    cin>>T;
    while(T--)Solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3712kb

input:

1
3 4
  +---+       +---+
 /     \     /     \
+       +---+       +---+
 \           \     /     \
  +   +   S   +---+   T   +
 /     \     /           /
+       +---+       +   +
 \           \     /     \
  +---+       +---+       +
 /                       /
+       +---+       +   +
 \         ...

output:

0 AABB

result:

wrong answer 1st lines differ - expected: '7', found: '0 AABB'