# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1221923 | Nika533 | Palindromic Partitions (CEOI17_palindromic) | C++20 | 10089 ms | 3120 KiB |
#pragma GCC diagnostic warning "-std=c++11"
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define f first
#define s second
#define MOD 1000000007
#define flush fflush(stdout)
#define all(x) (x).begin(),(x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define pii pair<int,int>
using namespace std;
int n,m,T,k;
void test_case() {
string s; cin>>s; n=s.size();
int last=-1,cnt=0;
for (int i=0; i<n/2; i++) {
int l=last+1,r=i;
int l1=n-r-1,r1=n-l+1;
bool check=1;
for (int j=l; j<=r; j++) {
if (s[j]!=s[l1+(j-l)]) check=0;
}
if (check) {
last=i; cnt+=2;
}
}
if (n%2==0 && last==n/2-1) cout<<cnt<<endl;
else cout<<cnt+1<<endl;
}
main () {
ios :: sync_with_stdio(0);
cin.tie(0); cout.tie(0);
T=1; cin>>T;
while (T--) test_case();
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |