結果
問題 |
No.1020 Reverse
|
ユーザー |
![]() |
提出日時 | 2020-04-10 21:26:10 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 884 bytes |
コンパイル時間 | 1,096 ms |
コンパイル使用メモリ | 107,904 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-15 18:56:04 |
合計ジャッジ時間 | 1,842 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 15 |
ソースコード
#include <iostream> #include <vector> #include <map> #include <set> #include <unordered_set> #include <unordered_map> #include <stack> #include <queue> #include <algorithm> #include <cassert> #include <random> #include <iomanip> #include <bitset> #define FOR(i, n, m) for(ll i = n; i < (int)m; i++) #define REP(i, n) FOR(i, 0, n) #define ALL(v) v.begin(), v.end() #define pb push_back using namespace std; using ll = long long; using P = pair<ll, ll>; constexpr ll inf = 1000000000; constexpr ll mod = 998244353; constexpr long double eps = 1e-9; int main() { cin.tie(0); ios::sync_with_stdio(false); int n, k; cin >> n >> k; string s; cin >> s; string ans = s.substr(k - 1, n - k + 1); cout << ans << endl; string t = s.substr(0, k - 1); if((n - k + 1) % 2) reverse(t.begin(), t.end()); ans += t; cout << ans << endl; return 0; }