답안 #669754

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
669754 2022-12-07T08:27:11 Z Forested Cryptography (NOI20_crypto) C++17
100 / 100
117 ms 9168 KB
#ifndef LOCAL
#define FAST_IO
#endif

// ============
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define OVERRIDE(a, b, c, d, ...) d
#define REP2(i, n) for (i32 i = 0; i < (i32) (n); ++i)
#define REP3(i, m, n) for (i32 i = (i32) (m); i < (i32) (n); ++i)
#define REP(...) OVERRIDE(__VA_ARGS__, REP3, REP2)(__VA_ARGS__)
#define PER(i, n) for (i32 i = (i32) (n) - 1; i >= 0; --i)
#define ALL(x) begin(x), end(x)

using namespace std;

using u32 = unsigned int;
using u64 = unsigned long long;
using u128 = __uint128_t;
using i32 = signed int;
using i64 = signed long long;
using i128 = __int128_t;
using f64 = double;
using f80 = long double;

template <typename T>
using Vec = vector<T>;

template <typename T>
bool chmin(T &x, const T &y) {
    if (x > y) {
        x = y;
        return true;
    }
    return false;
}
template <typename T>
bool chmax(T &x, const T &y) {
    if (x < y) {
        x = y;
        return true;
    }
    return false;
}

istream &operator>>(istream &is, i128 &x) {
    i64 v;
    is >> v;
    x = v;
    return is;
}
ostream &operator<<(ostream &os, i128 x) {
    os << (i64) x;
    return os;
}
istream &operator>>(istream &is, u128 &x) {
    u64 v;
    is >> v;
    x = v;
    return is;
}
ostream &operator<<(ostream &os, u128 x) {
    os << (u64) x;
    return os;
}

[[maybe_unused]] constexpr i32 INF = 1000000100;
[[maybe_unused]] constexpr i64 INF64 = 3000000000000000100;
struct SetUpIO {
    SetUpIO() {
#ifdef FAST_IO
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
#endif
        cout << fixed << setprecision(15);
    }
} set_up_io;
// ============

#ifdef DEBUGF
#else
#define DBG(x) (void) 0
#endif

// ============

#include <algorithm>
#include <vector>

template <typename T>
class CoordinateCompression {
    std::vector<T> data;

    int size_sum() {
        return 0;
    }

    template <typename... Tail>
    int size_sum(const std::vector<T> &head, const Tail &...tail) {
        return (int) head.size() + size_sum(tail...);
    }

    void push() {}

    template <typename... Tail>
    void push(const std::vector<T> &head, const Tail &...tail) {
        for (const T &ele : head) {
            data.emplace_back(ele);
        }
        push(tail...);
    }

    void compress() {}

    template <typename... Tail>
    void compress(std::vector<T> &head, Tail &...tail) {
        for (T &ele : head) {
            ele = (T) (std::lower_bound(data.begin(), data.end(), ele) - data.begin());
        }
        compress(tail...);
    }

public:
    template <typename... V>
    CoordinateCompression(V &...v) {
        data.reserve(size_sum(v...));
        push(v...);
        std::sort(data.begin(), data.end());
        data.erase(std::unique(data.begin(), data.end()), data.end());
        compress(v...);
    }

    const T &operator[](const T &ele) const {
        return data[ele];
    }

    int size() const {
        return data.size();
    }
    
    bool contains(const T &ele) const {
        auto it = std::lower_bound(data.begin(), data.end(), ele);
        return it != data.end() && *it == ele;
    }
    
    T cc(const T &ele) const {
        return (T) (std::lower_bound(data.begin(), data.end(), ele) - data.begin());
    }
};
// ============
// ============

#include <cassert>
#include <iostream>
#include <type_traits>

// ============

constexpr bool is_prime(unsigned n) {
    if (n == 0 || n == 1) {
        return false;
    }
    for (unsigned i = 2; i * i <= n; ++i) {
        if (n % i == 0) {
            return false;
        }
    }
    return true;
}

constexpr unsigned mod_pow(unsigned x, unsigned y, unsigned mod) {
    unsigned ret = 1, self = x;
    while (y != 0) {
        if (y & 1) {
            ret = (unsigned) ((unsigned long long) ret * self % mod);
        }
        self = (unsigned) ((unsigned long long) self * self % mod);
        y /= 2;
    }
    return ret;
}

