結果
問題 |
No.1650 Moving Coins
|
ユーザー |
![]() |
提出日時 | 2021-07-17 18:09:38 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 783 bytes |
コンパイル時間 | 688 ms |
コンパイル使用メモリ | 76,636 KB |
最終ジャッジ日時 | 2025-01-23 03:02:52 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 8 TLE * 16 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <set> using namespace std; using ll=long long; const int MAXA=1000000; const int MAXN=200000; const int MAXM=200000; int a[MAXN+1], b[MAXN+1]; int main() { int n; cin>>n; for(int i=0; i<n; i++) cin>>a[i]; for(int i=0; i<n; i++) cin>>b[i]; int m=0; for(int i=0; i<n; i++) m+=abs(a[i]-b[i]); cout<<m<<endl; for(int i=0; i<m; i++){ for(int j=0; j<n; j++){ if(a[j]<b[j] && (j==n-1 || a[j]+1!=a[j+1])){ printf("%d R\n", j+1); a[j]++; break; } if(a[j]>b[j] && (j==0 || a[j]-1!=a[j-1])){ printf("%d L\n", j+1); a[j]--; break; } } } return 0; }