| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 199669 | algorithm16 | Palindromic Partitions (CEOI17_palindromic) | C++14 | 557 ms | 27952 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
typedef long long int llint;
llint h[1000005],p=31337,pot[1000005];
llint get(int a,int b) {
llint ret=h[b];
if(a==0) return ret;
return ret-h[a-1]*pot[b-a+1];
}
int main()
{
int t;
cin >> t;
for(int i=0;i<t;i++) {
string s;
cin >> s;
h[0]=s[0]-'a';
pot[0]=1;
pot[1]=p;
for(int j=1;j<s.size();j++) {
h[j]=h[j-1]*p+s[j]-'a';
pot[j+1]=pot[j]*p;
}
int x1=0,x2=0,y=s.size()-1,cnt=0;
while(x2<y) {
if(get(x1,x2)==get(y-(x2-x1),y)) {
cnt+=2;
y-=(x2-x1)+1;
x1=x2+1;
x2+=1;
}
else x2+=1;
}
if(x2<=y) cnt+=1;
cout << cnt << "\n";
}
return 0;
}
컴파일 시 표준 에러 (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... | ||||
