답안 #635843

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
635843 2022-08-27T07:39:31 Z MohammadAghil Watermelon (INOI20_watermelon) C++17
100 / 100
287 ms 13804 KB
#include <bits/stdc++.h>
//#pragma GCC optimize ("Ofast,unroll-loops")
//#pragma GCC target ("avx2")
using namespace std;
 
typedef long long ll;
typedef pair<int, int> pp;
 
#define rep(i,l,r) for(int i = (l); i < (r); i++)
#define per(i,r,l) for(int i = (r); i >= (l); i--)
#define all(x) begin(x), end(x)
#define sz(x) (int)x.size()
#define pb push_back
#define ff first
#define ss second
 
void dbg(){
    cerr << endl;
}
template<typename Head, typename... Tail> void dbg(Head h, Tail... t){
    cerr << " " << h << ",";
    dbg(t...);
}
#define er(...) cerr << __LINE__ << " <" << #__VA_ARGS__ << ">:", dbg(__VA_ARGS__)
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
void IOS(){
    cin.tie(0) -> sync_with_stdio(0);
    // #ifndef ONLINE_JUDGE
    //     freopen("inp.txt", "r", stdin);
    //     freopen("out.txt", "w", stdout);
    // #endif
}

const ll mod = 1e9 + 7, maxn = 1e5 + 5, lg = 20, inf = ll(1e9) + 5;

vector<int> adj[maxn];
int cnt[maxn], n;
 
int fen[maxn];
void upd(int i, int k){
    for(i++; i < maxn; i += i&-i) fen[i] = max(fen[i], k);
}
int get(int i){
    int res = 0;
    for(i++; i; i -= i&-i) res = max(res, fen[i]);
    return res;
}
vector<int> val(vector<int> p){
    vector<int> res(n);
    vector<int> stk;
    per(i,n-1,0){
        while(sz(stk) && p[stk.back()] < p[i]) stk.pop_back();
        if(sz(stk)){
            res[i] = get(stk.back()-1) + 1;
        }else res[i] = inf;
        upd(i, res[i]);
        stk.pb(i);
    }
    int tmp = n;
    rep(i,0,n) res[i] += res[i] == inf? tmp--: 0;
    return res;
}

vector<int> nxt(vector<int> p){
    vector<int> pos(n);
    rep(i,0,n) pos[p[i]] = i;
    rep(i,0,n) cnt[i] = 0;
    set<pp> s;
    int find = -1;
    per(i,n-1,0){
        s.insert({0, pos[i]});
        for(int c: adj[pos[i]]){
            s.erase(pp(cnt[c], c));
            s.insert(pp(++cnt[c], c));
        }
        auto it = s.upper_bound(pp(0, pos[i]));
        if(it != end(s) && it->ff == 0){
            find = i + 1;
            p[it->ss] = i;
            for(int c: adj[it->ss]){
                s.erase(pp(cnt[c], c));
                s.insert(pp(--cnt[c], c));
            }
            s.erase(it);
            break;
        }
    }
    if(find + 1){
        while(sz(s)){
            auto[_, r] = *begin(s);
            s.erase(begin(s));
            p[r] = find++;
            for(int c: adj[r]){
                s.erase(pp(cnt[c], c));
                s.insert(pp(--cnt[c], c));
            }     
        }
        return p;
    }
    return {};
}

