提出 #45585309


ソースコード 拡げる

#pragma GCC optimize("Ofast,unroll-loops,inline")
#pragma GCC target("avx2,bmi,bmi2")
#include<bits/stdc++.h>
#define ll int
#define ld long double
#define pb push_back
#define prec fixed<<setprecision
#define endl '\n'
#define all(x) x.begin(),x.end()
#define pll pair<ll,ll>
#define open(name) if(fopen(name".inp", "r")){freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout);}
using namespace std;
const int maxN=2e5+69;
const int mod=1e9+7;
ll n,k,a[maxN];
void Enter(){
    string s;
    cin>>s;n=s.size();
    ll r=0;
    for(int i=0;i<n;i++)for(int j=0;j<=n-i;j++){
        string p=s.substr(i,j);
        string t=p;
        reverse(all(t));
        if(p==t)r=max(r,j);
    }
    cout<<r;
}
//amogus
signed main(){
    open("CONSTRUCT");
    cin.tie(nullptr);ios_base::sync_with_stdio(NULL);
    //ll t=1;cin>>t;while(t--)
    Enter();
}

提出情報

提出日時
問題 B - Longest Palindrome
ユーザ desb01
言語 C++ 20 (gcc 12.2)
得点 200
コード長 893 Byte
結果 AC
実行時間 2 ms
メモリ 3612 KiB

コンパイルエラー

Main.cpp: In function ‘int main()’:
Main.cpp:11:54: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 | #define open(name) if(fopen(name".inp", "r")){freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout);}
      |                                               ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:30:5: note: in expansion of macro ‘open’
   30 |     open("CONSTRUCT");
      |     ^~~~
Main.cpp:11:87: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 | #define open(name) if(fopen(name".inp", "r")){freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout);}
      |                                                                                ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:30:5: note: in expansion of macro ‘open’
   30 |     open("CONSTRUCT");
      |     ^~~~

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 3
AC × 23
セット名 テストケース
Sample sample00.txt, sample01.txt, sample02.txt
All sample00.txt, sample01.txt, sample02.txt, testcase00.txt, testcase01.txt, testcase02.txt, testcase03.txt, testcase04.txt, testcase05.txt, testcase06.txt, testcase07.txt, testcase08.txt, testcase09.txt, testcase10.txt, testcase11.txt, testcase12.txt, testcase13.txt, testcase14.txt, testcase15.txt, testcase16.txt, testcase17.txt, testcase18.txt, testcase19.txt
ケース名 結果 実行時間 メモリ
sample00.txt AC 1 ms 3460 KiB
sample01.txt AC 1 ms 3404 KiB
sample02.txt AC 1 ms 3460 KiB
testcase00.txt AC 1 ms 3428 KiB
testcase01.txt AC 1 ms 3480 KiB
testcase02.txt AC 1 ms 3476 KiB
testcase03.txt AC 1 ms 3424 KiB
testcase04.txt AC 1 ms 3440 KiB
testcase05.txt AC 1 ms 3476 KiB
testcase06.txt AC 1 ms 3612 KiB
testcase07.txt AC 2 ms 3464 KiB
testcase08.txt AC 1 ms 3420 KiB
testcase09.txt AC 1 ms 3472 KiB
testcase10.txt AC 1 ms 3392 KiB
testcase11.txt AC 2 ms 3428 KiB
testcase12.txt AC 1 ms 3528 KiB
testcase13.txt AC 1 ms 3536 KiB
testcase14.txt AC 1 ms 3388 KiB
testcase15.txt AC 1 ms 3396 KiB
testcase16.txt AC 1 ms 3388 KiB
testcase17.txt AC 1 ms 3424 KiB
testcase18.txt AC 1 ms 3424 KiB
testcase19.txt AC 2 ms 3424 KiB