template <unsigned mod>
constexpr unsigned primitive_root() {
    static_assert(is_prime(mod), "`mod` must be a prime number.");
    if (mod == 2) {
        return 1;
    }

    unsigned primes[32] = {};
    int it = 0;
    {
        unsigned m = mod - 1;
        for (unsigned i = 2; i * i <= m; ++i) {
            if (m % i == 0) {
                primes[it++] = i;
                while (m % i == 0) {
                    m /= i;
                }
            }
        }
        if (m != 1) {
            primes[it++] = m;
        }
    }
    for (unsigned i = 2; i < mod; ++i) {
        bool ok = true;
        for (int j = 0; j < it; ++j) {
            if (mod_pow(i, (mod - 1) / primes[j], mod) == 1) {
                ok = false;
                break;
            }
        }
        if (ok)
            return i;
    }
    return 0;
}

// y >= 1
template <typename T>
constexpr T safe_mod(T x, T y) {
    x %= y;
    if (x < 0) {
        x += y;
    }
    return x;
}

// y != 0
template <typename T>
constexpr T floor_div(T x, T y) {
    if (y < 0) {
        x *= -1;
        y *= -1;
    }
    if (x >= 0) {
        return x / y;
    } else {
        return -((-x + y - 1) / y);
    }
}

// y != 0
template <typename T>
constexpr T ceil_div(T x, T y) {
    if (y < 0) {
        x *= -1;
        y *= -1;
    }
    if (x >= 0) {
        return (x + y - 1) / y;
    } else {
        return -(-x / y);
    }
}
// ============

template <unsigned mod>
class ModInt {
    static_assert(mod != 0, "`mod` must not be equal to 0.");
    static_assert(
        mod < (1u << 31),
        "`mod` must be less than (1u << 31) = 2147483648.");

    unsigned val;

public:
    static constexpr unsigned get_mod() {
        return mod;
    }
    
    constexpr ModInt() : val(0) {}
    template <typename T, std::enable_if_t<std::is_signed_v<T>> * = nullptr>
    constexpr ModInt(T x) : val((unsigned) ((long long) x % (long long) mod + (x < 0 ? mod : 0))) {}
    template <typename T, std::enable_if_t<std::is_unsigned_v<T>> * = nullptr>
    constexpr ModInt(T x) : val((unsigned) (x % mod)) {}

    static constexpr ModInt raw(unsigned x) {
        ModInt<mod> ret;
        ret.val = x;
        return ret;
    }

    constexpr unsigned get_val() const {
        return val;
    }

    constexpr ModInt operator+() const {
        return *this;
    }
    constexpr ModInt operator-() const {
        return ModInt<mod>(0u) - *this;
    }

    constexpr ModInt &operator+=(const ModInt &rhs) {
        val += rhs.val;
        if (val >= mod)
            val -= mod;
        return *this;
    }
    constexpr ModInt &operator-=(const ModInt &rhs) {
        if (val < rhs.val)
            val += mod;
        val -= rhs.val;
        return *this;
    }
    constexpr ModInt &operator*=(const ModInt &rhs) {
        val = (unsigned long long)val * rhs.val % mod;
        return *this;
    }
    constexpr ModInt &operator/=(const ModInt &rhs) {
        val = (unsigned long long)val * rhs.inv().val % mod;
        return *this;
    }

    friend constexpr ModInt operator+(const ModInt &lhs, const ModInt &rhs) {
        return ModInt<mod>(lhs) += rhs;
    }
    friend constexpr ModInt operator-(const ModInt &lhs, const ModInt &rhs) {
        return ModInt<mod>(lhs) -= rhs;
    }
    friend constexpr ModInt operator*(const ModInt &lhs, const ModInt &rhs) {
        return ModInt<mod>(lhs) *= rhs;
    }
    friend constexpr ModInt operator/(const ModInt &lhs, const ModInt &rhs) {
        return ModInt<mod>(lhs) /= rhs;
    }

