답안 #930813

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
930813 2024-02-20T12:59:32 Z boris_mihov 푸드 코트 (JOI21_foodcourt) C++17
100 / 100
935 ms 85828 KB
#include <algorithm>
#include <iostream>
#include <numeric>
#include <cassert>
#include <vector>

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

typedef long long llong;
const int MAXN = 250000 + 10;
const llong INF = 1e18;

const int BUFF_SIZE = 1e5;
char buff[BUFF_SIZE];
int buffPos = BUFF_SIZE-1;

void readChar() 
{
    if (++buffPos == BUFF_SIZE) fread(buff, BUFF_SIZE, 1, stdin), buffPos = 0;
}

void readInt(int &num) 
{
    num = 0;
    for (; '0' > buff[buffPos] || buff[buffPos] > '9' ; readChar());
    for (; '0' <= buff[buffPos] && buff[buffPos] <= '9' ; readChar())
    {
        num = 10*num + buff[buffPos]-'0';
    }
}

void readLong(llong &num) 
{
    num = 0;
    for (; '0' > buff[buffPos] || buff[buffPos] > '9' ; readChar());
    for (; '0' <= buff[buffPos] && buff[buffPos] <= '9' ; readChar())
    {
        num = 10*num + buff[buffPos]-'0';
    }
}

int n, m, q;
struct SegmentTree
{
    struct Node
    {
        llong minPrefix;
        llong maxSuffix;
        llong sumPositive;
        llong sumNegative;
        llong sum;
        int c;

        Node()
        {
            maxSuffix = minPrefix = sumPositive = sumNegative = sum = c = 0;
        }   

        void assign(const Node &left, const Node &right)
        {
            sum = left.sum + right.sum;
            sumPositive = left.sumPositive + right.sumPositive;
            sumNegative = left.sumNegative + right.sumNegative;
            minPrefix = std::min(left.minPrefix, left.sum + right.minPrefix);
            maxSuffix = std::max(right.maxSuffix, right.sum + left.maxSuffix);
            c = std::max(left.c, right.c);
        }

        void operator += (const Node &right)
        {
            minPrefix = std::min(minPrefix, sum + right.minPrefix);
            maxSuffix = std::max(right.maxSuffix, right.sum + maxSuffix);
            
            sum = sum + right.sum;
            sumPositive = sumPositive + right.sumPositive;
            sumNegative = sumNegative + right.sumNegative;
            c = std::max(c, right.c);
        }
    };

    Node tree[4*MAXN];
    void update(int l, int r, int node, const int &queryPos, const int &queryVal, const int &queryC, const bool &queryType)
    {
        if (l == r)
        {
            tree[node].c = queryC;
            if (queryType == true)
            {
                tree[node].sum = queryVal;
                tree[node].sumNegative = 0;
                tree[node].sumPositive = queryVal;
            } else
            {
                tree[node].sum = -queryVal;
                tree[node].sumPositive = 0;
                tree[node].sumNegative = queryVal;
            }

            tree[node].minPrefix = std::min(0LL, tree[node].sum);
            tree[node].maxSuffix = std::max(0LL, tree[node].sum);
            return;
        }

        int mid = l + r >> 1;
        if (queryPos <= mid) update(l, mid, 2*node, queryPos, queryVal, queryC, queryType);
        else update(mid + 1, r, 2*node + 1, queryPos, queryVal, queryC, queryType);
        tree[node].assign(tree[2*node], tree[2*node + 1]);
    }

    Node query(int l, int r, int node, const int &queryL, const int &queryR)
    {
        if (queryL <= l && r <= queryR)
        {
            return tree[node];
        }

        Node res;
        int mid = l + r >> 1;
        if (queryL <= mid) res = query(l, mid, 2*node, queryL, queryR);
        if (mid + 1 <= queryR) res += query(mid + 1, r, 2*node + 1, queryL, queryR);
        return res;
    }

