# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
936051 | 2024-03-01T05:05:45 Z | Aiperiii | Palindromic Partitions (CEOI17_palindromic) | C++14 | 10000 ms | 23952 KB |
#include <bits/stdc++.h> #define int long long #define ff first #define ss second #define pb push_back #define all(x) x.begin(),x.end() using namespace std; signed main(){ int t; cin>>t; while(t--){ vector <int> mp[130]; string s; cin>>s; string t=s; reverse(all(t)); int ans=0; for(int i=0;i<s.size();i++){ mp[(int)s[i]].pb(i); } for(int i=0;i<t.size();i++){ if(s[i]==t[i])ans++; else{ auto pos=upper_bound(all(mp[(int)t[i]]),i)-mp[(int)t[i]].begin(); for(int j=pos;j<mp[(int)t[i]].size();j++){ bool ok=1; int x=0; for(int k=i;k<=mp[(int)t[i]][j];k++){ if(t[k]!=s[mp[(int)t[i]][j]-x]){ ok=0;break; } x++; } if(ok){ ans++; i=mp[(int)t[i]][j]; break; } } } } cout<<ans<<"\n"; } } /* 4 bonobo deleted racecar racecars */
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 432 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 432 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 344 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 432 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 344 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 11 ms | 780 KB | Output is correct |
11 | Correct | 6 ms | 604 KB | Output is correct |
12 | Correct | 3 ms | 716 KB | Output is correct |
13 | Correct | 4 ms | 612 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 432 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 344 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 11 ms | 780 KB | Output is correct |
11 | Correct | 6 ms | 604 KB | Output is correct |
12 | Correct | 3 ms | 716 KB | Output is correct |
13 | Correct | 4 ms | 612 KB | Output is correct |
14 | Execution timed out | 10005 ms | 23952 KB | Time limit exceeded |
15 | Halted | 0 ms | 0 KB | - |