結果
問題 | No.1650 Moving Coins |
ユーザー |
![]() |
提出日時 | 2021-08-16 07:33:14 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 407 ms / 2,000 ms |
コード長 | 567 bytes |
コンパイル時間 | 777 ms |
コンパイル使用メモリ | 74,428 KB |
最終ジャッジ日時 | 2025-01-23 22:33:50 |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
#include <iostream>#include <vector>#include <algorithm>using namespace std;using ll=long long;const int MAXA=1000000;const int MAXN=200000;const int MAXM=200000;int a[MAXN], b[MAXN];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<n; i++){for(int j=0; j<a[i]-b[i]; j++){cout<<i+1<<"L"<<endl;}}for(int i=n-1; i>=0; i--){for(int j=0; j<b[i]-a[i]; j++){cout<<i+1<<"R"<<endl;}}return 0;}