    std::pair <llong,llong> queryMaxSuffix(int l, int r, int node, const int &queryL, const int &queryR)
    {
        if (queryL <= l && r <= queryR)
        {
            return {tree[node].maxSuffix, tree[node].sum};
        }

        int mid = l + r >> 1;
        llong left = 0, sL = 0, right = 0, sR = 0;
        if (queryL <= mid) 
        {
            auto p = queryMaxSuffix(l, mid, 2*node, queryL, queryR);
            left = p.first; sL = p.second;
        }

        if (mid + 1 <= queryR) 
        {
            auto p = queryMaxSuffix(mid + 1, r, 2*node + 1, queryL, queryR);
            right = p.first; sR = p.second;
        }

        return {std::max(right, sR + left), sL + sR};
    }

    std::pair <llong,llong> queryMinPrefix(int l, int r, int node, const int &queryL, const int &queryR)
    {
        if (queryL <= l && r <= queryR)
        {
            return {tree[node].minPrefix, tree[node].sum};
        }

        int mid = l + r >> 1;
        llong left = 0, sL = 0, right = 0, sR = 0;
        if (queryL <= mid) 
        {
            auto p = queryMinPrefix(l, mid, 2*node, queryL, queryR);
            left = p.first; sL = p.second;
        }

        if (mid + 1 <= queryR) 
        {
            auto p = queryMinPrefix(mid + 1, r, 2*node + 1, queryL, queryR);
            right = p.first; sR = p.second;
        }

        return {std::min(left, sL + right), sL + sR};
    }

    llong find(int l, int r, int node, const int &queryL, const int &queryR, const llong &k)
    {
        if (queryR < l || r < queryL)
        {
            return 0;
        }

        if (queryL <= l && r <= queryR && tree[node].sumPositive < k)
        {
            return -tree[node].sumPositive;
        }

        if (l == r)
        {
            return tree[node].c;
        }

        int mid = l + r >> 1;
        llong res = find(l, mid, 2*node, queryL, queryR, k);
        if (res > 0) return res;
        llong res2 = find(mid + 1, r, 2*node + 1, queryL, queryR, k + res);
        if (res2 > 0) return res2;
        else return res + res2;
    }

    void update(int pos, int val, int c, bool type)
    {
        update(1, q, 1, pos, val, c, type);
    }

    llong queryMaxSuffix(int l, int r)
    {
        return queryMaxSuffix(1, q, 1, l, r).first;
    }

    llong queryMinPrefix(int l, int r)
    {
        return queryMinPrefix(1, q, 1, l, r).first;
    }

    Node query(int l, int r)
    {
        return query(1, q, 1, l, r);
    }

    int find(int l, int r, llong k)
    {
        return find(1, q, 1, l, r, k);
    }
};

struct QueryAsk
{
    int time;
    llong val;
    int idx;
};

struct QueryAdd
{
    bool type;
    int val;
    int c;
    int idx;
};

int cntServices;
std::vector <QueryAdd> activate[MAXN];
std::vector <QueryAdd> deactivate[MAXN];
std::vector <QueryAsk> v[MAXN];
SegmentTree tree;
int answer[MAXN];

void solve()
{
    for (int i = 1 ; i <= n ; ++i)
    {
        for (const QueryAdd query : activate[i])
        {
            tree.update(query.idx, query.val, query.c, query.type);
        }

        for (const QueryAdd query : deactivate[i])
        {
            tree.update(query.idx, 0, 0, false);
        }

        for (const auto &[time, val, idx] : v[i])
        {
            int l = 0, r = time + 1, mid;
            while (l < r - 1)
            {
                mid = l + r >> 1;
                llong res = tree.queryMinPrefix(mid, time);
                if (mid > 1) res += tree.queryMaxSuffix(1, mid - 1);
                if (res >= 0) r = mid;
                else l = mid;
            }

            if (r > time)
            {
                answer[idx] = 0;
                continue;
            }
            
            llong cntPositive = tree.query(r, time).sumPositive;
            llong cntNegative = tree.query(r, time).sumNegative;

            if (val + cntNegative > cntPositive) answer[idx] = 0;
            else answer[idx] = tree.find(r, time, val + cntNegative);
        }
    }
}

void input()
{
    readInt(n);
    readInt(m);
    readInt(q);
    for (int i = 1 ; i <= q ; ++i)
    {
        int qType;
        readInt(qType);
        if (qType == 1)
        {
            int l, r, c, val;
            readInt(l);
            readInt(r);
            readInt(c);
            readInt(val);
            activate[l].push_back({true, val, c, i});
            deactivate[r + 1].push_back({true, val, c, i});
            continue;
        }

        if (qType == 2)
        {
            int l, r, val;
            readInt(l);
            readInt(r);
            readInt(val);
            activate[l].push_back({false, val, 0, i});
            deactivate[r + 1].push_back({false, val, 0, i});
            continue;
        }

        assert(qType == 3);
        int pos;
        llong k;
        readInt(pos);
        readLong(k);
        v[pos].push_back({i, k, ++cntServices});
    }
}

