結果
| 問題 | No.2020 Sum of Common Prefix Length |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-04-17 20:50:27 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 659 bytes |
| 記録 | |
| コンパイル時間 | 2,910 ms |
| コンパイル使用メモリ | 275,736 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-25 18:42:51 |
| 合計ジャッジ時間 | 7,518 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 TLE * 1 -- * 30 |
ソースコード
#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
#define emb emplace_back
using ll = long long;
int main(){
cin.tie(0);ios::sync_with_stdio(false);
int N;cin >> N;
vector<string> S(N);
for(string &s:S) cin >> s;
int Q;cin >> Q;
for(int i=0;i<Q;i++){
int t;cin >> t;
if(t == 1){
int x;char c;cin >> x >> c;x--;
S[x] += c;
}
else{
int x;cin >> x;x--;
ll ans = 0;
for(int i=0;i<N;i++){
for(int j=0;j<min(S[x].size(),S[i].size());j++){
if(S[x][j] == S[i][j]) ans++;
else break;
}
}
cout << ans << "\n";
}
}
}