結果
問題 | No.3036 Nauclhlt型文字列 |
ユーザー |
|
提出日時 | 2025-02-28 21:25:00 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 6,680 bytes |
コンパイル時間 | 1,873 ms |
コンパイル使用メモリ | 178,684 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2025-02-28 21:25:05 |
合計ジャッジ時間 | 2,379 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 15 |
ソースコード
#if __has_include("all.h")#include "all.h"#else#include <iostream>#include <algorithm>#include <cassert>#include <cmath>#include <cstdint>#include <set>#include <unordered_set>#include <map>#include <vector>#include <string>#include <deque>#include <queue>#include <iomanip>#include <ranges>#include <concepts>#include <numeric>#include <random>#include <atcoder/modint>#include <atcoder/segtree>#include <atcoder/dsu>#endifusing namespace std;using ll = long long;using pall = pair<ll, ll>;template<class T> using vec = vector<T>;template<class T> using veve = vec<vec<T>>;using vell = vec<ll>;using vebo = basic_string<bool>;using vevell = veve<ll>;template<class T> using uset = unordered_set<T>;template<class T> using mset = multiset<T>;template<class T> using priority_queue_ascend = priority_queue<T, vec<T>, greater<T>>;static const ll inf = numeric_limits<ll>::max();static const string sp = " ";static const string lf = "\n";static const auto &npos = string::npos;static const vec<pall> grid_move4 = {{0, 1},{-1, 0},{0, -1},{1, 0}};static const vec<pall> grid_move8 = [] {auto ret = grid_move4;ret.insert(ret.end(), {{-1, 1},{-1, -1},{1, -1},{1, 1}});return ret;}();static constexpr ll MOD = 998244353;// static constexpr ll MOD = 1e9 + 7;#define cont continue#define br breakstatic auto &ciN = cin;static auto &icn = cin;static auto &icN = cin;static constexpr bool ture = true;using itn = int;using namespace atcoder;using mint = static_modint<MOD>;#define times(N) static_assert(is_integral_v<decltype((N) + 0)>, "times(): N must be integral"); for([[maybe_unused]] const auto _N = (N);[[maybe_unused]] const decltype(_N + 0) _c: views::iota(decltype(_N + 0)(0), _N))// #define times(N) static_assert(is_integral_v<decltype((N) + 0)>, "times(): N must be integral"); for(bool _ = true;_;) for([[maybe_unused]] constauto _N = (N);_;_ = false) for(decltype(_N + 0) _c = 0;_c != _N;_c += 1)template<int M>istream &operator>>(istream &in, static_modint<M> &i) {intmax_t tmp;in >> tmp;i = tmp;return in;}template<int M>ostream &operator<<(ostream &out, const static_modint<M> &i) {return out << i.val();}template<class T, class U>istream &operator>>(istream &in, pair<T, U> &p) {return in >> p.first >> p.second;}template<class T, class U>ostream &operator<<(ostream &out, const pair<T, U> &p) {return out << p.first << sp << p.second;}template<class T>istream &operator>>(istream &in, vec<T> &v) {for(auto &e: v) {in >> e;}return in;}namespace myinput {template<class... Args>istream &in(Args&... vecs) {static_assert(sizeof...(vecs) != 0, "myfunc::in(): At least one vector must be provided");set<size_t> sizes = { vecs.size()... };if(sizes.size() > 1) {throw invalid_argument("myfunc::in(): All vectors must have the same size");}times(*sizes.begin()) {((cin >> vecs[_c]), ...);}return cin;}}using myinput::in;void out(const ranges::range auto &v, const string &delim, ostream &out = cout) {for(const auto &e: v) {out << e << delim;}}[[nodiscard]] constexpr const string &yesno(const bool cond, const string &yes="Yes", const string &no="No") noexcept {if(cond) return yes;return no;}/*random_device seed;mt19937_64 mt(seed());// [mi, ma)[[nodiscard]] uint64_t randint(const uint64_t mi, const uint64_t ma) noexcept {if(mi > ma) return randint(ma, mi);if(mi == ma) return mi;const uint64_t w = ma - mi;uint64_t r = mt();while(mt.max() - mt.max() % w <= r) r = mt();return r % w + mi;}*/template<class T, class U>requires common_with<T, U>[[nodiscard]] constexpr auto min(T &&a, U &&b) noexcept {return std::min<common_type_t<T, U>>(std::forward<T>(a), std::forward<U>(b));}template<class T, class U>requires common_with<T, U>[[nodiscard]] constexpr auto max(T &&a, U &&b) noexcept {return std::max<common_type_t<T, U>>(std::forward<T>(a), std::forward<U>(b));}template<class T>[[nodiscard]] const T &min(const vec<T> &v) {return *ranges::min_element(v);}template<class T>[[nodiscard]] const T &max(const vec<T> &v) {return *ranges::max_element(v);}[[nodiscard]] constexpr ll powll(ll a, ll b, const ll m = inf) {if(b < 0) [[unlikely]] throw invalid_argument("powll(): exponent less than zero");if(m < 1) [[unlikely]] throw invalid_argument("powll(): modulo less than one");a %= m;ll ret = 1;while(b) {if(b % 2) ret *= a, ret %= m;a *= a, a %= m;b /= 2;}return ret;}template<class T, class U>requires assignable_from<T&, U> && totally_ordered_with<T, U>bool mini(T &var, const U &val) noexcept {const bool cmp = var > val;if(cmp) var = val;return cmp;}template<class T, class U>requires assignable_from<T&, U> && totally_ordered_with<T, U>bool maxi(T &var, const U &val) noexcept {const bool cmp = var < val;if(cmp) var = val;return cmp;}namespace myclass {class grid_base {public:grid_base(const ll h, const ll w) noexcept : height(h), width(w) {}[[nodiscard]] ll operator()(const ll i, const ll j) const noexcept {if(!isvalid(i, j)) return -1;return i * width + j;}[[nodiscard]] ll operator()(const pall &p) const noexcept {return (*this)(p.first, p.second);}protected:bool isvalid(const ll i, const ll j) const noexcept {return 0 <= i && 0 <= j && i < height && j < width;}const ll height, width;};}using grid_lite = myclass::grid_base;class grid_seen : public myclass::grid_base {public:grid_seen(const ll h, const ll w) : grid_base(h, w) {visited = vebo(h * w, false);}[[nodiscard]] bool &seen(const ll i, const ll j) & {if(!isvalid(i, j)) throw out_of_range("grid::seen(): out of range");return visited[i * width + j];}[[nodiscard]] bool &seen(const pall &p) & {return seen(p.first, p.second);}private:vebo visited;};template<convertible_to<ll> auto upper, class... Args>[[nodiscard]] constexpr auto grid(Args... args) {if constexpr (ll(upper) < ll(1e7)) {return grid_seen(forward<Args>(args)...);} else {return grid_lite(forward<Args>(args)...);}}template<class T>auto erase_single(multiset<T> &mset, const T &v) {const auto it = mset.find(v);if(it == mset.end()) throw invalid_argument("erase_single(): why v not in mset!?!?");return mset.erase(it);}void solve();int main(void) {cin.tie(nullptr);ios::sync_with_stdio(false);solve();return 0;}void solve() {ll n;cin >> n;string s;cin >> s;cout << yesno(n % 2 == 0) << lf;if(n % 2 == 1) {return;}string p, q;times(n) {(_c % 2 ? q : p) += s[_c];}cout << p << sp << q << lf;}