結果
| 問題 | No.3381 Palindrome Substrings (C++) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-08-14 17:30:52 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 595 bytes |
| 記録 | |
| コンパイル時間 | 1,327 ms |
| コンパイル使用メモリ | 209,984 KB |
| 実行使用メモリ | 5,888 KB |
| スコア | 0 |
| 最終ジャッジ日時 | 2026-08-14 17:31:01 |
| 合計ジャッジ時間 | 8,960 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 22 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
string s;
int n;
cin >> n >> s;
long long countt = 0;
int len = s.length();
for (int i = 0; i < len; i++)
{
int l = i, r = i;
while (l >= 0 && r < len && s[l] == s[r])
{
countt++;
l--;
r++;
}
l = i, r = i + 1;
while (l >= 0 && r < len && s[l] == s[r])
{
countt++;
l--;
r++;
}
}
cout << countt;
return 0;
}