結果
| 問題 | 
                            No.1020 Reverse
                             | 
                    
| コンテスト | |
| ユーザー | 
                             CELICA
                         | 
                    
| 提出日時 | 2020-07-01 18:07:04 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 4 ms / 2,000 ms | 
| コード長 | 421 bytes | 
| コンパイル時間 | 1,863 ms | 
| コンパイル使用メモリ | 167,628 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-09-14 02:26:28 | 
| 合計ジャッジ時間 | 2,371 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 15 | 
ソースコード
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
char c[200001];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, k;
    scanf("%d%d", &n, &k);
    scanf("%s", c);
    string s{ c };
    string res = s.substr(k - 1) + s.substr(0, k - 1);
    if (!((n + k) & 1))
        reverse(res.begin() + n - k + 1, res.end());
    printf("%s\n", res.c_str());
    return 0;
}
            
            
            
        
            
CELICA