QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#469143 | #8889. Ice Cream Machines | Lynkcat# | 52 | 27ms | 18004kb | C++20 | 4.4kb | 2024-07-09 14:53:36 | 2024-07-09 14:53:36 |
Judging History
answer
#include<bits/stdc++.h>
#define poly vector<int>
#define IOS ios::sync_with_stdio(false)
#define ll long long
#define mp make_pair
#define mt make_tuple
#define pa pair < int,int >
#define fi first
#define se second
#define mod 998244353
#define sz(x) (int)((x).size())
#define all(x) begin(x), end(x)
#ifdef local
#include <experimental/iterator>
#define safe cerr << __PRETTY_FUNCTION__ << " line " << __LINE__ << " safe\n"
#define debug(a...) debug_(#a, a)
#define orange(a...) orange_(#a, a)
void debug_(const char *s, auto ...a) {
cerr << "\e[1;32m(" << s << ") = (";
int f = 0;
(..., (cerr << (f++ ? ", " : "") << a));
cerr << ")\e[0m\n";
}
void orange_(const char *s, auto L, auto R) {
cerr << "\e[1;33m[ " << s << " ] = [ ";
using namespace experimental;
copy(L, R, make_ostream_joiner(cerr, ", "));
cerr << " ]\e[0m\n";
}
#else
#define safe ((void)0)
#define debug(...) safe
#define orange(...) safe
#endif
// #define int ll
//#define N
using namespace std;
const ll M=1000005,N=1000005,inf=1e13;
int cnt=1;
int n,m,S,T,ans;
int K;
int w[N];
int vis[N];
template <typename F, typename C> class MCMF {
static constexpr F INF_F = numeric_limits<F>::max() / 3;
static constexpr C INF_C = numeric_limits<C>::max() / 3;
struct E {
int to, r;
F f; C c;
E() {}
E(int a, int b, F x, C y)
: to(a), r(b), f(x), c(y) {}
};
int n;
array<vector<E>, 500005> g;
vector<pair<int, int>> f;
vector<bool> inq;
vector<F> up; vector<C> d, h;
optional<pair<F, C>> step(int S, int T) {
safe;
debug(S, T);
priority_queue<pair<C, int>> q;
q.emplace(d[S] = 0, S), up[S] = INF_F;
while (not q.empty()) {
auto [l, u] = q.top(); q.pop();
debug(u, l, -d[u]);
assert(-l >= d[u]);
assert(up[u] != 0);
if (l != -d[u]) continue;
for (int i = 0; i < int(g[u].size()); ++i) {
auto e = g[u][i]; int v = e.to;
debug(u, v, e.c + h[u] - h[v]);
if (e.f > 0)
assert(e.c + h[u] - h[v] >= 0);
auto nd = d[u] + e.c + h[u] - h[v];
if (e.f <= 0 or d[v] <= nd) continue;
f[v] = {u, i}; up[v] = min(up[u], e.f);
q.emplace(-(d[v] = nd), v);
}
}
if (d[T] == INF_C) return nullopt;
for (size_t i = 0; i < d.size(); ++i)
h[i] += d[i];
for (int i = T; i != S; i = f[i].first) {
auto &eg = g[f[i].first][f[i].second];
eg.f -= up[T]; g[eg.to][eg.r].f += up[T];
}
return pair{up[T], h[T]};
}
void precalc(int a) {
d[a] = 0;
for (int _ = 0; _ <= n; _++) {
bool flag = false;
for (int u = 0; u < n; u++)
if (d[u] != INF_C)
for (int i = 0; i < int(g[u].size()); ++i) {
auto e = g[u][i]; int v = e.to;
auto nd = d[u] + e.c;
if (e.f <= 0 or d[v] <= nd) continue;
d[v] = nd;
flag = true;
}
if (_ == n) assert(!flag);
if (!flag)
break;
}
orange(all(d));
assert(h.size() == d.size());
for (size_t i = 0; i < d.size(); ++i)
h[i] = d[i];
debug(INF_C);
fill(d.begin(), d.end(), INF_C);
}
public:
MCMF(int n_) : n(n_), f(n), inq(n), up(n), d(n, INF_C), h(n) {}
void add_edge(int s, int t, F c, C w) {
g[s].emplace_back(t, int(g[t].size()), c, w);
g[t].emplace_back(s, int(g[s].size()) - 1, 0, -w);
}
pair<F, C> solve(int a, int b) {
precalc(a);
F c = 0; C w = 0;
while (auto r = step(a, b)) {
c += r->first, w += r->first * r->second;
fill(d.begin(), d.end(), INF_C);
}
return {c, w};
}
};
mt19937_64 rnd(time(0));
void BellaKira()
{
cin>>K>>n>>m;
for (int i=1;i<=n;i++) w[i]=1;
MCMF<ll,ll> mcmf(2 * K + 2);
S=0,T=2*K+1;
mcmf.add_edge(0,1,m,0);
ll coef=0;
for (int i=1;i<=K;i++)
{
int x; cin>>x;
mcmf.add_edge(2*i-1,2*i,1,-inf);
mcmf.add_edge(2*i-1,2*i,m,0);
if (vis[x]) mcmf.add_edge(vis[x],2*i-1,1,-w[x]);
if (i+1<=K)
mcmf.add_edge(2*i,2*i+1,m,0);
vis[x]=2*i;
coef+=w[x];
}
mcmf.add_edge(K+K,T,m,0);
ll MC=mcmf.solve(0,2*K+1).se;
cout<<MC+inf*K+coef<<'\n';
}
signed main()
{
IOS;
cin.tie(0);
int T=1;
while (T--)
{
BellaKira();
}
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 7
Accepted
Test #1:
score: 7
Accepted
time: 0ms
memory: 17704kb
input:
1000 10 1 3 6 6 8 4 7 4 10 1 6 6 2 1 8 4 10 5 9 3 4 7 5 9 6 2 8 8 7 1 1 1 9 8 6 4 6 5 4 8 8 2 3 1 7 7 10 4 10 5 5 2 7 5 1 6 8 7 9 10 4 9 2 4 5 7 8 10 9 1 5 1 7 10 4 10 10 5 10 10 10 5 3 5 5 7 4 6 6 10 6 9 5 6 3 3 3 7 10 7 4 5 10 6 4 2 4 8 7 6 9 7 5 6 9 9 7 4 5 8 8 10 6 1 4 9 3 9 10 1 7 3 4 8 1 3 9 5...
output:
899
result:
ok 1 number(s): "899"
Test #2:
score: 0
Accepted
time: 3ms
memory: 17764kb
input:
1000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
1
result:
ok 1 number(s): "1"
Test #3:
score: 0
Accepted
time: 3ms
memory: 17828kb
input:
751 8 1 8 6 5 4 7 8 2 6 4 7 4 2 2 5 3 7 7 3 7 2 5 3 4 8 6 8 1 4 3 8 4 1 3 3 5 3 6 6 8 8 1 4 6 8 8 3 5 7 5 7 1 1 1 2 8 1 8 6 4 5 1 2 7 5 5 5 7 4 3 1 4 3 8 6 5 3 1 7 5 7 8 3 8 2 6 8 6 5 4 1 1 5 1 4 7 7 5 2 6 8 4 3 2 6 5 7 7 4 4 5 1 7 2 2 2 6 7 6 2 4 7 3 2 6 2 3 2 1 4 8 8 7 6 3 4 7 2 4 3 1 7 2 7 1 3 6 ...
output:
655
result:
ok 1 number(s): "655"
Test #4:
score: 0
Accepted
time: 4ms
memory: 17660kb
input:
857 3 1 1 3 1 3 2 1 1 2 2 2 1 3 3 3 2 2 3 1 3 1 1 3 1 3 3 2 1 3 1 3 1 1 3 2 2 1 1 3 1 1 2 3 1 1 2 1 3 3 3 3 3 1 1 2 2 3 1 1 2 2 2 3 2 1 2 2 2 3 2 1 3 3 2 2 1 2 3 1 1 1 3 2 3 3 3 1 3 2 2 2 1 3 3 3 2 2 3 1 1 1 1 3 1 3 3 3 1 2 1 3 1 3 2 3 3 3 1 1 1 3 1 3 3 2 2 1 3 3 1 1 3 1 2 1 1 1 2 1 2 2 3 2 2 2 2 3 ...
output:
565
result:
ok 1 number(s): "565"
Test #5:
score: 0
Accepted
time: 0ms
memory: 17928kb
input:
888 3 1 2 1 1 3 2 3 2 2 2 1 2 2 1 3 2 1 1 1 2 3 3 1 2 3 1 3 3 3 2 2 1 2 2 1 1 1 2 2 1 3 1 3 3 3 3 2 2 1 3 3 1 1 1 3 3 2 1 2 3 3 2 2 1 3 3 2 1 1 1 1 1 2 2 2 2 3 3 2 1 1 2 3 2 2 1 3 3 1 2 1 2 1 1 2 1 2 1 3 2 2 3 1 3 3 1 1 1 3 1 2 3 2 1 1 1 2 3 2 2 1 2 1 3 3 3 2 3 1 2 2 3 1 1 3 3 3 2 3 2 1 1 3 1 2 3 1 ...
output:
599
result:
ok 1 number(s): "599"
Test #6:
score: 0
Accepted
time: 3ms
memory: 17964kb
input:
998 4 1 2 4 1 1 3 4 3 3 2 2 1 2 3 3 4 4 3 3 1 1 1 4 2 1 2 2 2 2 3 2 2 1 2 2 4 3 3 3 3 2 2 3 3 2 3 4 3 4 3 2 4 2 1 2 3 3 2 3 2 4 1 4 1 4 1 4 1 2 3 1 4 3 1 2 2 3 3 2 1 3 3 3 4 2 1 3 2 3 3 4 3 4 1 4 3 4 3 3 1 4 2 3 2 1 4 2 1 1 4 3 4 2 4 4 3 4 4 1 3 4 4 1 2 3 2 1 1 3 3 1 3 3 4 3 1 3 2 4 1 4 4 2 4 2 2 4 ...
output:
731
result:
ok 1 number(s): "731"
Test #7:
score: 0
Accepted
time: 3ms
memory: 17740kb
input:
1000 10 1 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9...
output:
1000
result:
ok 1 number(s): "1000"
Subtask #2:
score: 12
Accepted
Dependency #1:
100%
Accepted
Test #8:
score: 12
Accepted
time: 3ms
memory: 17972kb
input:
1000 10 2 5 1 5 10 1 10 9 10 3 9 7 6 4 3 1 10 7 9 5 9 5 4 2 7 7 8 4 4 4 3 10 8 4 2 5 7 5 10 9 2 6 1 4 7 9 5 6 3 4 3 5 4 3 9 2 6 3 2 6 9 8 4 5 5 2 9 10 2 6 1 7 3 6 6 7 4 10 7 8 5 8 8 2 7 8 10 5 2 8 4 2 10 3 9 7 8 6 7 9 7 9 2 5 4 5 10 2 4 3 9 2 3 7 9 3 10 8 4 1 8 9 10 8 10 2 6 3 2 2 5 5 2 8 7 9 5 7 7 ...
output:
629
result:
ok 1 number(s): "629"
Test #9:
score: 0
Accepted
time: 7ms
memory: 17696kb
input:
1000 2 2 2 2 2 2 1 2 1 1 1 2 1 1 1 1 2 1 1 2 2 2 2 2 1 1 2 2 1 1 1 2 1 2 1 2 1 1 1 2 1 1 2 2 2 2 2 2 1 1 2 2 1 2 2 2 1 2 1 1 2 1 2 1 2 2 2 1 1 1 1 1 1 1 2 1 2 2 1 1 2 2 1 2 2 2 1 2 1 2 1 2 1 2 1 1 1 2 1 1 1 1 1 1 1 2 1 2 1 1 1 2 2 2 1 1 2 2 1 1 2 2 1 2 2 2 2 2 2 2 2 1 1 1 1 2 2 1 2 2 2 1 1 1 2 1 2 1...
output:
2
result:
ok 1 number(s): "2"
Test #10:
score: 0
Accepted
time: 0ms
memory: 17672kb
input:
933 8 2 6 1 4 2 6 3 6 6 8 5 8 6 1 8 5 4 8 2 8 1 8 2 2 4 2 1 1 5 7 1 8 6 1 3 6 6 7 5 3 6 5 6 6 5 5 1 3 7 2 5 7 1 8 7 5 2 8 3 5 6 3 8 8 7 6 4 3 8 8 1 7 6 1 6 2 6 3 4 3 3 4 2 8 5 4 8 1 2 6 4 1 3 2 8 2 4 6 2 8 8 7 6 7 2 6 8 4 2 6 6 5 1 8 2 4 7 3 8 3 6 5 7 4 2 1 4 7 2 8 1 5 5 5 7 6 7 2 3 5 6 4 5 8 7 4 7 ...
output:
556
result:
ok 1 number(s): "556"
Test #11:
score: 0
Accepted
time: 0ms
memory: 17456kb
input:
62 6 2 1 3 1 5 6 4 4 1 4 2 4 2 2 4 1 2 1 6 2 5 6 5 2 2 6 6 4 3 6 3 6 6 5 1 5 1 1 3 4 6 4 3 6 3 5 6 5 2 5 5 1 6 1 1 3 3 6 3 4 3 6 3
output:
25
result:
ok 1 number(s): "25"
Test #12:
score: 0
Accepted
time: 4ms
memory: 17832kb
input:
757 6 2 4 6 6 1 3 4 4 3 3 3 6 6 1 3 5 6 1 4 2 3 6 6 6 4 1 3 6 5 5 6 4 5 5 6 5 4 5 3 3 5 3 4 2 5 5 1 2 4 4 1 4 5 3 5 4 4 4 3 6 6 3 4 3 2 5 5 5 1 3 5 6 3 5 5 6 1 2 3 1 3 6 3 2 5 5 2 4 4 4 5 4 1 6 3 6 6 2 2 4 3 2 1 1 3 6 2 3 1 5 2 5 3 5 2 3 1 3 6 1 2 1 6 2 5 3 2 1 5 5 2 1 1 6 1 3 2 3 2 5 6 4 1 2 5 1 5 ...
output:
374
result:
ok 1 number(s): "374"
Test #13:
score: 0
Accepted
time: 3ms
memory: 17748kb
input:
956 6 2 4 5 2 4 6 2 1 2 2 2 6 6 4 6 3 3 4 6 4 2 5 1 5 3 6 6 6 1 5 5 2 4 1 2 6 2 2 3 6 2 4 1 6 3 3 5 6 3 4 3 5 3 5 6 5 4 6 2 4 1 2 3 4 6 1 5 6 1 4 4 6 6 4 6 6 3 3 3 6 3 5 4 3 6 1 1 4 4 2 2 2 6 3 2 2 6 3 6 2 3 3 1 3 5 6 6 4 5 5 2 4 4 5 2 6 2 3 3 5 1 1 1 2 5 3 5 3 1 1 6 5 1 6 4 2 1 2 2 1 6 6 1 6 4 6 3 ...
output:
472
result:
ok 1 number(s): "472"
Test #14:
score: 0
Accepted
time: 3ms
memory: 17696kb
input:
1000 10 2 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9...
output:
890
result:
ok 1 number(s): "890"
Subtask #3:
score: 22
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Test #15:
score: 22
Accepted
time: 4ms
memory: 17748kb
input:
1000 10 5 10 4 1 7 3 7 4 9 7 5 3 7 2 1 2 8 9 10 5 9 8 10 4 7 7 7 9 2 3 4 6 7 9 4 9 4 1 1 8 3 9 3 2 6 4 5 2 3 9 6 9 3 5 9 6 4 7 7 2 5 7 9 6 8 7 10 7 6 10 7 5 10 2 8 10 10 5 3 2 5 10 1 4 5 3 4 7 10 8 8 9 5 2 8 2 2 1 7 4 7 6 1 2 4 10 5 2 5 5 4 9 10 3 3 8 9 5 7 5 10 1 2 4 1 6 6 2 1 8 7 8 3 10 1 1 6 8 10...
output:
284
result:
ok 1 number(s): "284"
Test #16:
score: 0
Accepted
time: 9ms
memory: 17804kb
input:
1000 5 5 1 3 1 1 1 4 3 5 5 3 3 5 1 2 5 4 5 3 1 1 2 3 5 1 3 5 3 3 5 5 5 3 4 3 2 1 1 3 3 3 1 3 3 5 5 4 3 4 3 5 2 1 3 3 1 1 3 1 1 5 1 2 1 4 4 2 5 1 2 4 1 5 4 2 4 4 3 5 2 5 5 3 3 3 4 2 4 3 4 3 3 2 3 2 2 4 1 1 1 2 1 5 2 1 3 3 4 1 2 5 2 4 3 1 2 4 4 1 1 3 3 2 5 5 5 4 1 5 5 1 1 5 5 5 5 5 2 3 3 4 4 5 2 3 2 3...
output:
5
result:
ok 1 number(s): "5"
Test #17:
score: 0
Accepted
time: 3ms
memory: 17852kb
input:
614 9 3 3 1 6 7 8 8 8 8 1 7 8 8 9 1 3 3 5 8 4 1 8 9 7 2 3 2 2 5 5 3 9 7 3 7 6 8 4 4 8 5 9 4 4 7 4 8 5 6 4 7 7 9 1 7 2 5 1 5 1 5 6 6 9 4 9 2 7 7 4 2 1 6 6 8 7 4 1 8 5 5 5 9 8 7 8 5 9 5 4 9 7 2 8 8 9 1 9 2 1 8 1 8 4 6 1 5 1 3 3 3 7 5 5 3 4 8 1 2 9 8 6 7 1 8 1 9 5 5 9 2 5 1 6 3 2 5 5 8 9 1 2 1 7 8 4 3 ...
output:
269
result:
ok 1 number(s): "269"
Test #18:
score: 0
Accepted
time: 3ms
memory: 17796kb
input:
352 6 4 5 4 1 3 3 3 5 2 2 5 3 1 5 5 2 2 2 1 2 1 1 5 2 5 5 3 5 6 3 1 5 6 6 1 2 1 4 4 2 4 5 4 1 3 3 5 2 2 5 5 1 1 1 6 6 1 5 1 1 1 3 3 3 3 4 3 5 1 3 3 5 6 2 1 6 6 2 1 2 2 1 4 4 1 4 2 5 2 4 6 2 4 3 3 3 4 3 2 3 1 3 4 1 5 4 1 4 1 5 2 5 5 6 3 2 1 1 5 6 4 1 4 2 5 4 1 2 2 3 6 6 6 3 2 3 1 2 5 4 5 3 2 4 1 6 5 ...
output:
64
result:
ok 1 number(s): "64"
Test #19:
score: 0
Accepted
time: 0ms
memory: 17716kb
input:
881 5 3 4 2 5 1 3 2 1 5 3 2 4 2 3 4 3 5 1 2 2 4 2 1 5 4 5 3 2 4 2 2 2 4 2 5 3 4 5 4 2 5 2 2 4 4 4 5 1 4 5 5 4 2 2 2 2 1 5 1 2 2 4 1 4 5 5 2 4 2 4 4 3 2 4 5 1 2 1 2 2 5 2 1 1 4 3 3 5 1 3 4 1 2 4 5 2 2 2 3 2 3 3 2 5 4 4 3 2 4 4 3 4 3 2 1 2 5 1 1 3 3 1 4 3 1 2 5 5 4 2 1 1 5 2 2 4 5 1 3 1 1 2 1 4 5 2 3 ...
output:
222
result:
ok 1 number(s): "222"
Test #20:
score: 0
Accepted
time: 3ms
memory: 17792kb
input:
395 8 3 4 5 6 5 7 3 3 2 4 2 3 6 5 2 7 1 2 3 4 1 5 8 5 8 5 4 5 1 5 5 3 4 6 4 7 2 4 5 4 1 4 8 3 2 5 7 4 3 3 1 7 8 1 3 2 3 7 7 4 5 2 4 1 1 1 3 2 1 7 1 1 2 6 1 2 5 4 8 8 4 6 4 6 1 5 2 4 5 8 5 8 4 2 7 5 6 2 2 3 5 4 3 3 7 1 5 4 8 4 2 4 5 3 3 4 6 1 7 8 1 5 1 6 6 1 3 4 3 2 6 8 7 6 2 8 8 1 2 3 8 5 4 1 8 5 4 ...
output:
169
result:
ok 1 number(s): "169"
Test #21:
score: 0
Accepted
time: 3ms
memory: 17744kb
input:
1000 5 5 1 2 3 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5...
output:
5
result:
ok 1 number(s): "5"
Test #22:
score: 0
Accepted
time: 0ms
memory: 17804kb
input:
1000 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...
output:
2
result:
ok 1 number(s): "2"
Test #23:
score: 0
Accepted
time: 0ms
memory: 17736kb
input:
1000 10 5 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9...
output:
560
result:
ok 1 number(s): "560"
Subtask #4:
score: 11
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Test #24:
score: 11
Accepted
time: 27ms
memory: 18004kb
input:
1000 200 100 125 25 197 45 187 19 77 114 143 176 87 180 3 10 92 95 22 170 50 133 76 157 200 144 73 185 127 140 133 29 40 39 54 166 56 76 151 200 188 9 60 199 112 28 188 87 68 100 74 85 60 68 187 5 105 1 35 198 150 150 24 148 14 40 159 173 25 181 176 88 138 42 78 51 130 190 180 19 127 98 28 172 135 1...
output:
290
result:
ok 1 number(s): "290"
Test #25:
score: 0
Accepted
time: 25ms
memory: 17760kb
input:
1000 100 100 58 27 79 62 81 57 46 85 12 57 28 70 74 8 77 5 11 45 52 14 79 34 49 35 22 94 92 94 12 69 61 90 13 63 90 87 88 73 6 88 38 31 21 13 75 2 95 88 47 13 74 14 84 40 96 69 74 48 63 1 61 51 43 39 27 4 98 34 69 22 76 26 19 67 28 96 73 64 77 52 23 42 31 40 89 88 69 1 63 59 66 75 2 26 2 63 73 11 22...
output:
100
result:
ok 1 number(s): "100"
Test #26:
score: 0
Accepted
time: 7ms
memory: 17504kb
input:
396 110 38 54 12 22 77 55 68 55 104 27 65 72 68 24 108 32 90 90 85 104 42 104 93 3 44 78 99 81 103 80 35 42 34 95 86 104 48 39 105 69 56 89 79 23 105 57 97 30 50 91 79 88 58 53 25 109 61 44 90 32 104 25 40 84 5 7 46 63 6 71 20 27 85 7 79 62 2 43 88 68 61 102 19 31 55 108 30 17 108 28 76 46 100 87 48...
output:
155
result:
ok 1 number(s): "155"
Test #27:
score: 0
Accepted
time: 4ms
memory: 17684kb
input:
744 144 13 83 123 50 84 84 92 33 42 64 103 96 113 72 105 60 12 32 109 72 74 67 10 101 82 35 133 56 29 71 89 3 74 131 29 80 123 117 104 102 101 71 29 70 102 66 12 108 39 99 51 110 103 65 24 113 23 44 23 20 119 37 98 52 116 72 144 63 98 63 81 5 122 37 18 82 77 112 68 61 17 93 110 5 10 75 135 46 7 65 9...
output:
489
result:
ok 1 number(s): "489"
Test #28:
score: 0
Accepted
time: 4ms
memory: 17816kb
input:
492 12 58 7 3 11 11 5 3 1 3 3 7 8 5 6 11 12 3 12 2 6 10 1 1 11 12 6 11 6 12 3 12 6 8 8 7 9 11 2 8 4 9 4 6 4 2 2 4 4 7 8 1 4 9 4 6 8 1 4 11 10 5 2 10 3 4 10 9 7 3 4 1 9 10 3 3 6 9 4 8 9 4 1 10 10 2 8 6 1 5 1 1 4 3 8 1 9 10 4 3 3 11 1 10 11 7 9 4 9 1 9 2 9 1 11 11 11 4 12 5 2 4 5 6 1 12 8 10 12 11 7 9...
output:
12
result:
ok 1 number(s): "12"
Test #29:
score: 0
Accepted
time: 14ms
memory: 17508kb
input:
406 144 96 14 64 56 134 91 98 49 36 25 67 59 84 127 107 26 37 98 110 19 86 3 15 133 107 37 44 19 57 14 75 88 58 57 116 140 37 92 50 15 19 98 5 36 11 64 99 138 75 7 28 82 15 83 113 64 33 34 23 137 10 130 135 141 110 32 90 74 142 115 87 143 32 89 82 73 133 116 105 138 121 18 10 24 11 81 96 41 32 5 58 ...
output:
134
result:
ok 1 number(s): "134"
Test #30:
score: 0
Accepted
time: 4ms
memory: 17684kb
input:
804 147 2 147 75 84 87 31 136 13 113 144 10 121 15 95 14 108 49 88 50 145 33 106 69 146 86 117 11 60 72 86 39 85 127 123 104 23 31 96 136 3 97 114 147 107 77 3 85 66 28 20 124 8 36 40 4 80 19 23 7 51 135 21 142 89 102 58 111 36 39 41 47 105 111 88 126 142 106 82 122 34 147 136 56 71 141 98 136 7 80 ...
output:
748
result:
ok 1 number(s): "748"
Test #31:
score: 0
Accepted
time: 12ms
memory: 17688kb
input:
999 37 72 7 26 21 1 33 33 20 4 18 3 27 36 32 28 26 29 31 13 6 9 27 32 3 11 35 18 33 4 2 1 11 27 35 12 29 24 13 12 29 30 28 10 31 27 14 12 17 21 32 13 33 36 1 37 7 7 23 30 21 13 26 22 7 31 35 12 28 35 15 36 9 3 29 6 37 37 6 18 37 29 37 26 32 37 35 24 18 25 37 17 34 25 18 26 29 7 35 6 3 18 23 33 22 13...
output:
37
result:
ok 1 number(s): "37"
Test #32:
score: 0
Accepted
time: 7ms
memory: 17608kb
input:
633 127 23 28 56 97 1 20 54 41 53 35 26 15 17 1 124 7 78 122 62 108 116 115 28 79 57 92 66 106 30 88 11 35 99 91 47 61 121 77 72 17 26 80 26 49 118 46 5 61 90 97 65 89 27 27 97 70 110 34 127 49 2 62 110 35 100 121 99 116 46 29 83 39 8 78 27 14 100 24 31 55 94 41 91 121 116 52 25 23 39 47 31 71 65 12...
output:
335
result:
ok 1 number(s): "335"
Test #33:
score: 0
Accepted
time: 0ms
memory: 17448kb
input:
54 129 75 32 15 4 35 87 38 115 4 36 62 88 106 126 45 98 46 31 68 117 72 74 126 42 119 23 92 7 49 108 40 111 65 45 82 128 20 100 26 27 42 93 89 104 22 101 55 90 122 16 18 48 96 71 3
output:
50
result:
ok 1 number(s): "50"
Test #34:
score: 0
Accepted
time: 8ms
memory: 17992kb
input:
1000 100 100 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99...
output:
100
result:
ok 1 number(s): "100"
Test #35:
score: 0
Accepted
time: 4ms
memory: 17736kb
input:
1000 10 10 1 2 3 4 5 6 7 8 9 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 1...
output:
10
result:
ok 1 number(s): "10"
Test #36:
score: 0
Accepted
time: 6ms
memory: 17976kb
input:
1000 200 100 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99...
output:
600
result:
ok 1 number(s): "600"
Subtask #5:
score: 0
Time Limit Exceeded
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
100%
Accepted
Test #37:
score: 0
Time Limit Exceeded
input:
200000 500 100 99 80 424 158 170 220 376 198 250 362 228 479 37 82 321 63 455 101 442 406 44 297 300 66 17 321 229 260 35 375 344 292 214 413 271 246 252 287 327 161 246 136 371 491 324 76 443 373 336 218 307 431 483 38 392 6 134 116 320 137 480 19 268 196 368 165 207 63 287 134 448 121 490 438 436 ...
output:
result:
Subtask #6:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
100%
Accepted
Dependency #5:
0%
Subtask #7:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
100%
Accepted
Dependency #5:
0%