結果

問題 No.2239 Friday
コンテスト
ユーザー GlinTFraulein
提出日時 2023-03-10 22:21:22
言語 C++17
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 2,000 ms
+ 740µs
コード長 642 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,931 ms
コンパイル使用メモリ 275,340 KB
実行使用メモリ 9,672 KB
最終ジャッジ日時 2026-10-15 14:02:09
合計ジャッジ時間 4,367 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#include <atcoder/all>
 
#define elif else if
#define ll long long
#define vll vector<long long>
#define vec vector
#define embk emplace_back
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep3(i, n, k) for (int i = k; i < n; i++)
#define all(a) a.begin(), a.end()
 
using namespace std;
using namespace atcoder;
const ll INF = 1LL << 60;
const ll mod = 998244353;

int main() {
  ll a, b; cin >> a >> b;
  if (a > b) swap(a, b);
  
  if (a*3 > b) {
    ll ans = (b-a) % 4;
    if (a % 2 == 1) ans = (ans+2) % 4;
    if (ans == 3) ans = 1;
    cout << ans << endl;
  }
  else cout << abs(b - 3*a) << endl;
  
}
0