結果
| 問題 | No.3435 [Cherry 8th Tune *] 何回 LOVE SONG を書き換えただろうか? |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-01-23 22:44:05 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 194 ms / 3,000 ms |
| コード長 | 828 bytes |
| 記録 | |
| コンパイル時間 | 3,083 ms |
| コンパイル使用メモリ | 339,316 KB |
| 実行使用メモリ | 13,312 KB |
| 最終ジャッジ日時 | 2026-01-23 22:45:32 |
| 合計ジャッジ時間 | 14,120 ms |
|
ジャッジサーバーID (参考情報) |
judge6 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 48 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
string c;
cin >> c;
array<array<int, 26>, 26> T{};
for(int i = 0; i < c.size(); i++){
for(int j = 0; j < c.size(); j++){
cin >> T[c[i] - 'a'][c[j] - 'a'];
}
}
int h, w;
cin >> h >> w;
vector<array<int, 26>> a(w, array<int, 26>({}));
vector<string> b(h);
for(auto &&str : b){
cin >> str;
for(int j = 0; j < w; j++){
a[j][str[j] - 'a']++;
}
}
for(int i = 0; i < h; i++){
ll ans = 0;
for(int j = 0; j < w; j++){
for(int k = 0; k < 26; k++){
ans += (ll)(T[b[i][j] - 'a'][k]) * a[j][k];
}
}
cout << ans << '\n';
}
}