結果

問題 No.1979 [Cherry 4th Tune A] I min !
ユーザー 👑 colognecologne
提出日時 2022-05-05 20:25:19
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 3,182 bytes
コンパイル時間 423 ms
コンパイル使用メモリ 34,560 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-17 12:20:55
合計ジャッジ時間 1,201 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <cassert>
#include <cstdio>
#include <cinttypes>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/mman.h>
class StrictInput
{
    char *p;
    off_t cur = 0;
    off_t len = 0;

public:
    explicit StrictInput(int fd = 0)
    {
        struct stat st;
        fstat(fd, &st);
        p = (char *)mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
        len = st.st_size;
    }

    char readChar()
    {
        assert(cur != len);
        return p[cur++];
    }

    void unreadChar()
    {
        assert(cur != 0);
        --cur;
    }

    bool isEof() { return cur == len; }
    void readEof() { assert(isEof()); }
    void readSpace() { assert(readChar() == ' '); }
    void readEoln() { assert(readChar() == '\n'); }

    // reads uint64_t in range [from, to]
    uint64_t readU64(uint64_t from = 0, uint64_t to = UINT64_MAX)
    {
        uint64_t cur = 0;
        off_t read_cnt = 0;
        bool leading_zero = false;
        while (!isEof())
        {
            char p = readChar();
            if (!('0' <= p && p <= '9'))
            {
                unreadChar();
                break;
            }
            uint64_t v = p - '0';
            assert(cur <= UINT64_MAX / 10);
            cur *= 10;
            assert(cur <= UINT64_MAX - v);
            cur += v;
            if (read_cnt == 0 && v == 0)
                leading_zero = true;
            ++read_cnt;
        }
        if (cur == 0)
            assert(read_cnt == 1);
        else
            assert(!leading_zero);
        assert(from <= cur && cur <= to);
        return cur;
    }

    // reads int64_t in range [from, to]
    int64_t readI64(int64_t from = INT64_MIN, int64_t to = INT64_MAX)
    {
        uint64_t cur = 0;
        off_t read_cnt = 0;
        bool leading_zero = false;
        bool leading_minus = readChar() == '-';
        if (!leading_minus)
            unreadChar();
        while (!isEof())
        {
            char p = readChar();
            if (!('0' <= p && p <= '9'))
            {
                unreadChar();
                break;
            }
            uint64_t v = p - '0';
            assert(cur <= UINT64_MAX / 10);
            cur *= 10;
            assert(cur <= UINT64_MAX - v);
            cur += v;
            if (read_cnt == 0 && v == 0)
                leading_zero = true;
            ++read_cnt;
        }
        if (cur == 0)
            assert(read_cnt == 1 && !leading_minus);
        else
            assert(!leading_zero);

        if (cur <= INT64_MAX)
        {
            int64_t ret = cur;
            if (leading_minus)
                ret = -ret;
            assert(from <= ret && ret <= to);
            return ret;
        }
        else
        {
            assert(leading_minus && cur == uint64_t(INT64_MIN));
            assert(from == INT64_MIN);
            return INT64_MIN;
        }
    }
};
int main()
{
    StrictInput inf;
    int I = inf.readU64(0, 1'000'000'000);
    inf.readSpace();
    int J = inf.readU64(0, 1'000'000'000);
    inf.readSpace();
    int K = inf.readU64(0, 1'000'000'000);
    inf.readEoln();
    inf.readEof();
    if(I <= J && I <= K) puts("Yes");
    else puts("No");
}
0