Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- void dbg_out() { cerr << endl; }
- template<typename Head, typename... Tail>
- void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }
- #define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
- #define rng_init mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
- #define rng_seed(x) mt19937 rng(x)
- #define all(x) (x).begin(), (x).end()
- #define sz(x) (int) (x).size()
- // #define int long long
- const int MXN = 1e5 + 5, INF = 1e9 + 5;
- void solve() {
- int N;
- string S;
- cin >> N >> S;
- vector<char> A[N];
- int row = 0;
- bool flag = true;
- for (int i = 0; i < sz(S); i++) {
- A[row].push_back(S[i]);
- if (row == N - 1) flag = false;
- else if (row == 0) flag = true;
- if (flag) row += 1;
- else row -= 1;
- }
- for (int i = 0; i < N; i++) {
- for (int k = 0; k < sz(A[i]); k++) {
- if (k == 0) {
- for (int j = 0; j < i; j++)
- cout << " ";
- cout << A[i][k];
- continue;
- }
- if (i == 0 || i == N - 1) {
- for (int j = 0; j < max((N - i - 2) * 2 + 1, (i - 1) * 2 + 1); j++)
- cout << " ";
- cout << A[i][k];
- continue;
- }
- if (k & 1) {
- for (int j = 0; j < (N - i - 2) * 2 + 1; j++)
- cout << " ";
- } else {
- for (int j = 0; j < (i - 1) * 2 + 1; j++)
- cout << " ";
- }
- cout << A[i][k];
- }
- cout << "\n";
- }
- }
- signed main() {
- ios_base::sync_with_stdio(false);
- cin.tie(nullptr);
- int TC = 1;
- // cin >> TC;
- while (TC--) solve();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement