結果

問題 No.98 円を描こう
コンテスト
ユーザー primesosu
提出日時 2026-11-18 01:12:48
言語 C++23(gcc16)
(gcc 16.2.0 + boost 1.92.0 + ACL)
コンパイル:
g++-16 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc16.so -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 1,618 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,940 ms
コンパイル使用メモリ 355,796 KB
実行使用メモリ 9,828 KB
最終ジャッジ日時 2026-11-18 01:12:53
合計ジャッジ時間 4,194 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge5_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 5 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

// https://github.com/primesosu91/library
#include <bits/stdc++.h>
#include <cassert>
using namespace std;
using ll = long long;
using ld = long double;
using pll = pair<ll, ll>;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define rrep(i, n) for (ll i = n - 1; i >= (ll)(0); i--)
#define rrep1(i, n) for (ll i = n; i >= (ll)(1); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define el '\n'
#define sp ' '
#define YN(text) cout << (text ? "Yes" : "No") << el;
#define ANS cout << ans << el;
#define pqmax(...) priority_queue<__VA_ARGS__>
#define pqmin(...) priority_queue<__VA_ARGS__, vector<__VA_ARGS__>, greater<__VA_ARGS__>>
const ll inf = 4e18;
const ll MOD = 998244353;
const ll dx[4] = {1, 0, -1, 0};
const ll dy[4] = {0, 1, 0, -1};
const ll DX[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll DY[8] = {0, 1, 1, 1, 0, -1, -1, -1};
template <class T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template <class T> bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }

void solve() {
    ll x, y;
    cin >> x >> y;
    if (x==0 && y==0) {
        cout << 1 << el;
        return;
    }
    for (int r = 1; r <= 10010; r ++) {
        if (r*r > x*x + y*y) {
            cout << 2*r << el;
            return;
        } else if (4*r*r+4*r+1 > 4*x*x + 4*y*y) {
            cout << 2*r+1 << el;
            return;
        }
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll t = 1;
    // cin >> t;
    rep(i, t) solve();
}
0