結果

問題 No.290 1010
ユーザー kimiyuki
提出日時 2016-06-07 18:22:54
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 23 ms / 5,000 ms
コード長 771 bytes
コンパイル時間 720 ms
コンパイル使用メモリ 85,292 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-11 01:03:06
合計ジャッジ時間 1,621 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <array>
#include <set>
#include <map>
#include <queue>
#include <tuple>
#include <unordered_set>
#include <unordered_map>
#include <functional>
#include <cstdio>
#include <cassert>
#define repeat(i,n) for (int i = 0; (i) < (n); ++(i))
#define repeat_from(i,m,n) for (int i = (m); (i) < (n); ++(i))
using namespace std;
int main() {
    int n; cin >> n;
    string s; cin >> s;
    repeat (i,n) {
        repeat_from (j,i,n) {
            int l = j-i+1;
            if (j + l < n) {
                if (s.substr(i, l) == s.substr(j+1, l)) {
                    cout << "YES" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "NO" << endl;
    return 0;
}
0