void print()
{
    for (int i = 1 ; i <= cntServices ; ++i)
    {
        std::cout << answer[i] << '\n';
    }
}

void fastIOI()
{
    std::ios_base :: sync_with_stdio(0);
    std::cout.tie(nullptr);
    std::cin.tie(nullptr);
}

int main()
{
    fastIOI();
    input();
    solve();
    print();

    return 0;
}

Compilation message

foodcourt.cpp: In member function 'void SegmentTree::update(int, int, int, const int&, const int&, const int&, const bool&)':
foodcourt.cpp:105:21: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  105 |         int mid = l + r >> 1;
      |                   ~~^~~
foodcourt.cpp: In member function 'SegmentTree::Node SegmentTree::query(int, int, int, const int&, const int&)':
foodcourt.cpp:119:21: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  119 |         int mid = l + r >> 1;
      |                   ~~^~~
foodcourt.cpp: In member function 'std::pair<long long int, long long int> SegmentTree::queryMaxSuffix(int, int, int, const int&, const int&)':
foodcourt.cpp:132:21: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  132 |         int mid = l + r >> 1;
      |                   ~~^~~
foodcourt.cpp: In member function 'std::pair<long long int, long long int> SegmentTree::queryMinPrefix(int, int, int, const int&, const int&)':
foodcourt.cpp:156:21: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  156 |         int mid = l + r >> 1;
      |                   ~~^~~
foodcourt.cpp: In member function 'llong SegmentTree::find(int, int, int, const int&, const int&, const llong&)':
foodcourt.cpp:190:21: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  190 |         int mid = l + r >> 1;
      |                   ~~^~~
foodcourt.cpp: In function 'void solve()':
foodcourt.cpp:265:25: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  265 |                 mid = l + r >> 1;
      |                       ~~^~~
foodcourt.cpp: In function 'void readChar()':
foodcourt.cpp:20:38: warning: ignoring return value of 'size_t fread(void*, size_t, size_t, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |     if (++buffPos == BUFF_SIZE) fread(buff, BUFF_SIZE, 1, stdin), buffPos = 0;
      |                                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 65884 KB Output is correct
