結果
| 問題 |
No.1379 Postponed
|
| コンテスト | |
| ユーザー |
Nachia
|
| 提出日時 | 2021-02-05 23:05:15 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 623 bytes |
| コンパイル時間 | 2,286 ms |
| コンパイル使用メモリ | 191,784 KB |
| 最終ジャッジ日時 | 2025-01-18 12:57:36 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 33 TLE * 31 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:26:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
26 | scanf("%d%lld",&N,&K);
| ~~~~~^~~~~~~~~~~~~~~~
main.cpp:27:17: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
27 | rep(i,N) scanf("%d",&A[i]);
| ~~~~~^~~~~~~~~~~~
ソースコード
#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;
}
Nachia