답안 #764376

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
764376 2023-06-23T11:13:49 Z birthdaycake Palindromic Partitions (CEOI17_palindromic) C++17
60 / 100
10000 ms 7224 KB
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
 
#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif
 
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
 
 
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <fstream>
#define endl '\n'
#define int long long
#define mod 1000000007
using namespace std;
signed main(){
    int t; cin >> t;
    while(t--){
        string s; cin >> s;
        int n = s.size();
        int l = 0, r = n - 1, cnt = 0;
        deque<char>x,y;
        while(l <= r){
            if(x.empty() and l == r){
                cnt++;
                break;
            }
            x.push_back(s[l]);
            y.push_front(s[r]);
            if(x == y){
                cnt+=2;
                x.clear();
                y.clear();
            }
            l++;
            r--;
        }
        if(x.size() or y.size()) cnt++;
        cout << cnt << endl;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 296 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 296 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 296 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 292 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 296 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 296 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 292 KB Output is correct
10 Correct 3 ms 428 KB Output is correct
11 Correct 2 ms 312 KB Output is correct
12 Correct 2 ms 340 KB Output is correct
13 Correct 4 ms 312 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 296 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 296 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 292 KB Output is correct
10 Correct 3 ms 428 KB Output is correct
11 Correct 2 ms 312 KB Output is correct
12 Correct 2 ms 340 KB Output is correct
13 Correct 4 ms 312 KB Output is correct
14 Execution timed out 10008 ms 7224 KB Time limit exceeded
15 Halted 0 ms 0 KB -