結果

問題 No.290 1010
ユーザー Mayimg
提出日時 2018-12-05 14:43:18
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 622 bytes
コンパイル時間 1,480 ms
コンパイル使用メモリ 170,004 KB
実行使用メモリ 6,492 KB
最終ジャッジ日時 2024-07-19 00:02:07
合計ジャッジ時間 2,330 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);  
	int n;
	cin >> n;
	string s;
	cin >> s;
	string t = s;
	reverse(t.begin(), t.end());
	while(s.size() > 1) {
		string a, b;
		if(s.size() % 2 == 0) {
			a = s.substr(0, s.size() / 2);
			b = s.substr(s.size() / 2);
			if(a == b) {
				cout << "YES" << endl;
				return 0;
			}
			a = t.substr(0, t.size() / 2 - 1);
			b = t.substr(t.size() / 2);
			if(a == b) {
				cout << "YES" << endl;
				return 0;
			}
		}
		s.pop_back();
		t.pop_back();
	}
	cout << "NO" << endl;
	return 0;	
}
0