    constexpr ModInt pow(unsigned long long x) const {
        ModInt<mod> ret = ModInt<mod>::raw(1);
        ModInt<mod> self = *this;
        while (x != 0) {
            if (x & 1)
                ret *= self;
            self *= self;
            x >>= 1;
        }
        return ret;
    }
    constexpr ModInt inv() const {
        static_assert(is_prime(mod), "`mod` must be a prime number.");
        assert(val != 0);
        return this->pow(mod - 2);
    }

    friend std::istream &operator>>(std::istream &is, ModInt<mod> &x) {
        long long val;
        is >> val;
        x.val = val % mod + (val < 0 ? mod : 0);
        return is;
    }

    friend std::ostream &operator<<(std::ostream &os, const ModInt<mod> &x) {
        os << x.val;
        return os;
    }

    friend bool operator==(const ModInt &lhs, const ModInt &rhs) {
        return lhs.val == rhs.val;
    }
    
    friend bool operator!=(const ModInt &lhs, const ModInt &rhs) {
        return lhs.val != rhs.val;
    }
};

[[maybe_unused]] constexpr unsigned mod998244353 = 998244353;
[[maybe_unused]] constexpr unsigned mod1000000007 = 1000000007;

// ============
// ============

#include <cassert>
#include <vector>

// ============

#include <limits>
#include <utility>

template <typename T>
struct Add {
    using Value = T;
    static Value id() {
        return T(0);
    }
    static Value op(const Value &lhs, const Value &rhs) {
        return lhs + rhs;
    }
    static Value inv(const Value &x) {
        return -x;
    }
};

template <typename T>
struct Mul {
    using Value = T;
    static Value id() {
        return Value(1);
    }
    static Value op(const Value &lhs, const Value &rhs) {
        return lhs * rhs;
    }
    static Value inv(const Value &x) {
        return Value(1) / x;
    }
};

template <typename T>
struct Min {
    using Value = T;
    static Value id() {
        return std::numeric_limits<T>::max();
    }
    static Value op(const Value &lhs, const Value &rhs) {
        return std::min(lhs, rhs);
    }
};

template <typename T>
struct Max {
    using Value = T;
    static Value id() {
        return std::numeric_limits<Value>::min();
    }
    static Value op(const Value &lhs, const Value &rhs) {
        return std::max(lhs, rhs);
    }
};

template <typename T>
struct Xor {
    using Value = T;
    static Value id() {
        return T(0);
    }
    static Value op(const Value &lhs, const Value &rhs) {
        return lhs ^ rhs;
    }
    static Value inv(const Value &x) {
        return x;
    }
};

template <typename Monoid>
struct Reversible {
    using Value = std::pair<typename Monoid::Value, typename Monoid::Value>;
    static Value id() {
        return Value(Monoid::id(), Monoid::id());
    }
    static Value op(const Value &v1, const Value &v2) {
        return Value(
            Monoid::op(v1.first, v2.first),
            Monoid::op(v2.second, v1.second));
    }
};

// ============

template <typename CommutativeGroup>
class FenwickTree {
public:
    using Value = typename CommutativeGroup::Value;

private:
    std::vector<Value> data;

public:
    FenwickTree(int n) : data(n, CommutativeGroup::id()) {}

    void add(int idx, const Value &x) {
        assert(idx >= 0 && idx < (int) data.size());
        for (; idx < (int) data.size(); idx |= idx + 1) {
            data[idx] = CommutativeGroup::op(data[idx], x);
        }
    }

    Value sum(int r) const {
        assert(r >= 0 && r <= (int) data.size());
        Value ret = CommutativeGroup::id();
        for (; r > 0; r &= r - 1) {
            ret = CommutativeGroup::op(ret, data[r - 1]);
        }
        return ret;
    }

    Value sum(int l, int r) const {
        assert(l >= 0 && l <= r && r <= (int) data.size());
        return CommutativeGroup::op(sum(r), CommutativeGroup::inv(sum(l)));
    }
};

template <typename T>
using FenwickTreeAdd = FenwickTree<Add<T>>;
// ============
// ============

#include <vector>
#include <cassert>

template <typename T>
class FactorialTable {
    std::vector<T> fac;
    std::vector<T> ifac;
    
public:
    FactorialTable() : fac(1, T(1)), ifac(1, T(1)) {}
    
