結果
| 問題 |
No.1650 Moving Coins
|
| コンテスト | |
| ユーザー |
reg7777
|
| 提出日時 | 2021-08-20 21:53:04 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 62 ms / 2,000 ms |
| コード長 | 891 bytes |
| コンパイル時間 | 1,715 ms |
| コンパイル使用メモリ | 171,972 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2024-10-14 03:24:56 |
| 合計ジャッジ時間 | 6,407 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;
#define INF LONG_MAX
#define MOD1 1000000007
#define MOD2 998244353
#define MOD MOD1
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define endl "\n"
#define int ll
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);
int N;
cin>>N;
vector<int>A(N),B(N);
for(int i=0;i<N;i++)cin>>A[i],A[i]--;
for(int i=0;i<N;i++)cin>>B[i],B[i]--;
sort(rng(A));
sort(rng(B));
int s=0;
for(int i=0;i<N;i++)s+=abs(A[i]-B[i]);
cout<<s<<endl;
for(int i=N-1;i>=0;i--){
if(A[i]<B[i]){
for(int j=A[i];j<B[i];j++)cout<<i+1<<" R"<<endl;
}
}
for(int i=0;i<N;i++){
if(B[i]<A[i]){
for(int j=A[i];j>B[i];j--)cout<<i+1<<" L"<<endl;
}
}
return 0;
}
reg7777