int main(){ IOS();
    int k; cin >> n >> k;
    vector<int> a(n);
    int tmp = n;
    rep(i,0,n) {
        cin >> a[i];
        if(a[i] == -1){
            a[i] = inf + tmp, tmp--;
        }
    }

    vector<int> stk;
    rep(i,0,n){
        while(sz(stk) && a[stk.back()] < a[i]) stk.pop_back();
        if(sz(stk)){
            if(a[i] - a[stk.back()]){
                adj[i].pb(stk.back());
                cnt[stk.back()]++;
            } 
        }
        stk.pb(i);
    }
    stk.clear();
    per(i,n-1,0){
        while(sz(stk) && a[stk.back()] < a[i]) stk.pop_back();
        if(sz(stk)){
            adj[i].pb(stk.back());
            cnt[stk.back()]++;
        }
        stk.pb(i);
    }
    
    set<pp> s;
    rep(i,0,n) s.insert({cnt[i], i});
    vector<int> ans(n);
    int ptr = 0;
    while(sz(s) && begin(s)->ff == 0){
        auto[_, r] = *begin(s);
        s.erase(begin(s));
        ans[r] = ptr++;
        for(int c: adj[r]){
            s.erase(pp(cnt[c], c));
            s.insert(pp(--cnt[c], c));
        }
    }
    
    if(sz(s) || val(ans) != a){
        cout << -1 << '\n';
    } else{
        k--;
        while(k--){
            ans = nxt(ans);
            if(ans.empty()) return cout << -1 << '\n', 0;
        }
        rep(i,0,maxn) fen[i] = 0;
        if(val(ans) != a) cout << -1 << '\n';
        else for(int c: ans) cout << ++c << ' '; cout << '\n';
    }
    return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:161:9: warning: this 'else' clause does not guard... [-Wmisleading-indentation]
  161 |         else for(int c: ans) cout << ++c << ' '; cout << '\n';
      |         ^~~~
Main.cpp:161:50: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'else'
  161 |         else for(int c: ans) cout << ++c << ' '; cout << '\n';
      |                                                  ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3028 KB Output is correct
2 Correct 2 ms 3028 KB Output is correct
3 Correct 2 ms 3028 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 1 ms 2644 KB Output is correct
6 Correct 1 ms 2644 KB Output is correct
7 Correct 1 ms 2644 KB Output is correct
8 Correct 2 ms 2644 KB Output is correct
9 Correct 1 ms 2644 KB Output is correct
10 Correct 2 ms 2644 KB Output is correct
11 Correct 1 ms 2644 KB Output is correct
12 Correct 2 ms 3028 KB Output is correct
13 Correct 2 ms 3028 KB Output is correct
14 Correct 2 ms 3028 KB Output is correct
15 Correct 2 ms 3068 KB Output is correct
16 Correct 2 ms 3028 KB Output is correct
17 Correct 2 ms 3028 KB Output is correct
18 Correct 2 ms 2976 KB Output is correct
19 Correct 1 ms 2644 KB Output is correct
20 Correct 2 ms 2644 KB Output is correct
21 Correct 2 ms 2684 KB Output is correct
22 Correct 2 ms 2644 KB Output is correct
23 Correct 2 ms 2644 KB Output is correct
24 Correct 2 ms 2680 KB Output is correct
25 Correct 2 ms 2644 KB Output is correct
26 Correct 2 ms 2644 KB Output is correct
27 Correct 2 ms 2644 KB Output is correct
28 Correct 2 ms 2644 KB Output is correct
29 Correct 2 ms 3028 KB Output is correct
30 Correct 2 ms 3072 KB Output is correct
31 Correct 2 ms 3028 KB Output is correct
32 Correct 2 ms 3064 KB Output is correct
33 Correct 2 ms 3028 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3028 KB Output is correct
2 Correct 2 ms 3028 KB Output is correct
3 Correct 2 ms 3028 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 1 ms 2644 KB Output is correct
6 Correct 1 ms 2644 KB Output is correct
7 Correct 1 ms 2644 KB Output is correct
8 Correct 2 ms 2644 KB Output is correct
9 Correct 1 ms 2644 KB Output is correct
10 Correct 2 ms 2644 KB Output is correct
11 Correct 1 ms 2644 KB Output is correct
12 Correct 2 ms 3028 KB Output is correct
13 Correct 2 ms 3028 KB Output is correct
14 Correct 2 ms 3028 KB Output is correct
15 Correct 2 ms 3068 KB Output is correct
16 Correct 2 ms 3028 KB Output is correct
17 Correct 2 ms 3028 KB Output is correct
18 Correct 2 ms 2976 KB Output is correct
19 Correct 1 ms 2644 KB Output is correct
20 Correct 2 ms 2644 KB Output is correct
21 Correct 2 ms 2684 KB Output is correct
22 Correct 2 ms 2644 KB Output is correct
23 Correct 2 ms 2644 KB Output is correct
24 Correct 2 ms 2680 KB Output is correct
25 Correct 2 ms 2644 KB Output is correct
26 Correct 2 ms 2644 KB Output is correct
27 Correct 2 ms 2644 KB Output is correct
28 Correct 2 ms 2644 KB Output is correct
29 Correct 2 ms 3028 KB Output is correct
30 Correct 2 ms 3072 KB Output is correct
31 Correct 2 ms 3028 KB Output is correct
32 Correct 2 ms 3064 KB Output is correct
33 Correct 2 ms 3028 KB Output is correct
34 Correct 3 ms 3156 KB Output is correct
35 Correct 3 ms 3156 KB Output is correct
36 Correct 3 ms 2772 KB Output is correct
37 Correct 3 ms 2772 KB Output is correct
38 Correct 3 ms 3156 KB Output is correct
39 Correct 3 ms 3196 KB Output is correct
40 Correct 3 ms 3156 KB Output is correct
41 Correct 3 ms 3156 KB Output is correct
42 Correct 4 ms 3196 KB Output is correct
43 Correct 4 ms 3156 KB Output is correct
44 Correct 8 ms 3156 KB Output is correct
45 Correct 5 ms 2900 KB Output is correct
46 Correct 5 ms 3172 KB Output is correct
47 Correct 3 ms 2900 KB Output is correct
48 Correct 3 ms 2900 KB Output is correct
49 Correct 4 ms 2812 KB Output is correct
50 Correct 3 ms 2900 KB Output is correct
51 Correct 3 ms 2772 KB Output is correct
52 Correct 3 ms 2816 KB Output is correct
53 Correct 4 ms 3156 KB Output is correct
54 Correct 4 ms 3156 KB Output is correct
55 Correct 4 ms 2772 KB Output is correct
56 Correct 3 ms 2900 KB Output is correct
57 Correct 4 ms 3156 KB Output is correct
58 Correct 4 ms 3196 KB Output is correct
59 Correct 4 ms 3196 KB Output is correct
60 Correct 4 ms 3156 KB Output is correct
61 Correct 3 ms 3156 KB Output is correct
62 Correct 5 ms 3204 KB Output is correct
63 Correct 3 ms 3196 KB Output is correct
64 Correct 3 ms 3156 KB Output is correct
65 Correct 3 ms 3156 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 44 ms 7804 KB Output is correct
2 Correct 42 ms 7324 KB Output is correct
3 Correct 44 ms 7756 KB Output is correct
4 Correct 46 ms 7324 KB Output is correct
5 Correct 45 ms 7832 KB Output is correct
6 Correct 46 ms 7756 KB Output is correct
7 Correct 44 ms 7756 KB Output is correct
8 Correct 44 ms 7824 KB Output is correct
9 Correct 55 ms 7804 KB Output is correct
10 Correct 45 ms 7836 KB Output is correct
11 Correct 97 ms 12620 KB Output is correct
12 Correct 94 ms 12572 KB Output is correct
13 Correct 103 ms 12612 KB Output is correct
14 Correct 106 ms 12568 KB Output is correct
15 Correct 94 ms 11960 KB Output is correct
16 Correct 88 ms 12028 KB Output is correct
17 Correct 98 ms 12060 KB Output is correct
18 Correct 92 ms 12068 KB Output is correct
19 Correct 93 ms 12044 KB Output is correct
20 Correct 92 ms 12064 KB Output is correct
21 Correct 105 ms 12032 KB Output is correct
22 Correct 104 ms 12064 KB Output is correct
23 Correct 93 ms 12064 KB Output is correct
24 Correct 77 ms 12720 KB Output is correct
25 Correct 89 ms 12692 KB Output is correct
26 Correct 82 ms 12872 KB Output is correct
27 Correct 74 ms 12668 KB Output is correct
28 Correct 76 ms 12688 KB Output is correct
29 Correct 79 ms 12660 KB Output is correct
30 Correct 28 ms 5892 KB Output is correct
31 Correct 36 ms 7768 KB Output is correct
32 Correct 66 ms 11640 KB Output is correct
33 Correct 75 ms 12584 KB Output is correct
34 Correct 8 ms 3924 KB Output is correct
35 Correct 18 ms 4948 KB Output is correct
36 Correct 46 ms 7912 KB Output is correct
37 Correct 79 ms 12556 KB Output is correct
38 Correct 91 ms 12604 KB Output is correct
39 Correct 71 ms 12660 KB Output is correct
40 Correct 110 ms 12764 KB Output is correct
41 Correct 75 ms 12996 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 44 ms 7804 KB Output is correct
2 Correct 42 ms 7324 KB Output is correct
3 Correct 44 ms 7756 KB Output is correct
4 Correct 46 ms 7324 KB Output is correct
5 Correct 45 ms 7832 KB Output is correct
6 Correct 46 ms 7756 KB Output is correct
7 Correct 44 ms 7756 KB Output is correct
8 Correct 44 ms 7824 KB Output is correct
9 Correct 55 ms 7804 KB Output is correct
10 Correct 45 ms 7836 KB Output is correct
11 Correct 97 ms 12620 KB Output is correct
12 Correct 94 ms 12572 KB Output is correct
13 Correct 103 ms 12612 KB Output is correct
14 Correct 106 ms 12568 KB Output is correct
15 Correct 94 ms 11960 KB Output is correct
16 Correct 88 ms 12028 KB Output is correct
17 Correct 98 ms 12060 KB Output is correct
18 Correct 92 ms 12068 KB Output is correct
19 Correct 93 ms 12044 KB Output is correct
20 Correct 92 ms 12064 KB Output is correct
21 Correct 105 ms 12032 KB Output is correct
22 Correct 104 ms 12064 KB Output is correct
23 Correct 93 ms 12064 KB Output is correct
24 Correct 77 ms 12720 KB Output is correct
25 Correct 89 ms 12692 KB Output is correct
26 Correct 82 ms 12872 KB Output is correct
27 Correct 74 ms 12668 KB Output is correct
28 Correct 76 ms 12688 KB Output is correct
29 Correct 79 ms 12660 KB Output is correct
30 Correct 28 ms 5892 KB Output is correct
31 Correct 36 ms 7768 KB Output is correct
32 Correct 66 ms 11640 KB Output is correct
33 Correct 75 ms 12584 KB Output is correct
34 Correct 8 ms 3924 KB Output is correct
35 Correct 18 ms 4948 KB Output is correct
36 Correct 46 ms 7912 KB Output is correct
37 Correct 79 ms 12556 KB Output is correct
38 Correct 91 ms 12604 KB Output is correct
39 Correct 71 ms 12660 KB Output is correct
40 Correct 110 ms 12764 KB Output is correct
41 Correct 75 ms 12996 KB Output is correct
42 Correct 45 ms 7688 KB Output is correct
43 Correct 47 ms 7548 KB Output is correct
44 Correct 50 ms 7424 KB Output is correct
45 Correct 49 ms 7660 KB Output is correct
46 Correct 42 ms 7628 KB Output is correct
47 Correct 42 ms 7564 KB Output is correct
48 Correct 45 ms 7568 KB Output is correct
49 Correct 45 ms 7420 KB Output is correct
50 Correct 46 ms 7372 KB Output is correct
51 Correct 46 ms 7420 KB Output is correct
52 Correct 92 ms 12264 KB Output is correct
53 Correct 94 ms 12156 KB Output is correct
54 Correct 91 ms 12532 KB Output is correct
55 Correct 95 ms 12716 KB Output is correct
56 Correct 68 ms 11664 KB Output is correct
57 Correct 77 ms 12548 KB Output is correct
58 Correct 76 ms 12396 KB Output is correct
59 Correct 90 ms 12236 KB Output is correct
60 Correct 70 ms 12364 KB Output is correct
61 Correct 111 ms 12476 KB Output is correct
62 Correct 130 ms 13804 KB Output is correct
63 Correct 78 ms 12672 KB Output is correct
64 Correct 86 ms 12736 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3028 KB Output is correct
2 Correct 2 ms 3028 KB Output is correct
3 Correct 2 ms 3028 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 1 ms 2644 KB Output is correct
6 Correct 1 ms 2644 KB Output is correct
7 Correct 1 ms 2644 KB Output is correct
8 Correct 2 ms 2644 KB Output is correct
9 Correct 1 ms 2644 KB Output is correct
10 Correct 2 ms 2644 KB Output is correct
11 Correct 1 ms 2644 KB Output is correct
12 Correct 2 ms 3028 KB Output is correct
13 Correct 2 ms 3028 KB Output is correct
14 Correct 2 ms 3028 KB Output is correct
15 Correct 2 ms 3068 KB Output is correct
16 Correct 2 ms 3028 KB Output is correct
17 Correct 2 ms 3028 KB Output is correct
18 Correct 2 ms 2976 KB Output is correct
19 Correct 1 ms 2644 KB Output is correct
20 Correct 2 ms 2644 KB Output is correct
21 Correct 2 ms 2684 KB Output is correct
22 Correct 2 ms 2644 KB Output is correct
23 Correct 2 ms 2644 KB Output is correct
24 Correct 2 ms 2680 KB Output is correct
25 Correct 2 ms 2644 KB Output is correct
26 Correct 2 ms 2644 KB Output is correct
27 Correct 2 ms 2644 KB Output is correct
28 Correct 2 ms 2644 KB Output is correct
29 Correct 2 ms 3028 KB Output is correct
30 Correct 2 ms 3072 KB Output is correct
31 Correct 2 ms 3028 KB Output is correct
32 Correct 2 ms 3064 KB Output is correct
33 Correct 2 ms 3028 KB Output is correct
34 Correct 3 ms 3156 KB Output is correct
35 Correct 3 ms 3156 KB Output is correct
36 Correct 3 ms 2772 KB Output is correct
37 Correct 3 ms 2772 KB Output is correct
38 Correct 3 ms 3156 KB Output is correct
39 Correct 3 ms 3196 KB Output is correct
40 Correct 3 ms 3156 KB Output is correct
41 Correct 3 ms 3156 KB Output is correct
42 Correct 4 ms 3196 KB Output is correct
43 Correct 4 ms 3156 KB Output is correct
44 Correct 8 ms 3156 KB Output is correct
45 Correct 5 ms 2900 KB Output is correct
46 Correct 5 ms 3172 KB Output is correct
47 Correct 3 ms 2900 KB Output is correct
48 Correct 3 ms 2900 KB Output is correct
49 Correct 4 ms 2812 KB Output is correct
50 Correct 3 ms 2900 KB Output is correct
51 Correct 3 ms 2772 KB Output is correct
52 Correct 3 ms 2816 KB Output is correct
53 Correct 4 ms 3156 KB Output is correct
54 Correct 4 ms 3156 KB Output is correct
55 Correct 4 ms 2772 KB Output is correct
56 Correct 3 ms 2900 KB Output is correct
57 Correct 4 ms 3156 KB Output is correct
58 Correct 4 ms 3196 KB Output is correct
59 Correct 4 ms 3196 KB Output is correct
60 Correct 4 ms 3156 KB Output is correct
61 Correct 3 ms 3156 KB Output is correct
62 Correct 5 ms 3204 KB Output is correct
63 Correct 3 ms 3196 KB Output is correct
64 Correct 3 ms 3156 KB Output is correct
65 Correct 3 ms 3156 KB Output is correct
66 Correct 44 ms 7804 KB Output is correct
67 Correct 42 ms 7324 KB Output is correct
68 Correct 44 ms 7756 KB Output is correct
69 Correct 46 ms 7324 KB Output is correct
70 Correct 45 ms 7832 KB Output is correct
71 Correct 46 ms 7756 KB Output is correct
72 Correct 44 ms 7756 KB Output is correct
73 Correct 44 ms 7824 KB Output is correct
74 Correct 55 ms 7804 KB Output is correct
75 Correct 45 ms 7836 KB Output is correct
76 Correct 97 ms 12620 KB Output is correct
77 Correct 94 ms 12572 KB Output is correct
78 Correct 103 ms 12612 KB Output is correct
79 Correct 106 ms 12568 KB Output is correct
80 Correct 94 ms 11960 KB Output is correct
81 Correct 88 ms 12028 KB Output is correct
82 Correct 98 ms 12060 KB Output is correct
83 Correct 92 ms 12068 KB Output is correct
84 Correct 93 ms 12044 KB Output is correct
85 Correct 92 ms 12064 KB Output is correct
86 Correct 105 ms 12032 KB Output is correct
87 Correct 104 ms 12064 KB Output is correct
88 Correct 93 ms 12064 KB Output is correct
89 Correct 77 ms 12720 KB Output is correct
90 Correct 89 ms 12692 KB Output is correct
91 Correct 82 ms 12872 KB Output is correct
92 Correct 74 ms 12668 KB Output is correct
93 Correct 76 ms 12688 KB Output is correct
94 Correct 79 ms 12660 KB Output is correct
95 Correct 28 ms 5892 KB Output is correct
96 Correct 36 ms 7768 KB Output is correct
97 Correct 66 ms 11640 KB Output is correct
98 Correct 75 ms 12584 KB Output is correct
99 Correct 8 ms 3924 KB Output is correct
100 Correct 18 ms 4948 KB Output is correct
101 Correct 46 ms 7912 KB Output is correct
102 Correct 79 ms 12556 KB Output is correct
103 Correct 91 ms 12604 KB Output is correct
104 Correct 71 ms 12660 KB Output is correct
105 Correct 110 ms 12764 KB Output is correct
106 Correct 75 ms 12996 KB Output is correct
107 Correct 45 ms 7688 KB Output is correct
108 Correct 47 ms 7548 KB Output is correct
109 Correct 50 ms 7424 KB Output is correct
110 Correct 49 ms 7660 KB Output is correct
111 Correct 42 ms 7628 KB Output is correct
112 Correct 42 ms 7564 KB Output is correct
113 Correct 45 ms 7568 KB Output is correct
114 Correct 45 ms 7420 KB Output is correct
115 Correct 46 ms 7372 KB Output is correct
116 Correct 46 ms 7420 KB Output is correct
117 Correct 92 ms 12264 KB Output is correct
118 Correct 94 ms 12156 KB Output is correct
119 Correct 91 ms 12532 KB Output is correct
120 Correct 95 ms 12716 KB Output is correct
121 Correct 68 ms 11664 KB Output is correct
122 Correct 77 ms 12548 KB Output is correct
123 Correct 76 ms 12396 KB Output is correct
124 Correct 90 ms 12236 KB Output is correct
125 Correct 70 ms 12364 KB Output is correct
126 Correct 111 ms 12476 KB Output is correct
127 Correct 130 ms 13804 KB Output is correct
128 Correct 78 ms 12672 KB Output is correct
129 Correct 86 ms 12736 KB Output is correct
130 Correct 2 ms 3068 KB Output is correct
131 Correct 2 ms 3028 KB Output is correct
132 Correct 2 ms 2644 KB Output is correct
133 Correct 92 ms 12260 KB Output is correct
134 Correct 92 ms 12236 KB Output is correct
135 Correct 99 ms 12260 KB Output is correct
136 Correct 113 ms 12544 KB Output is correct
137 Correct 103 ms 12580 KB Output is correct
138 Correct 94 ms 12616 KB Output is correct
139 Correct 94 ms 12608 KB Output is correct
140 Correct 95 ms 12612 KB Output is correct
141 Correct 95 ms 12608 KB Output is correct
142 Correct 110 ms 12280 KB Output is correct
143 Correct 103 ms 12268 KB Output is correct
144 Correct 75 ms 12632 KB Output is correct
145 Correct 69 ms 11640 KB Output is correct
146 Correct 103 ms 12316 KB Output is correct
147 Correct 131 ms 12232 KB Output is correct
148 Correct 237 ms 12548 KB Output is correct
149 Correct 287 ms 12508 KB Output is correct
150 Correct 184 ms 12512 KB Output is correct
151 Correct 117 ms 12620 KB Output is correct
152 Correct 148 ms 12644 KB Output is correct
153 Correct 99 ms 13132 KB Output is correct
154 Correct 83 ms 13188 KB Output is correct
155 Correct 77 ms 13192 KB Output is correct
156 Correct 78 ms 13256 KB Output is correct
157 Correct 90 ms 13236 KB Output is correct
158 Correct 93 ms 13172 KB Output is correct
159 Correct 81 ms 13176 KB Output is correct
160 Correct 81 ms 13172 KB Output is correct