#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep2(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); --i)
#define all(v) begin(v), end(v)
#define rall(v) rbegin(v), rend(v)
using namespace std;
using ll = long long;
template<class T, class U> bool chmin(T& a, const U& b) { return a > b ? a = b, true : false; }
template<class T, class U> bool chmax(T& a, const U& b) { return a < b ? a = b, true : false; }
using namespace std;
constexpr ll inf = 1e18;
ll gcd(ll a, ll b) {
a = abs(a); b = abs(b);
while (b) {
a %= b;
swap(a, b);
}
return a;
}
int main() {
int M; cin >> M;
ll L; cin >> L;
vector<ll> A(2 * M + 1);
rep (i, 2 * M + 1) cin >> A[i];
if (L < 0) {
reverse(all(A));
L = -L;
}
ll sml = 0, smr = 0;
rep (i, 2 * M + 1) {
if (i < M) sml += A[i] * (i - M);
if (i > M) smr += A[i] * (i - M);
}
if (L < sml || smr < L) {
puts("impossible");
return 0;
}
vector<pair<int, ll>> B;
vector<pair<int, ll>> C;
rep (i, 2 * M + 1) {
if (i == M) continue;
if (A[i] == 0) continue;
if (A[i] <= M) B.emplace_back(i - M, A[i]);
else C.emplace_back(i - M, A[i]);
}
sml = smr = 0;
for (auto [x, y] : B) {
if (x < 0) sml += x * y;
else smr += x * y;
}
auto calc_dp = [](vector<pair<int, ll>> B) -> vector<ll> {
ll sml = 0, smr = 0;
for (auto [x, y] : B) {
if (x < 0) sml += x * y;
else smr += x * y;
}
vector<ll> dp(smr - sml + 1, -inf);
dp[0 - sml] = 0;
for (auto [x, y] : B) {
int ax = abs(x);
vector<ll> memo;
vector<ll> res;
deque<int> st;
rep (i, ax) {
// mod x ごとにスライド最大値の形になる
memo.clear();
for (int j = i; j <= smr - sml; j += ax) {
memo.push_back(dp[j]);
}
res.assign(memo.size(), -inf);
st.clear();
if (x > 0) {
rep (i, memo.size()) memo[i] -= i;
rep (i, res.size()) {
while (!st.empty() && st.front() < i - y) st.pop_front();
while (!st.empty() && memo[st.back()] < memo[i]) st.pop_back();
st.push_back(i);
res[i] = memo[st.front()] + i;
}
}
else {
rep (i, memo.size()) memo[i] += i;
rrep (i, res.size()) {
while (!st.empty() && st.front() > i + y) st.pop_front();
while (!st.empty() && memo[st.back()] < memo[i]) st.pop_back();
st.push_back(i);
res[i] = memo[st.front()] - i;
}
}
rep (j, res.size()) dp[j * ax + i] = res[j];
}
}
return dp;
};
auto dp = calc_dp(B);
if (C.empty()) {
if (dp[L - sml] >= 0) {
cout << dp[L - sml] + A[M] << endl;
}
else {
puts("impossible");
}
return 0;
}
if (C.size() <= 1) {
auto [x, y] = C[0];
ll lo = 0, hi = x * y;
if (lo > hi) swap(lo, hi);
ll ans = -inf;
rep (i, smr - sml + 1) {
if (dp[i] < 0) continue;
if (L < (i + sml) + lo || (i + sml) + hi < L) continue;
if ((L - (i + sml)) % x) continue;
chmax(ans, dp[i] + A[M] + abs((L - (i + sml)) / x));
}
if (ans >= 0) {
cout << ans << endl;
}
else {
puts("impossible");
}
return 0;
}
auto calc_dp2 = [](vector<pair<int, ll>> B) -> vector<vector<ll>> {
ll sml = 0, smr = 0;
for (auto [x, y] : B) {
if (x < 0) sml += x * y;
else smr += x * y;
}
vector<ll> dp(smr - sml + 1, -inf);
dp[0 - sml] = 0;
vector<vector<ll>> ans{dp};
for (auto [x, y] : B) {
int ax = abs(x);
vector<ll> memo;
vector<ll> res;
deque<int> st;
rep (i, ax) {
// mod x ごとにスライド最大値の形になる
memo.clear();
for (int j = i; j <= smr - sml; j += ax) {
memo.push_back(dp[j]);
}
res.assign(memo.size(), -inf);
st.clear();
if (x > 0) {
rep (i, memo.size()) memo[i] -= i;
rep (i, res.size()) {
while (!st.empty() && st.front() < i - y) st.pop_front();
while (!st.empty() && memo[st.back()] < memo[i]) st.pop_back();
st.push_back(i);
res[i] = memo[st.front()] + i;
}
}
else {
rep (i, memo.size()) memo[i] += i;
rrep (i, res.size()) {
while (!st.empty() && st.front() > i + y) st.pop_front();
while (!st.empty() && memo[st.back()] < memo[i]) st.pop_back();
st.push_back(i);
res[i] = memo[st.front()] - i;
}
}
rep (j, res.size()) dp[j * ax + i] = res[j];
}
ans.push_back(dp);
}
reverse(all(ans));
return ans;
};
ll ans = -inf;
vector<ll> g(C.size() + 1);
rrep (i, C.size()) g[i] = gcd(g[i + 1], C[i].first);
vector<pair<int, ll>> D;
rrep (i, C.size()) D.emplace_back(C[i].first, min<ll>(C[i].second, 2 * M));
auto dp2 = calc_dp2(D);
rep (i, smr - sml + 1) {
if (dp[i] < 0) continue;
ll L2 = L - (i + sml);
if (L2 % g[0]) continue;
ll sm = dp[i] + A[M];
int m = -1;
rep (j, C.size() - 1) {
ll tmp = C[j].second;
while ((L2 - tmp * C[j].first) % g[j + 1]) --tmp;
assert(tmp >= 0);
if ((L2 - tmp * C[j].first) / g[j + 1] < M * M) {
m = j;
break;
}
sm += tmp;
L2 -= tmp * C[j].first;
}
if (m == -1) {
assert(L2 % C.back().first == 0);
ll tmp = L2 / C.back().first;
if (tmp > C.back().second) continue;
sm += tmp;
chmax(ans, sm);
}
else {
vector<pair<int, ll>> D;
rep2 (j, m + 1, C.size()) D.emplace_back(C[j].first, min<ll>(C[j].second, 2 * M));
ll sml2 = 0, smr2 = 0;
for (auto [x, y] : D) {
if (x < 0) sml2 += x * y;
else smr2 += x * y;
}
rep (j, smr2 - sml2 + 1) {
if (dp2[m + 1][j] < 0) continue;
ll L3 = L2 - (j + sml2);
ll sm2 = sm + dp2[m + 1][j];
if (L3 % C[m].first) continue;
ll tmp = L3 / C[m].first;
if (tmp > C[m].second) continue;
if (tmp < 0) continue;
sm2 += tmp;
chmax(ans, sm2);
}
}
}
if (ans >= 0) {
cout << ans << endl;
}
else {
puts("impossible");
}
}
/*
フロベニウスの硬貨問題 : 互いに素な a,b で作れない最大の値は ab-a-b
x 以下を全て使う払い方があれば、それを必ず採用するとして良い (x 以下を使わない代わりに x 以上を使うのは明らかに少なくなる)
の 2 つから、 L-M^2 を超えない範囲で小さい方から選べるだけ選ぶ戦略が取れる
互いに素じゃない場合が面倒くさい
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
50 ms |
2532 KB |
Output is correct |
7 |
Correct |
10 ms |
860 KB |
Output is correct |
8 |
Correct |
48 ms |
1856 KB |
Output is correct |
9 |
Correct |
93 ms |
3284 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
50 ms |
2532 KB |
Output is correct |
7 |
Correct |
10 ms |
860 KB |
Output is correct |
8 |
Correct |
48 ms |
1856 KB |
Output is correct |
9 |
Correct |
93 ms |
3284 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
45 ms |
2436 KB |
Output is correct |
18 |
Correct |
9 ms |
856 KB |
Output is correct |
19 |
Correct |
40 ms |
1964 KB |
Output is correct |
20 |
Correct |
88 ms |
3316 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
0 ms |
348 KB |
Output is correct |
24 |
Correct |
722 ms |
12452 KB |
Output is correct |
25 |
Correct |
111 ms |
2700 KB |
Output is correct |
26 |
Correct |
1408 ms |
23976 KB |
Output is correct |
27 |
Correct |
1411 ms |
23960 KB |
Output is correct |
28 |
Correct |
1 ms |
600 KB |
Output is correct |
29 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
2 ms |
1628 KB |
Output is correct |
3 |
Correct |
0 ms |
604 KB |
Output is correct |
4 |
Correct |
59 ms |
1628 KB |
Output is correct |
5 |
Correct |
45 ms |
1628 KB |
Output is correct |
6 |
Correct |
15 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
2 ms |
740 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
2 ms |
1628 KB |
Output is correct |
3 |
Correct |
0 ms |
604 KB |
Output is correct |
4 |
Correct |
59 ms |
1628 KB |
Output is correct |
5 |
Correct |
45 ms |
1628 KB |
Output is correct |
6 |
Correct |
15 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
2 ms |
740 KB |
Output is correct |
11 |
Correct |
1 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
2 ms |
1628 KB |
Output is correct |
16 |
Correct |
0 ms |
604 KB |
Output is correct |
17 |
Correct |
68 ms |
1624 KB |
Output is correct |
18 |
Correct |
44 ms |
1624 KB |
Output is correct |
19 |
Correct |
14 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
344 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
860 KB |
Output is correct |
24 |
Incorrect |
9 ms |
6908 KB |
Output isn't correct |
25 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
2 ms |
1628 KB |
Output is correct |
3 |
Correct |
0 ms |
604 KB |
Output is correct |
4 |
Correct |
59 ms |
1628 KB |
Output is correct |
5 |
Correct |
45 ms |
1628 KB |
Output is correct |
6 |
Correct |
15 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
2 ms |
740 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
2 ms |
1628 KB |
Output is correct |
13 |
Correct |
0 ms |
604 KB |
Output is correct |
14 |
Correct |
68 ms |
1644 KB |
Output is correct |
15 |
Correct |
45 ms |
1628 KB |
Output is correct |
16 |
Correct |
15 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
860 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
13 ms |
5388 KB |
Output is correct |
24 |
Correct |
5 ms |
3652 KB |
Output is correct |
25 |
Correct |
13 ms |
7544 KB |
Output is correct |
26 |
Correct |
2773 ms |
11084 KB |
Output is correct |
27 |
Correct |
1998 ms |
6272 KB |
Output is correct |
28 |
Correct |
36 ms |
7652 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
50 ms |
2532 KB |
Output is correct |
7 |
Correct |
10 ms |
860 KB |
Output is correct |
8 |
Correct |
48 ms |
1856 KB |
Output is correct |
9 |
Correct |
93 ms |
3284 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
2 ms |
1628 KB |
Output is correct |
14 |
Correct |
0 ms |
604 KB |
Output is correct |
15 |
Correct |
59 ms |
1628 KB |
Output is correct |
16 |
Correct |
45 ms |
1628 KB |
Output is correct |
17 |
Correct |
15 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
2 ms |
740 KB |
Output is correct |
22 |
Correct |
1 ms |
344 KB |
Output is correct |
23 |
Correct |
0 ms |
348 KB |
Output is correct |
24 |
Correct |
0 ms |
348 KB |
Output is correct |
25 |
Correct |
0 ms |
348 KB |
Output is correct |
26 |
Correct |
2 ms |
1628 KB |
Output is correct |
27 |
Correct |
0 ms |
604 KB |
Output is correct |
28 |
Correct |
68 ms |
1624 KB |
Output is correct |
29 |
Correct |
44 ms |
1624 KB |
Output is correct |
30 |
Correct |
14 ms |
348 KB |
Output is correct |
31 |
Correct |
1 ms |
344 KB |
Output is correct |
32 |
Correct |
0 ms |
348 KB |
Output is correct |
33 |
Correct |
1 ms |
348 KB |
Output is correct |
34 |
Correct |
1 ms |
860 KB |
Output is correct |
35 |
Incorrect |
9 ms |
6908 KB |
Output isn't correct |
36 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
2 ms |
1628 KB |
Output is correct |
3 |
Correct |
0 ms |
604 KB |
Output is correct |
4 |
Correct |
59 ms |
1628 KB |
Output is correct |
5 |
Correct |
45 ms |
1628 KB |
Output is correct |
6 |
Correct |
15 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
2 ms |
740 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
2 ms |
1628 KB |
Output is correct |
13 |
Correct |
0 ms |
604 KB |
Output is correct |
14 |
Correct |
68 ms |
1644 KB |
Output is correct |
15 |
Correct |
45 ms |
1628 KB |
Output is correct |
16 |
Correct |
15 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
860 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
13 ms |
5388 KB |
Output is correct |
24 |
Correct |
5 ms |
3652 KB |
Output is correct |
25 |
Correct |
13 ms |
7544 KB |
Output is correct |
26 |
Correct |
2773 ms |
11084 KB |
Output is correct |
27 |
Correct |
1998 ms |
6272 KB |
Output is correct |
28 |
Correct |
36 ms |
7652 KB |
Output is correct |
29 |
Correct |
0 ms |
348 KB |
Output is correct |
30 |
Correct |
2 ms |
1628 KB |
Output is correct |
31 |
Correct |
0 ms |
604 KB |
Output is correct |
32 |
Correct |
59 ms |
1648 KB |
Output is correct |
33 |
Correct |
44 ms |
1628 KB |
Output is correct |
34 |
Correct |
14 ms |
344 KB |
Output is correct |
35 |
Correct |
0 ms |
348 KB |
Output is correct |
36 |
Correct |
0 ms |
348 KB |
Output is correct |
37 |
Correct |
1 ms |
348 KB |
Output is correct |
38 |
Correct |
1 ms |
860 KB |
Output is correct |
39 |
Correct |
0 ms |
436 KB |
Output is correct |
40 |
Correct |
0 ms |
348 KB |
Output is correct |
41 |
Correct |
13 ms |
5620 KB |
Output is correct |
42 |
Correct |
5 ms |
3656 KB |
Output is correct |
43 |
Correct |
14 ms |
7340 KB |
Output is correct |
44 |
Correct |
2780 ms |
11084 KB |
Output is correct |
45 |
Correct |
2024 ms |
6272 KB |
Output is correct |
46 |
Correct |
37 ms |
7656 KB |
Output is correct |
47 |
Correct |
1 ms |
604 KB |
Output is correct |
48 |
Correct |
1 ms |
348 KB |
Output is correct |
49 |
Correct |
221 ms |
91212 KB |
Output is correct |
50 |
Correct |
48 ms |
20080 KB |
Output is correct |
51 |
Execution timed out |
5073 ms |
139392 KB |
Time limit exceeded |
52 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
50 ms |
2532 KB |
Output is correct |
7 |
Correct |
10 ms |
860 KB |
Output is correct |
8 |
Correct |
48 ms |
1856 KB |
Output is correct |
9 |
Correct |
93 ms |
3284 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
45 ms |
2436 KB |
Output is correct |
18 |
Correct |
9 ms |
856 KB |
Output is correct |
19 |
Correct |
40 ms |
1964 KB |
Output is correct |
20 |
Correct |
88 ms |
3316 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
0 ms |
348 KB |
Output is correct |
24 |
Correct |
722 ms |
12452 KB |
Output is correct |
25 |
Correct |
111 ms |
2700 KB |
Output is correct |
26 |
Correct |
1408 ms |
23976 KB |
Output is correct |
27 |
Correct |
1411 ms |
23960 KB |
Output is correct |
28 |
Correct |
1 ms |
600 KB |
Output is correct |
29 |
Correct |
1 ms |
348 KB |
Output is correct |
30 |
Correct |
0 ms |
348 KB |
Output is correct |
31 |
Correct |
2 ms |
1628 KB |
Output is correct |
32 |
Correct |
0 ms |
604 KB |
Output is correct |
33 |
Correct |
59 ms |
1628 KB |
Output is correct |
34 |
Correct |
45 ms |
1628 KB |
Output is correct |
35 |
Correct |
15 ms |
348 KB |
Output is correct |
36 |
Correct |
0 ms |
348 KB |
Output is correct |
37 |
Correct |
0 ms |
348 KB |
Output is correct |
38 |
Correct |
1 ms |
348 KB |
Output is correct |
39 |
Correct |
2 ms |
740 KB |
Output is correct |
40 |
Correct |
1 ms |
344 KB |
Output is correct |
41 |
Correct |
0 ms |
348 KB |
Output is correct |
42 |
Correct |
0 ms |
348 KB |
Output is correct |
43 |
Correct |
0 ms |
348 KB |
Output is correct |
44 |
Correct |
2 ms |
1628 KB |
Output is correct |
45 |
Correct |
0 ms |
604 KB |
Output is correct |
46 |
Correct |
68 ms |
1624 KB |
Output is correct |
47 |
Correct |
44 ms |
1624 KB |
Output is correct |
48 |
Correct |
14 ms |
348 KB |
Output is correct |
49 |
Correct |
1 ms |
344 KB |
Output is correct |
50 |
Correct |
0 ms |
348 KB |
Output is correct |
51 |
Correct |
1 ms |
348 KB |
Output is correct |
52 |
Correct |
1 ms |
860 KB |
Output is correct |
53 |
Incorrect |
9 ms |
6908 KB |
Output isn't correct |
54 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
2 ms |
1628 KB |
Output is correct |
3 |
Correct |
0 ms |
604 KB |
Output is correct |
4 |
Correct |
59 ms |
1628 KB |
Output is correct |
5 |
Correct |
45 ms |
1628 KB |
Output is correct |
6 |
Correct |
15 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
2 ms |
740 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
2 ms |
1628 KB |
Output is correct |
13 |
Correct |
0 ms |
604 KB |
Output is correct |
14 |
Correct |
68 ms |
1644 KB |
Output is correct |
15 |
Correct |
45 ms |
1628 KB |
Output is correct |
16 |
Correct |
15 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
860 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
13 ms |
5388 KB |
Output is correct |
24 |
Correct |
5 ms |
3652 KB |
Output is correct |
25 |
Correct |
13 ms |
7544 KB |
Output is correct |
26 |
Correct |
2773 ms |
11084 KB |
Output is correct |
27 |
Correct |
1998 ms |
6272 KB |
Output is correct |
28 |
Correct |
36 ms |
7652 KB |
Output is correct |
29 |
Correct |
0 ms |
348 KB |
Output is correct |
30 |
Correct |
2 ms |
1628 KB |
Output is correct |
31 |
Correct |
0 ms |
604 KB |
Output is correct |
32 |
Correct |
59 ms |
1648 KB |
Output is correct |
33 |
Correct |
44 ms |
1628 KB |
Output is correct |
34 |
Correct |
14 ms |
344 KB |
Output is correct |
35 |
Correct |
0 ms |
348 KB |
Output is correct |
36 |
Correct |
0 ms |
348 KB |
Output is correct |
37 |
Correct |
1 ms |
348 KB |
Output is correct |
38 |
Correct |
1 ms |
860 KB |
Output is correct |
39 |
Correct |
0 ms |
436 KB |
Output is correct |
40 |
Correct |
0 ms |
348 KB |
Output is correct |
41 |
Correct |
13 ms |
5620 KB |
Output is correct |
42 |
Correct |
5 ms |
3656 KB |
Output is correct |
43 |
Correct |
14 ms |
7340 KB |
Output is correct |
44 |
Correct |
2780 ms |
11084 KB |
Output is correct |
45 |
Correct |
2024 ms |
6272 KB |
Output is correct |
46 |
Correct |
37 ms |
7656 KB |
Output is correct |
47 |
Correct |
1 ms |
604 KB |
Output is correct |
48 |
Correct |
1 ms |
348 KB |
Output is correct |
49 |
Correct |
221 ms |
91212 KB |
Output is correct |
50 |
Correct |
48 ms |
20080 KB |
Output is correct |
51 |
Execution timed out |
5073 ms |
139392 KB |
Time limit exceeded |
52 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
50 ms |
2532 KB |
Output is correct |
7 |
Correct |
10 ms |
860 KB |
Output is correct |
8 |
Correct |
48 ms |
1856 KB |
Output is correct |
9 |
Correct |
93 ms |
3284 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
45 ms |
2436 KB |
Output is correct |
18 |
Correct |
9 ms |
856 KB |
Output is correct |
19 |
Correct |
40 ms |
1964 KB |
Output is correct |
20 |
Correct |
88 ms |
3316 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
0 ms |
348 KB |
Output is correct |
24 |
Correct |
722 ms |
12452 KB |
Output is correct |
25 |
Correct |
111 ms |
2700 KB |
Output is correct |
26 |
Correct |
1408 ms |
23976 KB |
Output is correct |
27 |
Correct |
1411 ms |
23960 KB |
Output is correct |
28 |
Correct |
1 ms |
600 KB |
Output is correct |
29 |
Correct |
1 ms |
348 KB |
Output is correct |
30 |
Correct |
0 ms |
348 KB |
Output is correct |
31 |
Correct |
2 ms |
1628 KB |
Output is correct |
32 |
Correct |
0 ms |
604 KB |
Output is correct |
33 |
Correct |
59 ms |
1628 KB |
Output is correct |
34 |
Correct |
45 ms |
1628 KB |
Output is correct |
35 |
Correct |
15 ms |
348 KB |
Output is correct |
36 |
Correct |
0 ms |
348 KB |
Output is correct |
37 |
Correct |
0 ms |
348 KB |
Output is correct |
38 |
Correct |
1 ms |
348 KB |
Output is correct |
39 |
Correct |
2 ms |
740 KB |
Output is correct |
40 |
Correct |
1 ms |
344 KB |
Output is correct |
41 |
Correct |
0 ms |
348 KB |
Output is correct |
42 |
Correct |
0 ms |
348 KB |
Output is correct |
43 |
Correct |
0 ms |
348 KB |
Output is correct |
44 |
Correct |
2 ms |
1628 KB |
Output is correct |
45 |
Correct |
0 ms |
604 KB |
Output is correct |
46 |
Correct |
68 ms |
1624 KB |
Output is correct |
47 |
Correct |
44 ms |
1624 KB |
Output is correct |
48 |
Correct |
14 ms |
348 KB |
Output is correct |
49 |
Correct |
1 ms |
344 KB |
Output is correct |
50 |
Correct |
0 ms |
348 KB |
Output is correct |
51 |
Correct |
1 ms |
348 KB |
Output is correct |
52 |
Correct |
1 ms |
860 KB |
Output is correct |
53 |
Incorrect |
9 ms |
6908 KB |
Output isn't correct |
54 |
Halted |
0 ms |
0 KB |
- |