結果

問題 No.2454 Former < Latter
ユーザー hourenhouren
提出日時 2023-09-01 22:39:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 887 bytes
コンパイル時間 2,359 ms
コンパイル使用メモリ 185,020 KB
実行使用メモリ 6,212 KB
最終ジャッジ日時 2023-09-01 22:39:38
合計ジャッジ時間 3,803 ms
ジャッジサーバーID
(参考情報)
judge13 / judge16
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 7 ms
5,940 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 4 ms
4,380 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 6 ms
4,760 KB
testcase_17 AC 44 ms
4,376 KB
testcase_18 WA -
testcase_19 AC 6 ms
5,916 KB
testcase_20 AC 8 ms
5,984 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/string>
using namespace atcoder;
using ll = long long;
using P = pair<ll,ll>;
#define fix(x) fixed << setprecision(x)
#define asc(x) x, vector<x>, greater<x>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define all(x) (x).begin(),(x).end()
template<class T>bool chmin(T&a, const T&b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool chmax(T&a, const T&b){if(a<b){a=b;return 1;}return 0;}
constexpr ll INFLL = (1LL << 62), MOD = 998244353;
constexpr int INF = (1 << 30);

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int t;
    cin >> t;
    while(t--){
        int cnt = 0, n;
        string s;
        cin >> n >> s;
        s += 'z'+1;
        auto x = z_algorithm(s);
        for(int i=1;i<n;i++) if(x[i]<i) cnt += (s[x[i]] < s[i+x[i]]);
        cout << cnt << '\n';
    }
    return 0;
}
0