| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 644370 | ymm | Palindromic Partitions (CEOI17_palindromic) | C++17 | 156 ms | 12852 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define Loop(x,l,r) for (ll x = (l); x < (r); ++x)
#define LoopR(x,l,r) for (ll x = (r)-1; x >= (l); --x)
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll , ll > pll;
using namespace std;
#define muladd(x, y, z) (((__int128)(x) * (y) + (z)) % mod)
int main()
{
cin.tie(0) -> sync_with_stdio(false);
int t;
cin >> t;
while (t--) {
string s;
cin >> s;
const ll mod = 1'333'333'333'333'333;
ll pow29 = 1;
int ans = 0;
ll h1=0, h2=0;
Loop (i,0,s.size()) {
char c1 = s[i]-'a'+1;
char c2 = s[s.size()-1-i]-'a'+1;
h1 = muladd(c1, pow29, h1);
h2 = muladd(h2, 29, c2);
//cout << h1 << ' ' << h2 << '\n';
pow29 = muladd(pow29, 29, 0);
if (h1 == h2) {
++ans;
h1 = 0;
h2 = 0;
pow29 = 1;
}
}
cout << ans << '\n';
}
}
컴파일 시 표준 에러 (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... | ||||