    FactorialTable(int n) : fac(n + 1), ifac(n + 1) {
        assert(n >= 0);
        fac[0] = T(1);
        for (int i = 1; i <= n; ++i) {
            fac[i] = fac[i - 1] * T(i);
        }
        ifac[n] = T(1) / T(fac[n]);
        for (int i = n; i > 0; --i) {
            ifac[i - 1] = ifac[i] * T(i);
        }
    }
    
    void resize(int n) {
        int old = n_max();
        if (n <= old) {
            return;
        }
        fac.resize(n + 1);
        for (int i = old + 1; i <= n; ++i) {
            fac[i] = fac[i - 1] * T(i);
        }
        ifac.resize(n + 1);
        ifac[n] = T(1) / T(fac[n]);
        for (int i = n; i > old; --i) {
            ifac[i - 1] = ifac[i] * T(i);
        }
    }
    
    inline int n_max() const {
        return (int) fac.size() - 1;
    }
    
    inline T fact(int n) const {
        assert(n >= 0 && n <= n_max());
        return fac[n];
    }
    
    inline T inv_fact(int n) const {
        assert(n >= 0 && n <= n_max());
        return ifac[n];
    }
    
    inline T choose(int n, int k) const {
        assert(k <= n_max() && n <= n_max());
        if (k > n || k < 0) {
            return T(0);
        }
        return fac[n] * ifac[k] * ifac[n - k];
    }
    
    inline T multi_choose(int n, int k) const {
        assert(n >= 1 && k >= 0 && k + n - 1 <= n_max());
        return choose(k + n - 1, k);
    }
    
    inline T n_terms_sum_k(int n, int k) const {
        assert(n >= 0);
        if (k < 0) {
            return T(0);
        }
        if (n == 0) {
            return k == 0 ? T(1) : T(0);
        }
        return choose(n + k - 1, n - 1);
    }
};
// ============

using Mint = ModInt<mod1000000007>;