2 Correct 16 ms 65884 KB Output is correct
3 Correct 15 ms 65824 KB Output is correct
4 Correct 15 ms 65884 KB Output is correct
5 Correct 16 ms 66220 KB Output is correct
6 Correct 14 ms 65884 KB Output is correct
7 Correct 15 ms 65880 KB Output is correct
8 Correct 14 ms 65884 KB Output is correct
9 Correct 15 ms 65748 KB Output is correct
10 Correct 15 ms 65884 KB Output is correct
11 Correct 15 ms 65884 KB Output is correct
12 Correct 15 ms 65884 KB Output is correct
13 Correct 16 ms 65760 KB Output is correct
14 Correct 17 ms 65884 KB Output is correct
15 Correct 15 ms 65884 KB Output is correct
16 Correct 15 ms 66008 KB Output is correct
17 Correct 15 ms 65884 KB Output is correct
18 Correct 15 ms 65800 KB Output is correct
19 Correct 14 ms 65884 KB Output is correct
20 Correct 14 ms 65884 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 65884 KB Output is correct
2 Correct 16 ms 65884 KB Output is correct
3 Correct 15 ms 65824 KB Output is correct
4 Correct 15 ms 65884 KB Output is correct
5 Correct 16 ms 66220 KB Output is correct
6 Correct 14 ms 65884 KB Output is correct
7 Correct 15 ms 65880 KB Output is correct
8 Correct 14 ms 65884 KB Output is correct
9 Correct 15 ms 65748 KB Output is correct
10 Correct 15 ms 65884 KB Output is correct
11 Correct 15 ms 65884 KB Output is correct
12 Correct 15 ms 65884 KB Output is correct
13 Correct 16 ms 65760 KB Output is correct
14 Correct 17 ms 65884 KB Output is correct
15 Correct 15 ms 65884 KB Output is correct
16 Correct 15 ms 66008 KB Output is correct
17 Correct 15 ms 65884 KB Output is correct
18 Correct 15 ms 65800 KB Output is correct
19 Correct 14 ms 65884 KB Output is correct
20 Correct 14 ms 65884 KB Output is correct
21 Correct 15 ms 65880 KB Output is correct
22 Correct 17 ms 65884 KB Output is correct
23 Correct 14 ms 65996 KB Output is correct
24 Correct 16 ms 65808 KB Output is correct
25 Correct 15 ms 65884 KB Output is correct
26 Correct 14 ms 65764 KB Output is correct
27 Correct 15 ms 66136 KB Output is correct
28 Correct 15 ms 65972 KB Output is correct
29 Correct 15 ms 65816 KB Output is correct
30 Correct 16 ms 65880 KB Output is correct
31 Correct 15 ms 65884 KB Output is correct
32 Correct 15 ms 66016 KB Output is correct
33 Correct 14 ms 65884 KB Output is correct
34 Correct 15 ms 66024 KB Output is correct
35 Correct 15 ms 65884 KB Output is correct
36 Correct 16 ms 66024 KB Output is correct
37 Correct 14 ms 65884 KB Output is correct
38 Correct 16 ms 65884 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 157 ms 69216 KB Output is correct
2 Correct 114 ms 69200 KB Output is correct
3 Correct 134 ms 69096 KB Output is correct
4 Correct 138 ms 68968 KB Output is correct
5 Correct 116 ms 69200 KB Output is correct
6 Correct 123 ms 69196 KB Output is correct
7 Correct 87 ms 68016 KB Output is correct
8 Correct 100 ms 68292 KB Output is correct
9 Correct 117 ms 69148 KB Output is correct
10 Correct 114 ms 69172 KB Output is correct
11 Correct 116 ms 68944 KB Output is correct
12 Correct 126 ms 69204 KB Output is correct
13 Correct 123 ms 68716 KB Output is correct
14 Correct 163 ms 68952 KB Output is correct
15 Correct 99 ms 68956 KB Output is correct
16 Correct 96 ms 69244 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 750 ms 76788 KB Output is correct
2 Correct 561 ms 74696 KB Output is correct
3 Correct 836 ms 77936 KB Output is correct
4 Correct 434 ms 74864 KB Output is correct
5 Correct 483 ms 75092 KB Output is correct
6 Correct 670 ms 78160 KB Output is correct
7 Correct 446 ms 76084 KB Output is correct
8 Correct 465 ms 74108 KB Output is correct
9 Correct 935 ms 77136 KB Output is correct
10 Correct 856 ms 83144 KB Output is correct
11 Correct 641 ms 84156 KB Output is correct
12 Correct 589 ms 84056 KB Output is correct
13 Correct 642 ms 84004 KB Output is correct
14 Correct 682 ms 84004 KB Output is correct
15 Correct 753 ms 84064 KB Output is correct
16 Correct 717 ms 83940 KB Output is correct
17 Correct 683 ms 83796 KB Output is correct
18 Correct 675 ms 84016 KB Output is correct
19 Correct 679 ms 84052 KB Output is correct
20 Correct 703 ms 83932 KB Output is correct
21 Correct 724 ms 84052 KB Output is correct
22 Correct 696 ms 83928 KB Output is correct
23 Correct 711 ms 83936 KB Output is correct
24 Correct 687 ms 84264 KB Output is correct
25 Correct 696 ms 83172 KB Output is correct
26 Correct 699 ms 83556 KB Output is correct
27 Correct 505 ms 85076 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 65884 KB Output is correct
2 Correct 16 ms 65884 KB Output is correct
3 Correct 15 ms 65824 KB Output is correct
4 Correct 15 ms 65884 KB Output is correct
5 Correct 16 ms 66220 KB Output is correct
6 Correct 14 ms 65884 KB Output is correct
7 Correct 15 ms 65880 KB Output is correct
8 Correct 14 ms 65884 KB Output is correct
9 Correct 15 ms 65748 KB Output is correct
10 Correct 15 ms 65884 KB Output is correct
11 Correct 15 ms 65884 KB Output is correct
12 Correct 15 ms 65884 KB Output is correct
13 Correct 16 ms 65760 KB Output is correct
14 Correct 17 ms 65884 KB Output is correct
15 Correct 15 ms 65884 KB Output is correct
16 Correct 15 ms 66008 KB Output is correct
17 Correct 15 ms 65884 KB Output is correct
18 Correct 15 ms 65800 KB Output is correct
19 Correct 14 ms 65884 KB Output is correct
20 Correct 14 ms 65884 KB Output is correct
21 Correct 157 ms 69216 KB Output is correct
22 Correct 114 ms 69200 KB Output is correct
23 Correct 134 ms 69096 KB Output is correct
24 Correct 138 ms 68968 KB Output is correct
25 Correct 116 ms 69200 KB Output is correct
26 Correct 123 ms 69196 KB Output is correct
27 Correct 87 ms 68016 KB Output is correct
28 Correct 100 ms 68292 KB Output is correct
29 Correct 117 ms 69148 KB Output is correct
30 Correct 114 ms 69172 KB Output is correct
31 Correct 116 ms 68944 KB Output is correct
32 Correct 126 ms 69204 KB Output is correct
33 Correct 123 ms 68716 KB Output is correct
34 Correct 163 ms 68952 KB Output is correct
35 Correct 99 ms 68956 KB Output is correct
36 Correct 96 ms 69244 KB Output is correct
37 Correct 135 ms 68724 KB Output is correct
38 Correct 96 ms 68460 KB Output is correct
39 Correct 67 ms 67852 KB Output is correct
40 Correct 80 ms 68556 KB Output is correct
41 Correct 113 ms 68944 KB Output is correct
42 Correct 114 ms 69076 KB Output is correct
43 Correct 127 ms 69076 KB Output is correct
44 Correct 134 ms 69076 KB Output is correct
45 Correct 132 ms 68948 KB Output is correct
46 Correct 155 ms 69072 KB Output is correct
47 Correct 117 ms 68156 KB Output is correct
48 Correct 137 ms 69200 KB Output is correct
49 Correct 85 ms 68188 KB Output is correct
50 Correct 122 ms 68676 KB Output is correct
51 Correct 117 ms 69140 KB Output is correct
52 Correct 126 ms 68956 KB Output is correct
53 Correct 86 ms 68552 KB Output is correct
54 Correct 100 ms 69204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 153 ms 68584 KB Output is correct
2 Correct 184 ms 68840 KB Output is correct
3 Correct 168 ms 68908 KB Output is correct
4 Correct 121 ms 67924 KB Output is correct
5 Correct 163 ms 68472 KB Output is correct
6 Correct 168 ms 68952 KB Output is correct
7 Correct 102 ms 68348 KB Output is correct
8 Correct 99 ms 67720 KB Output is correct
9 Correct 148 ms 68216 KB Output is correct
10 Correct 113 ms 67932 KB Output is correct
11 Correct 160 ms 68492 KB Output is correct
12 Correct 158 ms 68444 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 65884 KB Output is correct
2 Correct 16 ms 65884 KB Output is correct
3 Correct 15 ms 65824 KB Output is correct
4 Correct 15 ms 65884 KB Output is correct
5 Correct 16 ms 66220 KB Output is correct
6 Correct 14 ms 65884 KB Output is correct
7 Correct 15 ms 65880 KB Output is correct
8 Correct 14 ms 65884 KB Output is correct
9 Correct 15 ms 65748 KB Output is correct
10 Correct 15 ms 65884 KB Output is correct
11 Correct 15 ms 65884 KB Output is correct
12 Correct 15 ms 65884 KB Output is correct
13 Correct 16 ms 65760 KB Output is correct
14 Correct 17 ms 65884 KB Output is correct
15 Correct 15 ms 65884 KB Output is correct
16 Correct 15 ms 66008 KB Output is correct
17 Correct 15 ms 65884 KB Output is correct
18 Correct 15 ms 65800 KB Output is correct
19 Correct 14 ms 65884 KB Output is correct
20 Correct 14 ms 65884 KB Output is correct
21 Correct 15 ms 65880 KB Output is correct
22 Correct 17 ms 65884 KB Output is correct
23 Correct 14 ms 65996 KB Output is correct
24 Correct 16 ms 65808 KB Output is correct
25 Correct 15 ms 65884 KB Output is correct
26 Correct 14 ms 65764 KB Output is correct
27 Correct 15 ms 66136 KB Output is correct
28 Correct 15 ms 65972 KB Output is correct
29 Correct 15 ms 65816 KB Output is correct
30 Correct 16 ms 65880 KB Output is correct
31 Correct 15 ms 65884 KB Output is correct
32 Correct 15 ms 66016 KB Output is correct
33 Correct 14 ms 65884 KB Output is correct
34 Correct 15 ms 66024 KB Output is correct
35 Correct 15 ms 65884 KB Output is correct
36 Correct 16 ms 66024 KB Output is correct
37 Correct 14 ms 65884 KB Output is correct
38 Correct 16 ms 65884 KB Output is correct
39 Correct 157 ms 69216 KB Output is correct
40 Correct 114 ms 69200 KB Output is correct
41 Correct 134 ms 69096 KB Output is correct
42 Correct 138 ms 68968 KB Output is correct
43 Correct 116 ms 69200 KB Output is correct
44 Correct 123 ms 69196 KB Output is correct
45 Correct 87 ms 68016 KB Output is correct
46 Correct 100 ms 68292 KB Output is correct
47 Correct 117 ms 69148 KB Output is correct
48 Correct 114 ms 69172 KB Output is correct
49 Correct 116 ms 68944 KB Output is correct
50 Correct 126 ms 69204 KB Output is correct
51 Correct 123 ms 68716 KB Output is correct
52 Correct 163 ms 68952 KB Output is correct
53 Correct 99 ms 68956 KB Output is correct
54 Correct 96 ms 69244 KB Output is correct
55 Correct 135 ms 68724 KB Output is correct
56 Correct 96 ms 68460 KB Output is correct
57 Correct 67 ms 67852 KB Output is correct
58 Correct 80 ms 68556 KB Output is correct
59 Correct 113 ms 68944 KB Output is correct
60 Correct 114 ms 69076 KB Output is correct
61 Correct 127 ms 69076 KB Output is correct
62 Correct 134 ms 69076 KB Output is correct
63 Correct 132 ms 68948 KB Output is correct
64 Correct 155 ms 69072 KB Output is correct
65 Correct 117 ms 68156 KB Output is correct
66 Correct 137 ms 69200 KB Output is correct
67 Correct 85 ms 68188 KB Output is correct
68 Correct 122 ms 68676 KB Output is correct
69 Correct 117 ms 69140 KB Output is correct
70 Correct 126 ms 68956 KB Output is correct
71 Correct 86 ms 68552 KB Output is correct
72 Correct 100 ms 69204 KB Output is correct
73 Correct 153 ms 68584 KB Output is correct
74 Correct 184 ms 68840 KB Output is correct
75 Correct 168 ms 68908 KB Output is correct
76 Correct 121 ms 67924 KB Output is correct
77 Correct 163 ms 68472 KB Output is correct
78 Correct 168 ms 68952 KB Output is correct
79 Correct 102 ms 68348 KB Output is correct
80 Correct 99 ms 67720 KB Output is correct
81 Correct 148 ms 68216 KB Output is correct
82 Correct 113 ms 67932 KB Output is correct
83 Correct 160 ms 68492 KB Output is correct
84 Correct 158 ms 68444 KB Output is correct
85 Correct 142 ms 68764 KB Output is correct
86 Correct 170 ms 69052 KB Output is correct
87 Correct 108 ms 68728 KB Output is correct
88 Correct 121 ms 69008 KB Output is correct
89 Correct 78 ms 68068 KB Output is correct
90 Correct 162 ms 69224 KB Output is correct
91 Correct 116 ms 68492 KB Output is correct
92 Correct 101 ms 68436 KB Output is correct
93 Correct 127 ms 68944 KB Output is correct
94 Correct 157 ms 69088 KB Output is correct
95 Correct 131 ms 69004 KB Output is correct
96 Correct 137 ms 69204 KB Output is correct
97 Correct 143 ms 69076 KB Output is correct
98 Correct 116 ms 68444 KB Output is correct
99 Correct 119 ms 68156 KB Output is correct
100 Correct 123 ms 68364 KB Output is correct
101 Correct 150 ms 69068 KB Output is correct
102 Correct 93 ms 69212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 65884 KB Output is correct
2 Correct 16 ms 65884 KB Output is correct
3 Correct 15 ms 65824 KB Output is correct
4 Correct 15 ms 65884 KB Output is correct
5 Correct 16 ms 66220 KB Output is correct
6 Correct 14 ms 65884 KB Output is correct
7 Correct 15 ms 65880 KB Output is correct
8 Correct 14 ms 65884 KB Output is correct
9 Correct 15 ms 65748 KB Output is correct
10 Correct 15 ms 65884 KB Output is correct
11 Correct 15 ms 65884 KB Output is correct
12 Correct 15 ms 65884 KB Output is correct
13 Correct 16 ms 65760 KB Output is correct
14 Correct 17 ms 65884 KB Output is correct
15 Correct 15 ms 65884 KB Output is correct
16 Correct 15 ms 66008 KB Output is correct
17 Correct 15 ms 65884 KB Output is correct
18 Correct 15 ms 65800 KB Output is correct
19 Correct 14 ms 65884 KB Output is correct
20 Correct 14 ms 65884 KB Output is correct
21 Correct 15 ms 65880 KB Output is correct
22 Correct 17 ms 65884 KB Output is correct
23 Correct 14 ms 65996 KB Output is correct
24 Correct 16 ms 65808 KB Output is correct
25 Correct 15 ms 65884 KB Output is correct
26 Correct 14 ms 65764 KB Output is correct
27 Correct 15 ms 66136 KB Output is correct
28 Correct 15 ms 65972 KB Output is correct
29 Correct 15 ms 65816 KB Output is correct
30 Correct 16 ms 65880 KB Output is correct
31 Correct 15 ms 65884 KB Output is correct
32 Correct 15 ms 66016 KB Output is correct
33 Correct 14 ms 65884 KB Output is correct
34 Correct 15 ms 66024 KB Output is correct
35 Correct 15 ms 65884 KB Output is correct
36 Correct 16 ms 66024 KB Output is correct
37 Correct 14 ms 65884 KB Output is correct
38 Correct 16 ms 65884 KB Output is correct
39 Correct 157 ms 69216 KB Output is correct
40 Correct 114 ms 69200 KB Output is correct
41 Correct 134 ms 69096 KB Output is correct
42 Correct 138 ms 68968 KB Output is correct
43 Correct 116 ms 69200 KB Output is correct
44 Correct 123 ms 69196 KB Output is correct
45 Correct 87 ms 68016 KB Output is correct
46 Correct 100 ms 68292 KB Output is correct
47 Correct 117 ms 69148 KB Output is correct
48 Correct 114 ms 69172 KB Output is correct
49 Correct 116 ms 68944 KB Output is correct
50 Correct 126 ms 69204 KB Output is correct
51 Correct 123 ms 68716 KB Output is correct
52 Correct 163 ms 68952 KB Output is correct
53 Correct 99 ms 68956 KB Output is correct
54 Correct 96 ms 69244 KB Output is correct
55 Correct 750 ms 76788 KB Output is correct
56 Correct 561 ms 74696 KB Output is correct
57 Correct 836 ms 77936 KB Output is correct
58 Correct 434 ms 74864 KB Output is correct
59 Correct 483 ms 75092 KB Output is correct
60 Correct 670 ms 78160 KB Output is correct
61 Correct 446 ms 76084 KB Output is correct
62 Correct 465 ms 74108 KB Output is correct
63 Correct 935 ms 77136 KB Output is correct
64 Correct 856 ms 83144 KB Output is correct
65 Correct 641 ms 84156 KB Output is correct
66 Correct 589 ms 84056 KB Output is correct
67 Correct 642 ms 84004 KB Output is correct
68 Correct 682 ms 84004 KB Output is correct
69 Correct 753 ms 84064 KB Output is correct
70 Correct 717 ms 83940 KB Output is correct
71 Correct 683 ms 83796 KB Output is correct
72 Correct 675 ms 84016 KB Output is correct
73 Correct 679 ms 84052 KB Output is correct
74 Correct 703 ms 83932 KB Output is correct
75 Correct 724 ms 84052 KB Output is correct
76 Correct 696 ms 83928 KB Output is correct
77 Correct 711 ms 83936 KB Output is correct
78 Correct 687 ms 84264 KB Output is correct
79 Correct 696 ms 83172 KB Output is correct
80 Correct 699 ms 83556 KB Output is correct
81 Correct 505 ms 85076 KB Output is correct
82 Correct 135 ms 68724 KB Output is correct
83 Correct 96 ms 68460 KB Output is correct
84 Correct 67 ms 67852 KB Output is correct
85 Correct 80 ms 68556 KB Output is correct
86 Correct 113 ms 68944 KB Output is correct
87 Correct 114 ms 69076 KB Output is correct
88 Correct 127 ms 69076 KB Output is correct
89 Correct 134 ms 69076 KB Output is correct
90 Correct 132 ms 68948 KB Output is correct
91 Correct 155 ms 69072 KB Output is correct
92 Correct 117 ms 68156 KB Output is correct
93 Correct 137 ms 69200 KB Output is correct
94 Correct 85 ms 68188 KB Output is correct
95 Correct 122 ms 68676 KB Output is correct
96 Correct 117 ms 69140 KB Output is correct
97 Correct 126 ms 68956 KB Output is correct
98 Correct 86 ms 68552 KB Output is correct
99 Correct 100 ms 69204 KB Output is correct
100 Correct 153 ms 68584 KB Output is correct
101 Correct 184 ms 68840 KB Output is correct
102 Correct 168 ms 68908 KB Output is correct
103 Correct 121 ms 67924 KB Output is correct
104 Correct 163 ms 68472 KB Output is correct
105 Correct 168 ms 68952 KB Output is correct
106 Correct 102 ms 68348 KB Output is correct
107 Correct 99 ms 67720 KB Output is correct
108 Correct 148 ms 68216 KB Output is correct
109 Correct 113 ms 67932 KB Output is correct
110 Correct 160 ms 68492 KB Output is correct
111 Correct 158 ms 68444 KB Output is correct
112 Correct 142 ms 68764 KB Output is correct
113 Correct 170 ms 69052 KB Output is correct
114 Correct 108 ms 68728 KB Output is correct
115 Correct 121 ms 69008 KB Output is correct
116 Correct 78 ms 68068 KB Output is correct
117 Correct 162 ms 69224 KB Output is correct
118 Correct 116 ms 68492 KB Output is correct
119 Correct 101 ms 68436 KB Output is correct
120 Correct 127 ms 68944 KB Output is correct
121 Correct 157 ms 69088 KB Output is correct
122 Correct 131 ms 69004 KB Output is correct
123 Correct 137 ms 69204 KB Output is correct
124 Correct 143 ms 69076 KB Output is correct
125 Correct 116 ms 68444 KB Output is correct
126 Correct 119 ms 68156 KB Output is correct
127 Correct 123 ms 68364 KB Output is correct
128 Correct 150 ms 69068 KB Output is correct
129 Correct 93 ms 69212 KB Output is correct
130 Correct 794 ms 84308 KB Output is correct
131 Correct 595 ms 79380 KB Output is correct
132 Correct 847 ms 84532 KB Output is correct
133 Correct 601 ms 84052 KB Output is correct
134 Correct 541 ms 82260 KB Output is correct
135 Correct 678 ms 85052 KB Output is correct
136 Correct 922 ms 84076 KB Output is correct
137 Correct 917 ms 84060 KB Output is correct
138 Correct 633 ms 84728 KB Output is correct
139 Correct 688 ms 84820 KB Output is correct
140 Correct 704 ms 84820 KB Output is correct
141 Correct 706 ms 84648 KB Output is correct
142 Correct 705 ms 84888 KB Output is correct
143 Correct 716 ms 84724 KB Output is correct
144 Correct 686 ms 84560 KB Output is correct
145 Correct 704 ms 84920 KB Output is correct
146 Correct 721 ms 84620 KB Output is correct
147 Correct 738 ms 84604 KB Output is correct
148 Correct 710 ms 84704 KB Output is correct
149 Correct 723 ms 84620 KB Output is correct
150 Correct 583 ms 80700 KB Output is correct
151 Correct 723 ms 84188 KB Output is correct
152 Correct 777 ms 84176 KB Output is correct
153 Correct 537 ms 85828 KB Output is correct