結果
| 問題 | 
                            No.2454 Former < Latter
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2023-09-15 00:21:38 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 450 bytes | 
| コンパイル時間 | 3,708 ms | 
| コンパイル使用メモリ | 228,812 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-07-02 06:28:51 | 
| 合計ジャッジ時間 | 5,621 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 12 WA * 11 | 
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int T, n, ans;
    cin >> T;
    while(T--){
        string s;
        cin >> n >> s;
        auto za = atcoder::z_algorithm(s + "`");
        ans = 0;
        for(int i = 1; i < n; i++){
            ans += za[i] >= i ? i < min(za[i], n - i) : s[za[i]] < s[i + za[i]];
        }
        cout << ans << '\n';
    }
}