为什么全WA了!
查看原帖
为什么全WA了!
1217203
Pengjiayi楼主2025/6/28 11:44

样例过了

#include<bits/stdc++.h>
using namespace std;
char c;
string s;
int t,n;
int main(){
    cin>>t;
    while(t--){
        cin>>n;
        bool f=0;
        string t="";
        while(n--){
            cin>>s;
            t+=s;
            for(int i=1;i<s.size();i++)if(s[i]<s[i-1]){f=1;break;}
        }
        // cout<<t<<endl;
        for(int i=1;i<t.size();i++){
            if(t[i]<t[i-1]){
                // cout<<t[i]<<" "<<t[i-1]<<endl;
                f=1;
                break;
            }
        }
        if(f)cout<<0<<endl;
        else cout<<1<<endl;
    }
}
2025/6/28 11:44
加载中...