結果
問題 | No.2454 Former < Latter |
ユーザー |
|
提出日時 | 2023-09-15 00:26:42 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 37 ms / 2,000 ms |
コード長 | 450 bytes |
コンパイル時間 | 3,743 ms |
コンパイル使用メモリ | 229,352 KB |
実行使用メモリ | 6,100 KB |
最終ジャッジ日時 | 2024-07-02 06:32:03 |
合計ジャッジ時間 | 4,862 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 23 |
ソースコード
#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;s += '`';auto za = atcoder::z_algorithm(s);ans = 0;for(int i = 1; i < n; i++){ans += za[i] >= i ? i < n - i : s[za[i]] < s[i + za[i]];}cout << ans << '\n';}}