結果
| 問題 | No.3381 Palindrome Substrings (C++) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-08-14 17:24:04 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 596 bytes |
| 記録 | |
| コンパイル時間 | 1,335 ms |
| コンパイル使用メモリ | 210,936 KB |
| 実行使用メモリ | 5,888 KB |
| スコア | 0 |
| 最終ジャッジ日時 | 2026-08-14 17:24:13 |
| 合計ジャッジ時間 | 8,665 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 22 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef string str;
const ll mod = 1e9 + 7;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
str s;
ll n, countt = 0;
cin >> n >> s;
str p;
for (ll i = 0; i < s.size(); i++)
{
p = s[i];
countt++;
for (ll j = i + 1; j < s.size(); j++)
{
p += s[j];
str r = p;
reverse(r.begin(), r.end());
if (r == p) countt++;
}
}
cout << countt;
return 0;
}