結果

問題 No.1650 Moving Coins
ユーザー aut_jul_duraut_jul_dur
提出日時 2021-08-20 21:52:58
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 306 ms / 2,000 ms
コード長 1,254 bytes
コンパイル時間 4,391 ms
コンパイル使用メモリ 226,668 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2023-08-04 06:16:18
合計ジャッジ時間 14,307 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,384 KB
testcase_02 AC 2 ms
4,384 KB
testcase_03 AC 254 ms
4,380 KB
testcase_04 AC 188 ms
4,380 KB
testcase_05 AC 231 ms
4,380 KB
testcase_06 AC 255 ms
4,380 KB
testcase_07 AC 255 ms
4,384 KB
testcase_08 AC 271 ms
5,344 KB
testcase_09 AC 276 ms
5,468 KB
testcase_10 AC 287 ms
5,704 KB
testcase_11 AC 280 ms
5,612 KB
testcase_12 AC 279 ms
4,388 KB
testcase_13 AC 274 ms
4,612 KB
testcase_14 AC 279 ms
5,356 KB
testcase_15 AC 272 ms
4,380 KB
testcase_16 AC 285 ms
6,048 KB
testcase_17 AC 269 ms
5,956 KB
testcase_18 AC 284 ms
6,580 KB
testcase_19 AC 306 ms
7,768 KB
testcase_20 AC 301 ms
7,844 KB
testcase_21 AC 304 ms
7,724 KB
testcase_22 AC 304 ms
7,836 KB
testcase_23 AC 304 ms
7,840 KB
testcase_24 AC 264 ms
4,380 KB
testcase_25 AC 253 ms
4,380 KB
testcase_26 AC 43 ms
7,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const long long MOD = 1000000007;
const long long INF = 9*1e18;
using ll = long long;
using mint = modint1000000007;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
long double PI = 3.14159265358979;
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  ll N;
  cin>>N;
  vector<ll> A(N),B(N);
  vector<ll> sa(N);
  rep(i,N){
    cin>>A[i];
  }
  rep(i,N){
    cin>>B[i];
  }
  ll ans = 0;
  rep(i,N){
    ans += abs(A[i]-B[i]);
    sa[i] = B[i]-A[i];
  }
  cout << ans << endl;
  ll owatta = -1;
  rep(i,N){
    if(sa[i] > 0){
      continue;
    }
    else{
      for(int k = A[i];k>B[i];k--){
        cout << i+1 << " L" << endl;
      }
      for(int k = i-1;k>owatta;k--){
        for(int p = A[k];p<B[k];p++){
          cout << k+1 << " R" << endl;
        }
      }
      owatta = i;
    }
  }
  for(int i = N-1;i>owatta;i--){
    for(int k = A[i];k<B[i];k++){
      cout << i+1 << " R" << endl;
    }
  }
  return 0;
}
0