QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#317490#7559. Bocchi the Rockqaqaqaq#WA 0ms3688kbC++141.1kb2024-01-29 02:22:252024-01-29 02:22:25

Judging History

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

  • [2024-01-29 02:22:25]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3688kb
  • [2024-01-29 02:22:25]
  • 提交

answer


#include <iostream>
#include <stdio.h>
using namespace std;
typedef long long ll;

ll a[200005][26];
string s;
int main(int argc, const char * argv[]) {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll t;
    cin>>t;
    while(t--){
        ll n;
        cin>>n;
        cin>>s;
        for(ll i=0;i<n;i++){
            for(ll j=0;j<26;j++) a[i][j]=0;
            a[i][s[i]-'a']++;
            if(i!=0){            
                for(ll j=0;j<26;j++){
                    a[i][j]+=a[i-1][j];
                }
            }
        }
//        for(ll i=0;i<n;i++){
//            for(ll j=0;j<26;j++){
//                cout<<a[i][j]<<" ";
//            }cout<<"\n";
//        }
        ll ans=0;
        for(ll i=0;i+1<n;i++){
            ll l1=0;
            for(ll j=0;j<26;j++){
                if(a[i][j]) l1++;
            }
            for(ll j=0;j<26;j++){
                if(a[i][j]!=a[n-1][j]) l1++;
            }
            ans=max(ans,l1);
        }
        cout<<ans<<"\n";
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
????

output:

0
0

result:

wrong answer 1st numbers differ - expected: '12', found: '0'