結果
| 問題 |
No.1020 Reverse
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-19 23:40:20 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 516 bytes |
| コンパイル時間 | 591 ms |
| コンパイル使用メモリ | 71,192 KB |
| 実行使用メモリ | 13,632 KB |
| 最終ジャッジ日時 | 2024-10-06 08:11:42 |
| 合計ジャッジ時間 | 5,170 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 RE * 2 |
| other | AC * 3 RE * 4 TLE * 1 -- * 7 |
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
using namespace std;
int main()
{
int N,K;
cin >> N;
cin >> K;
string S;
cin >> S;
std::vector<int> v(S.length());
iota(v.begin(), v.end(), 0);
for (int i = 1; i <= N - K + 1; ++i)
{
int m = i - 1;
int n = i + K - 2;
while (m != n || m < n)
{
int c = v[m];
v[m] = v[n];
v[n] = c;
++m;
--n;
}
}
string R;
for (auto itr = v.begin(); itr != v.end(); ++itr)
R += S[*itr];
cout << R << endl;
return 0;
}