| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 172207 | nicolaalexandra | Palindromic Partitions (CEOI17_palindromic) | C++14 | 569 ms | 11188 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define DIM 1000010
#define MOD 1000000007
using namespace std;
int t,n,i,j;
char v[DIM];
vector <int> poz[30];
int main (){
//ifstream fin ("date.in");
//ofstream fout ("date.out");
cin>>t;
for (;t--;){
cin>>v+1;
n = strlen (v+1);
//for (i=1;i<=n;i++)
// hash[i] = (hash[i-1]*27 + v[i]-'a')%MOD;
int st = 1, dr = n, sol = 0;
int st_ant = 0, dr_ant = n+1, nr = 0;
long long prf = 0, suf = 0, p = 1;
while (st < dr){
prf = (prf*27 + v[st] - '0')%MOD;
suf = (suf + p*(v[dr] - '0'))%MOD;
p = (p*27)%MOD;
nr++;
if (prf == suf){
/// trb sa mai testez odata daca sunt egale
int ok = 1;
for (int i=st_ant+1,j=dr;i<=st,j<dr_ant;i++,j++){
if (v[i] != v[j]){
ok = 0;
break;
}}
if (ok){ /// sunt egale
sol += 2;
prf = 0, suf = 0, p = 1, nr = 0;
st_ant = st, dr_ant = dr;
}
}
st++, dr--;
}
if (st == dr || nr)
sol++;
cout<<sol<<"\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... | ||||
