Submission #45585309


Source Code Expand

#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();
}

Submission Info

Submission Time
Task B - Longest Palindrome
User desb01
Language C++ 20 (gcc 12.2)
Score 200
Code Size 893 Byte
Status AC
Exec Time 2 ms
Memory 3612 KiB

Compile Error

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");
      |     ^~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 23
Set Name Test Cases
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
Case Name Status Exec Time Memory
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