제출 #1349418

#제출 시각아이디문제언어결과실행 시간메모리
1349418dodjingTrains (BOI24_trains)C++20
컴파일 에러
0 ms0 KiB
#include <iostream>
#include <vector>
#include <numeric>
#include <unordered_map>
#include <cstdint>

#define ll long long

using namespace std;

ll mod = 1000000007;

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM =
                chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

int main() {
    int n; cin >> n;
    vector <ll> d(n + 1);
    vector <ll> x(n + 1);
    for (int i = 1; i <= n; i++) {
        cin >> d[i] >> x[i];
    }
    vector <ll> dp(n + 1, 0);
    dp[1] = 1;
    ll ttt;
    vector<unordered_map<ll, ll, custom_hash>> m(n + 1);
    for (int i = 1; i <= n; i++) {
        for (auto j : m[i]) {
            dp[i] += j.second;
            dp[i] %= mod;
            if (i + j.first <= n && j.second != 0) {
                if (m[i + j.first].count(j.first)) {
                    m[i + j.first][j.first] += j.second;
                    m[i + j.first][j.first] %= mod;
                } else {
                    m[i + j.first][j.first] = j.second;
                    m[i + j.first][j.first] %= mod;
                }
            }
        }
        if (d[i] != 0) {
            if (i + d[i] <= n) {
                if (m[i + d[i]].count(d[i])) {
                    m[i + d[i]][d[i]] += dp[i];
                    m[i + d[i]][d[i]] %= mod;
                } else {
                    m[i + d[i]][d[i]] = dp[i];
                    m[i + d[i]][d[i]] %= mod;
                }
            }
            ttt = i + d[i] * (x[i] + 1);
            if (ttt <= n) {
                if (m[ttt].count(d[i])) {
                    m[ttt][d[i]] += -dp[i] + mod;
                    m[ttt][d[i]] %= mod;
                } else {
                    m[ttt][d[i]] = -dp[i] + mod;
                    m[ttt][d[i]] %= mod;
                }
            }
        }
    }
    ll ans = 0;
    for (int i = 1; i <= n; i++) {
        ans += dp[i];
        ans %= mod;
    }
    cout << ans;
    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In member function 'size_t custom_hash::operator()(uint64_t) const':
Main.cpp:22:17: error: 'chrono' has not been declared
   22 |                 chrono::steady_clock::now().time_since_epoch().count();
      |                 ^~~~~~