int main() {
    i32 n;
    cin >> n;
    Vec<i32> s(n);
    REP(i, n) {
        cin >> s[i];
    }
    CoordinateCompression<i32> cc(s);
    FenwickTreeAdd<i32> fw(n);
    Mint ans;
    FactorialTable<Mint> table(n);
    REP(i, n) {
        ans += Mint(s[i] - fw.sum(s[i])) * table.fact(n - i - 1);
        fw.add(s[i], 1);
    }
    cout << ans + Mint(1) << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 320 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 320 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 320 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 316 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 316 KB Output is correct
17 Correct 0 ms 316 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 324 KB Output is correct
23 Correct 0 ms 316 KB Output is correct
24 Correct 0 ms 324 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 57 ms 9032 KB Output is correct
3 Correct 59 ms 9096 KB Output is correct
4 Correct 58 ms 9024 KB Output is correct
5 Correct 62 ms 9092 KB Output is correct
6 Correct 60 ms 9036 KB Output is correct
7 Correct 63 ms 9020 KB Output is correct
8 Correct 61 ms 9020 KB Output is correct
9 Correct 61 ms 9024 KB Output is correct
10 Correct 60 ms 9028 KB Output is correct
11 Correct 64 ms 9024 KB Output is correct
12 Correct 59 ms 9032 KB Output is correct
13 Correct 65 ms 9032 KB Output is correct
14 Correct 75 ms 9100 KB Output is correct
15 Correct 60 ms 9020 KB Output is correct
16 Correct 61 ms 9024 KB Output is correct
17 Correct 68 ms 9028 KB Output is correct
18 Correct 77 ms 9036 KB Output is correct
19 Correct 61 ms 9024 KB Output is correct
20 Correct 64 ms 9036 KB Output is correct
21 Correct 60 ms 9000 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 55 ms 8012 KB Output is correct
3 Correct 63 ms 8124 KB Output is correct
4 Correct 55 ms 8108 KB Output is correct
5 Correct 56 ms 8136 KB Output is correct
6 Correct 56 ms 8132 KB Output is correct
7 Correct 57 ms 8044 KB Output is correct
8 Correct 61 ms 8064 KB Output is correct
9 Correct 56 ms 8132 KB Output is correct
10 Correct 54 ms 8044 KB Output is correct
11 Correct 54 ms 8072 KB Output is correct
12 Correct 58 ms 8016 KB Output is correct
13 Correct 53 ms 8128 KB Output is correct
14 Correct 54 ms 8084 KB Output is correct
15 Correct 52 ms 8136 KB Output is correct
16 Correct 55 ms 8068 KB Output is correct
17 Correct 54 ms 8072 KB Output is correct
18 Correct 52 ms 8012 KB Output is correct
19 Correct 55 ms 8128 KB Output is correct
20 Correct 54 ms 8064 KB Output is correct
21 Correct 56 ms 8072 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 328 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 2 ms 340 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 320 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 320 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 316 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 316 KB Output is correct
17 Correct 0 ms 316 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 324 KB Output is correct
23 Correct 0 ms 316 KB Output is correct
24 Correct 0 ms 324 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 2 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 328 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 2 ms 340 KB Output is correct
36 Correct 1 ms 336 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
38 Correct 1 ms 340 KB Output is correct
39 Correct 1 ms 212 KB Output is correct
40 Correct 1 ms 340 KB Output is correct
41 Correct 1 ms 340 KB Output is correct
42 Correct 1 ms 340 KB Output is correct
43 Correct 1 ms 340 KB Output is correct
44 Correct 1 ms 340 KB Output is correct
45 Correct 1 ms 340 KB Output is correct
46 Correct 1 ms 332 KB Output is correct
47 Correct 0 ms 212 KB Output is correct
48 Correct 1 ms 360 KB Output is correct
49 Correct 1 ms 340 KB Output is correct
50 Correct 1 ms 328 KB Output is correct
51 Correct 1 ms 336 KB Output is correct
52 Correct 1 ms 364 KB Output is correct
53 Correct 1 ms 340 KB Output is correct
54 Correct 1 ms 340 KB Output is correct
55 Correct 1 ms 340 KB Output is correct
56 Correct 1 ms 340 KB Output is correct
57 Correct 1 ms 340 KB Output is correct
58 Correct 1 ms 340 KB Output is correct
59 Correct 2 ms 364 KB Output is correct
60 Correct 1 ms 340 KB Output is correct
61 Correct 0 ms 212 KB Output is correct
62 Correct 1 ms 328 KB Output is correct
63 Correct 1 ms 340 KB Output is correct
64 Correct 1 ms 340 KB Output is correct
65 Correct 1 ms 340 KB Output is correct
66 Correct 1 ms 340 KB Output is correct
67 Correct 1 ms 340 KB Output is correct
68 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 55 ms 8012 KB Output is correct
3 Correct 63 ms 8124 KB Output is correct
4 Correct 55 ms 8108 KB Output is correct
5 Correct 56 ms 8136 KB Output is correct
6 Correct 56 ms 8132 KB Output is correct
7 Correct 57 ms 8044 KB Output is correct
8 Correct 61 ms 8064 KB Output is correct
9 Correct 56 ms 8132 KB Output is correct
10 Correct 54 ms 8044 KB Output is correct
11 Correct 54 ms 8072 KB Output is correct
12 Correct 58 ms 8016 KB Output is correct
13 Correct 53 ms 8128 KB Output is correct
14 Correct 54 ms 8084 KB Output is correct
15 Correct 52 ms 8136 KB Output is correct
16 Correct 55 ms 8068 KB Output is correct
17 Correct 54 ms 8072 KB Output is correct
18 Correct 52 ms 8012 KB Output is correct
19 Correct 55 ms 8128 KB Output is correct
20 Correct 54 ms 8064 KB Output is correct
21 Correct 56 ms 8072 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 332 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 2 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 328 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 2 ms 340 KB Output is correct
33 Correct 1 ms 336 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
38 Correct 1 ms 340 KB Output is correct
39 Correct 1 ms 340 KB Output is correct
40 Correct 1 ms 340 KB Output is correct
41 Correct 1 ms 340 KB Output is correct
42 Correct 1 ms 340 KB Output is correct
43 Correct 1 ms 332 KB Output is correct
44 Correct 1 ms 212 KB Output is correct
45 Correct 107 ms 8132 KB Output is correct
46 Correct 106 ms 8068 KB Output is correct
47 Correct 101 ms 8012 KB Output is correct
48 Correct 100 ms 8144 KB Output is correct
49 Correct 108 ms 8064 KB Output is correct
50 Correct 100 ms 8012 KB Output is correct
51 Correct 102 ms 8012 KB Output is correct
52 Correct 99 ms 8072 KB Output is correct
53 Correct 100 ms 8008 KB Output is correct
54 Correct 109 ms 8136 KB Output is correct
55 Correct 102 ms 8012 KB Output is correct
56 Correct 102 ms 8068 KB Output is correct
57 Correct 103 ms 8128 KB Output is correct
58 Correct 0 ms 316 KB Output is correct
59 Correct 103 ms 8016 KB Output is correct
60 Correct 100 ms 8132 KB Output is correct
61 Correct 108 ms 8072 KB Output is correct
62 Correct 103 ms 8132 KB Output is correct
63 Correct 104 ms 8072 KB Output is correct
64 Correct 103 ms 8196 KB Output is correct
65 Correct 100 ms 8136 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 320 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 320 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 316 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 316 KB Output is correct
17 Correct 0 ms 316 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 324 KB Output is correct
23 Correct 0 ms 316 KB Output is correct
24 Correct 0 ms 324 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 57 ms 9032 KB Output is correct
27 Correct 59 ms 9096 KB Output is correct
28 Correct 58 ms 9024 KB Output is correct
29 Correct 62 ms 9092 KB Output is correct
30 Correct 60 ms 9036 KB Output is correct
31 Correct 63 ms 9020 KB Output is correct
32 Correct 61 ms 9020 KB Output is correct
33 Correct 61 ms 9024 KB Output is correct
34 Correct 60 ms 9028 KB Output is correct
35 Correct 64 ms 9024 KB Output is correct
36 Correct 59 ms 9032 KB Output is correct
37 Correct 65 ms 9032 KB Output is correct
38 Correct 75 ms 9100 KB Output is correct
39 Correct 60 ms 9020 KB Output is correct
40 Correct 61 ms 9024 KB Output is correct
41 Correct 68 ms 9028 KB Output is correct
42 Correct 77 ms 9036 KB Output is correct
43 Correct 61 ms 9024 KB Output is correct
44 Correct 64 ms 9036 KB Output is correct
45 Correct 60 ms 9000 KB Output is correct
46 Correct 0 ms 212 KB Output is correct
47 Correct 55 ms 8012 KB Output is correct
48 Correct 63 ms 8124 KB Output is correct
49 Correct 55 ms 8108 KB Output is correct
50 Correct 56 ms 8136 KB Output is correct
51 Correct 56 ms 8132 KB Output is correct
52 Correct 57 ms 8044 KB Output is correct
53 Correct 61 ms 8064 KB Output is correct
54 Correct 56 ms 8132 KB Output is correct
55 Correct 54 ms 8044 KB Output is correct
56 Correct 54 ms 8072 KB Output is correct
57 Correct 58 ms 8016 KB Output is correct
58 Correct 53 ms 8128 KB Output is correct
59 Correct 54 ms 8084 KB Output is correct
60 Correct 52 ms 8136 KB Output is correct
61 Correct 55 ms 8068 KB Output is correct
62 Correct 54 ms 8072 KB Output is correct
63 Correct 52 ms 8012 KB Output is correct
64 Correct 55 ms 8128 KB Output is correct
65 Correct 54 ms 8064 KB Output is correct
66 Correct 56 ms 8072 KB Output is correct
67 Correct 0 ms 212 KB Output is correct
68 Correct 1 ms 332 KB Output is correct
69 Correct 1 ms 340 KB Output is correct
70 Correct 1 ms 340 KB Output is correct
71 Correct 1 ms 340 KB Output is correct
72 Correct 2 ms 340 KB Output is correct
73 Correct 1 ms 340 KB Output is correct
74 Correct 1 ms 328 KB Output is correct
75 Correct 1 ms 340 KB Output is correct
76 Correct 1 ms 340 KB Output is correct
77 Correct 2 ms 340 KB Output is correct
78 Correct 1 ms 336 KB Output is correct
79 Correct 1 ms 340 KB Output is correct
80 Correct 1 ms 340 KB Output is correct
81 Correct 1 ms 212 KB Output is correct
82 Correct 1 ms 340 KB Output is correct
83 Correct 1 ms 340 KB Output is correct
84 Correct 1 ms 340 KB Output is correct
85 Correct 1 ms 340 KB Output is correct
86 Correct 1 ms 340 KB Output is correct
87 Correct 1 ms 340 KB Output is correct
88 Correct 1 ms 332 KB Output is correct
89 Correct 0 ms 212 KB Output is correct
90 Correct 1 ms 360 KB Output is correct
91 Correct 1 ms 340 KB Output is correct
92 Correct 1 ms 328 KB Output is correct
93 Correct 1 ms 336 KB Output is correct
94 Correct 1 ms 364 KB Output is correct
95 Correct 1 ms 340 KB Output is correct
96 Correct 1 ms 340 KB Output is correct
97 Correct 1 ms 340 KB Output is correct
98 Correct 1 ms 340 KB Output is correct
99 Correct 1 ms 340 KB Output is correct
100 Correct 1 ms 340 KB Output is correct
101 Correct 2 ms 364 KB Output is correct
102 Correct 1 ms 340 KB Output is correct
103 Correct 0 ms 212 KB Output is correct
104 Correct 1 ms 328 KB Output is correct
105 Correct 1 ms 340 KB Output is correct
106 Correct 1 ms 340 KB Output is correct
107 Correct 1 ms 340 KB Output is correct
108 Correct 1 ms 340 KB Output is correct
109 Correct 1 ms 340 KB Output is correct
110 Correct 1 ms 332 KB Output is correct
111 Correct 1 ms 212 KB Output is correct
112 Correct 107 ms 8132 KB Output is correct
113 Correct 106 ms 8068 KB Output is correct
114 Correct 101 ms 8012 KB Output is correct
115 Correct 100 ms 8144 KB Output is correct
116 Correct 108 ms 8064 KB Output is correct
117 Correct 100 ms 8012 KB Output is correct
118 Correct 102 ms 8012 KB Output is correct
119 Correct 99 ms 8072 KB Output is correct
120 Correct 100 ms 8008 KB Output is correct
121 Correct 109 ms 8136 KB Output is correct
122 Correct 102 ms 8012 KB Output is correct
123 Correct 102 ms 8068 KB Output is correct
124 Correct 103 ms 8128 KB Output is correct
125 Correct 0 ms 316 KB Output is correct
126 Correct 103 ms 8016 KB Output is correct
127 Correct 100 ms 8132 KB Output is correct
128 Correct 108 ms 8072 KB Output is correct
129 Correct 103 ms 8132 KB Output is correct
130 Correct 104 ms 8072 KB Output is correct
131 Correct 103 ms 8196 KB Output is correct
132 Correct 100 ms 8136 KB Output is correct
133 Correct 1 ms 212 KB Output is correct
134 Correct 111 ms 9040 KB Output is correct
135 Correct 109 ms 9024 KB Output is correct
136 Correct 105 ms 9020 KB Output is correct
137 Correct 104 ms 9040 KB Output is correct
138 Correct 106 ms 9040 KB Output is correct
139 Correct 104 ms 9032 KB Output is correct
140 Correct 105 ms 9092 KB Output is correct
141 Correct 114 ms 9028 KB Output is correct
142 Correct 104 ms 9020 KB Output is correct
143 Correct 117 ms 9032 KB Output is correct
144 Correct 108 ms 9088 KB Output is correct
145 Correct 108 ms 9168 KB Output is correct
146 Correct 106 ms 9032 KB Output is correct
147 Correct 0 ms 212 KB Output is correct
148 Correct 106 ms 9040 KB Output is correct
149 Correct 110 ms 9024 KB Output is correct
150 Correct 111 ms 9020 KB Output is correct
151 Correct 104 ms 9036 KB Output is correct
152 Correct 105 ms 9036 KB Output is correct
153 Correct 107 ms 9036 KB Output is correct
154 Correct 105 ms 9020 KB Output is correct