# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1134773 | vyaduct | Palindromic Partitions (CEOI17_palindromic) | C++20 | 10095 ms | 128892 KiB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void setIo(string in="", string out=""){
if (!in.empty() && !out.empty()){
freopen(in.c_str(), "r", stdin);
freopen(out.c_str(), "w", stdout);
}
ios::sync_with_stdio(false);
cin.tie(0);
}
#define all(c) (c).begin(), (c).end()
#define sz(c) (int)(c).size()
#define vt vector
#define pb push_back
#define F first
#define S second
string s; int ans;
void search(int i, int j){
if (j - i < 0) return;
string a="", b="";
while(i < j){
a += s[i], b = s[j] + b;
if (a == b) {
ans+=2;
search(i+1, j-1);
return;
} else {
i++; j--;
}
}
ans++;
return;
}
void solve(){
cin>>s;
ans = 0;
search(0, sz(s)-1);
cout << ans << "\n";
}
int main() {
setIo();
// setIo("input.txt", "output.txt");
int tt; cin>>tt; while(tt--) solve();
// solve();
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... |