結果

問題 No.1801 Segment Game
ユーザー rogi52rogi52
提出日時 2022-10-22 04:44:40
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 37 ms / 2,000 ms
コード長 1,013 bytes
コンパイル時間 1,647 ms
コンパイル使用メモリ 199,484 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-14 02:58:47
合計ジャッジ時間 3,162 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 37 ms
4,376 KB
testcase_02 AC 36 ms
4,380 KB
testcase_03 AC 37 ms
4,380 KB
testcase_04 AC 37 ms
4,376 KB
testcase_05 AC 36 ms
4,380 KB
testcase_06 AC 36 ms
4,380 KB
testcase_07 AC 36 ms
4,376 KB
testcase_08 AC 36 ms
4,380 KB
testcase_09 AC 37 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using ld = long double;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    int T; cin >> T;
    rep(_,T) {
        ll H,W,D; cin >> H >> W >> D;
        enum { SECOND, FIRST };
        using i128 = __int128_t;
        cout << ([&H, &W, D]() {
            pair<int,int> p = {H % 2, W % 2};
            if(p == make_pair(0, 0)) {
                if(H <= D) return FIRST;
                if(W <= D) return FIRST;
                return SECOND;
            } else if(p == make_pair(1, 1)) {
                if(H * H + 1 * 1 <= D * D) return FIRST;
                if(W * W + 1 * 1 <= D * D) return FIRST;
                return SECOND;
            } else {
                if(p.first == 1) swap(H, W);
                if(H * H + 1 * 1 <= D * D) return FIRST;
                if(W <= D) return FIRST;
                return SECOND;
            }
        } () ? "N" : "S") << "\n";
    }
}
0