답안 #398189

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
398189 2021-05-03T21:42:30 Z fun_day Palindromic Partitions (CEOI17_palindromic) C++14
60 / 100
10000 ms 6336 KB
#include <bits/stdc++.h>
using namespace std;
vector<char> reversed(vector<char>ss){
  reverse(ss.begin(),ss.end());
  return ss;  
}
void clear(queue<char> &q){
   std::queue<char> empty;
   std::swap( q, empty );
}
bool equal(string one , string two){
  unordered_map<string , bool>mp;
  mp[one] = 1;
  return mp[two];
}
int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int tt;
  cin >> tt;
  while(tt--){
    string ss ;
    cin >> ss;
    int n = ss.length();
    int ans = 1;
    deque<char>one ,two;
    for(int i = 0, r = n-1 ; i <n/2 ; i++,r--){
      one.push_back(ss[i]);
      two.push_front(ss[r]);
      if(one == two){
        one.clear(); two.clear();
        ans+=2;
        if(i+1==r)ans--;
      }
    } 
    cout << ans << '\n';
  }
  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 312 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 312 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 64 ms 420 KB Output is correct
11 Correct 9 ms 332 KB Output is correct
12 Correct 2 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 312 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 64 ms 420 KB Output is correct
11 Correct 9 ms 332 KB Output is correct
12 Correct 2 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Execution timed out 10017 ms 6336 KB Time limit exceeded
15 Halted 0 ms 0 KB -