結果

問題 No.1860 Magnets
ユーザー BattleCatsBattleCats
提出日時 2022-03-04 21:28:52
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 1,040 bytes
コンパイル時間 1,396 ms
コンパイル使用メモリ 164,656 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-25 23:56:57
合計ジャッジ時間 2,738 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 3 ms
4,380 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define int long long
#define rep(i,a,b) for(int i = a; i < b; i++)
#define rerep(i,j,a,b) rep(i,a,b-1) rep(j,i+1,b)
#define fore(i,a) for(auto &i : a)
#define all(x) (x).begin(),(x).end()
#define fix(i) fixed << setprecision(i)
#define next_per(s) next_permutation(all(s))

using namespace std;

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; }

using pii = pair<int, int>;
using pque = priority_queue<int>;

void main_(); signed main() { main_(); return 0; }

/*------------------------------------------------------------------------------*/


const int INF = LLONG_MAX/2;
const int MOD = 1000000007;


/*------------------------------------------------------------------------------*/





void main_() {
  int A,B; cin >> A >> B;
  
  if(A > B) swap(A, B);
  
  int Ans;
  if(A+1 >= B) Ans = A+B;
  else {
    B -= (A+1);
    Ans = A+A+1+B*2;
  }
  
  printf("%lld\n", Ans);
}
0