結果

問題 No.1379 Postponed
コンテスト
ユーザー 👑 Nachia
提出日時 2021-02-05 23:05:15
言語 C++17
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
TLE  
実行時間 -
コード長 623 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,156 ms
コンパイル使用メモリ 211,088 KB
実行使用メモリ 11,552 KB
最終ジャッジ日時 2026-06-17 14:55:59
合計ジャッジ時間 4,939 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other TLE * 1 -- * 63
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
using LL=long long;
using ULL=unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)

int N;
LL K;
int A[100];
int P[100];

bool same(){
  bool res=true;
  rep(i,N) if(A[i]!=P[i]) res=false;
  return res;
}
void op(){
  for(int i=P[0]; i>=1; i--) swap(P[0],P[i]);
}
void print(){
  rep(i,N) printf("%d ",P[i]); cout<<endl;
}

int main(){
  scanf("%d%lld",&N,&K);
  rep(i,N) scanf("%d",&A[i]);
  rep(i,N) P[i]=A[i];
  int t=0;
  do{ op(); t++; } while(!same());
  K%=t;
  while(K--) op();
  rep(i,N){ if(i) printf(" "); printf("%d",P[i]); } printf("\n");
  return 0;
}

0