結果

問題 No.3099 夜の道路は気をつけて運転しなければならない
ユーザー PonnPonn
提出日時 2023-04-01 03:02:21
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 3,743 bytes
コンパイル時間 1,964 ms
コンパイル使用メモリ 202,628 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-24 12:13:06
合計ジャッジ時間 3,149 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

using i64 = int64_t;
using ui64 = uint64_t;

#ifdef LOCAL_DEBUG
    #define debug(X) std::cerr << X << " "
    #define debugV(X) std::cerr << #X << " = " << X << ", "
    #define debugVL(Y) std::cerr << #Y << " = " << Y << '\n'
    #define debugWL(Z) std::cerr << #Z << '\n'
    #define debugP() std::cerr << "Line:" << __LINE__ << '\n'
#else
    #define debug(X)
    #define debugV(X)
    #define debugVL(Y)
    #define debugWL(Z)
    #define debugP()
#endif

int main() {
    cout << setprecision(17);

    i64 T, iS, iD;
    cin >> T >> iS >> iD;
    double S = iS, D = iD;



    i64 itime = iD/iS;
    double dtime = D/S;
    bool isInt = false;
    i64 yoruTime = 0;
    if(iD % iS == 0){
        isInt = true;
    }
    if(isInt){
        debugWL(is int);
        yoruTime += (itime / 24)*12;
        itime %= 24;
        dtime = itime;
    }
    else{
        debugWL(is double);
        yoruTime += ((int)dtime / 24)*(12);
        dtime -= (int)(dtime / 24.0)*24;
    }
    double ans = yoruTime;
    double extraTime = 0.0;
    yoruTime = 0;
    debugV(itime);
    debugVL(dtime);

    if(T < 6){
        debugP();
        int cnt = 0;
        for(int rep = 0; rep < 2; rep++){
            while(T < 6){
                if(cnt >= (int)dtime){
                    extraTime = dtime - (cnt-1);
                    break;
                }
                cnt++;
                yoruTime++;
                T++;
            }
            while(T < 18){
                if(cnt >= (int)dtime){
                    break;
                }
                cnt++;
                T++;
            }
            while(T < 24){
                if(cnt >= (int)dtime){
                    extraTime = dtime - (cnt-1);
                    break;
                }
                cnt++;
                yoruTime++;
                T++;
            }
            T = 0; 
        }
    }
    else if(18 <= T){
        debugP();
        int cnt = 0;
        for(int rep = 0; rep < 2; rep++){
            while(T < 24){
                if(cnt >= (int)dtime){
                    extraTime = dtime - (cnt-1);
                    break;
                }
                cnt++;
                yoruTime++;
                T++;
            }
            T = 0;
            while(T < 6){
                if(cnt >= (int)dtime){
                    extraTime = dtime - (cnt-1);
                    break;
                }
                cnt++;
                yoruTime++;
                T++;
            }
            while(T < 18){
                if(cnt >= (int)dtime){
                    break;
                }
                cnt++;
                T++;
            }
        }
    }
    else{
        debugP();
        int cnt = 0;
        for(int rep = 0; rep < 2; rep++){
            while(T < 18){
                if(cnt >= (int)dtime){
                    break;
                }
                cnt++;
                T++;
            }
            while(T < 24){
                if(cnt >= (int)dtime){
                    extraTime = dtime - (cnt-1);
                    break;
                }
                cnt++;
                yoruTime++;
                T++;
            }
            T = 0;
            while(T < 6){
                if(cnt >= (int)dtime){
                    extraTime = dtime - (cnt-1);
                    break;
                }
                cnt++;
                yoruTime++;
                T++;
            }
        }
    }

    debugVL(yoruTime);
    if(isInt){
        debugP();
        ans += min(yoruTime, itime);
    }
    else{
        debugP();
        ans += min((double)yoruTime, dtime);
    }
    ans += extraTime;

    cout << ans << endl;
}
0