結果
| 問題 | No.273 回文分解 |
| コンテスト | |
| ユーザー |
ramia777
|
| 提出日時 | 2022-06-15 11:56:44 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,545 bytes |
| 記録 | |
| コンパイル時間 | 1,014 ms |
| コンパイル使用メモリ | 98,076 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-03 22:30:22 |
| 合計ジャッジ時間 | 1,968 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 |
ソースコード
// yukicodr
// No.273
//二次元可変配列
//vector <vector <int>> mass;
//vector <vector <int>> memo;
//vector <int> memo;
//#include "stdafx.h"
#include <iostream>
#include <vector>
#include <list>//list
#include <queue> //queue
#include <set> //連想コンテナ(要素が自動でソートされる)、要素1つ(Key)、keyの重複ない、O(logN)
#include <map> //連想コンテナ(要素が自動でソートされる)、要素2つ(Key,data)、keyの重複ない、dataは重複あり、O(logN)
#include <unordered_set> //hash、O(1)
#include <unordered_map> //hash、O(1)
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <string>
#include <climits>
//#include <bits/stdc++.h>
using namespace std;
#define FOR(x,to) for(x=0;x<to;x++)
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define FMAX(a,b) ((a)>(b)?(a):(b))
#define FMIN(a,b) ((a)<(b)?(a):(b))
#define FCEIL(a,b) ((a)+(b)-1)/(b)
typedef unsigned long long ULL;
typedef signed long long SLL;
queue<int> _queue;
string S;
int main()
{
cin >> S;
int limit = S.size();
unsigned int max = 0;
for (int L = 0; L < S.size(); L++)
{
for (int R = 0; R <= S.size(); R++)
{
string _S = S.substr(L,R);
string tmp_r = _S;
reverse(tmp_r.begin(), tmp_r.end());
if (_S == tmp_r)
{
int b = tmp_r.size();
if (max < b && b < limit)
max = b;
//cout << _S << ",size=" << _S.size() << ",max = " << max << endl;
}
}
}
cout << max << endl;
return 0;
}
ramia777