QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#608833 | #9424. Stop the Castle 2 | ucup-team3877 | AC ✓ | 762ms | 98108kb | C++20 | 10.3kb | 2024-10-04 05:07:19 | 2024-10-04 05:07:20 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(),(v).end()
#define rep(i, n) for(int i=0;i<n;i++)
#define foa(e, v) for(auto& e : v)
using ll = long long;
const ll MOD7 = 1000000007, MOD998 = 998244353, INF = (1LL << 60);
#define dout(a) cout<<fixed<<setprecision(10)<<a<<endl;
namespace atcoder {
namespace internal {
template <class T> struct simple_queue {
std::vector<T> payload;
int pos = 0;
void reserve(int n) { payload.reserve(n); }
int size() const { return int(payload.size()) - pos; }
bool empty() const { return pos == int(payload.size()); }
void push(const T& t) { payload.push_back(t); }
T& front() { return payload[pos]; }
void clear() {
payload.clear();
pos = 0;
}
void pop() { pos++; }
};
} // namespace internal
} // namespace atcoder
namespace atcoder {
template <class Cap> struct mf_graph {
public:
mf_graph() : _n(0) {}
mf_graph(int n) : _n(n), g(n) {}
int add_edge(int from, int to, Cap cap) {
assert(0 <= from && from < _n);
assert(0 <= to && to < _n);
assert(0 <= cap);
int m = int(pos.size());
pos.push_back({from, int(g[from].size())});
int from_id = int(g[from].size());
int to_id = int(g[to].size());
if (from == to) to_id++;
g[from].push_back(_edge{to, to_id, cap});
g[to].push_back(_edge{from, from_id, 0});
return m;
}
struct edge {
int from, to;
Cap cap, flow;
};
edge get_edge(int i) {
int m = int(pos.size());
assert(0 <= i && i < m);
auto _e = g[pos[i].first][pos[i].second];
auto _re = g[_e.to][_e.rev];
return edge{pos[i].first, _e.to, _e.cap + _re.cap, _re.cap};
}
std::vector<edge> edges() {
int m = int(pos.size());
std::vector<edge> result;
for (int i = 0; i < m; i++) {
result.push_back(get_edge(i));
}
return result;
}
void change_edge(int i, Cap new_cap, Cap new_flow) {
int m = int(pos.size());
assert(0 <= i && i < m);
assert(0 <= new_flow && new_flow <= new_cap);
auto& _e = g[pos[i].first][pos[i].second];
auto& _re = g[_e.to][_e.rev];
_e.cap = new_cap - new_flow;
_re.cap = new_flow;
}
Cap flow(int s, int t) {
return flow(s, t, std::numeric_limits<Cap>::max());
}
Cap flow(int s, int t, Cap flow_limit) {
assert(0 <= s && s < _n);
assert(0 <= t && t < _n);
assert(s != t);
std::vector<int> level(_n), iter(_n);
internal::simple_queue<int> que;
auto bfs = [&]() {
std::fill(level.begin(), level.end(), -1);
level[s] = 0;
que.clear();
que.push(s);
while (!que.empty()) {
int v = que.front();
que.pop();
for (auto e : g[v]) {
if (e.cap == 0 || level[e.to] >= 0) continue;
level[e.to] = level[v] + 1;
if (e.to == t) return;
que.push(e.to);
}
}
};
auto dfs = [&](auto self, int v, Cap up) {
if (v == s) return up;
Cap res = 0;
int level_v = level[v];
for (int& i = iter[v]; i < int(g[v].size()); i++) {
_edge& e = g[v][i];
if (level_v <= level[e.to] || g[e.to][e.rev].cap == 0) continue;
Cap d =
self(self, e.to, std::min(up - res, g[e.to][e.rev].cap));
if (d <= 0) continue;
g[v][i].cap += d;
g[e.to][e.rev].cap -= d;
res += d;
if (res == up) break;
}
return res;
};
Cap flow = 0;
while (flow < flow_limit) {
bfs();
if (level[t] == -1) break;
std::fill(iter.begin(), iter.end(), 0);
while (flow < flow_limit) {
Cap f = dfs(dfs, t, flow_limit - flow);
if (!f) break;
flow += f;
}
}
return flow;
}
std::vector<bool> min_cut(int s) {
std::vector<bool> visited(_n);
internal::simple_queue<int> que;
que.push(s);
while (!que.empty()) {
int p = que.front();
que.pop();
visited[p] = true;
for (auto e : g[p]) {
if (e.cap && !visited[e.to]) {
visited[e.to] = true;
que.push(e.to);
}
}
}
return visited;
}
private:
int _n;
struct _edge {
int to, rev;
Cap cap;
};
std::vector<std::pair<int, int>> pos;
std::vector<std::vector<_edge>> g;
};
} // namespace atcoder
using namespace atcoder;
void solve() {
int n, m, k; cin >> n >> m >> k;
map<int, int> mp1;
vector<int> x1(n), y1(n), x2(m), y2(m);
rep(i, n) {
cin >> x1[i] >> y1[i];
mp1[x1[i]] ++;
mp1[y1[i]] ++;
}
rep(i, m) {
cin >> x2[i] >> y2[i];
mp1[x2[i]] ++;
mp1[y2[i]] ++;
}
int id = 0;
for(auto [x, y] : mp1) {
mp1[x] = id ++;
}
rep(i, n) {
x1[i] = mp1[x1[i]];
y1[i] = mp1[y1[i]];
}
rep(i, m) {
x2[i] = mp1[x2[i]];
y2[i] = mp1[y2[i]];
}
vector<vector<pair<int, int>>> vec(m);
vector<set<int>> X(id), Y(id);
vector<set<pair<int, int>>> Xs(id), Ys(id);
rep(i, n) {
X[x1[i]].insert(y1[i]);
Y[y1[i]].insert(x1[i]);
Xs[x1[i]].insert({y1[i], i});
Ys[y1[i]].insert({x1[i], i});
}
rep(i, m) {
Xs[x2[i]].insert({y2[i], i + n});
Ys[y2[i]].insert({x2[i], i + n});
}
int ans = 0;
map<pair<int, int>, int> mp;
rep(i, id) {
foa(e, X[i]) {
auto it = X[i].upper_bound(e);
if(it == X[i].end()) continue;
int r = *it;
auto itrl = Xs[i].lower_bound(make_pair(e, -1));
auto itrr = Xs[i].lower_bound(make_pair(r, -1));
auto itr = itrl;
itr ++;
int i1 = itrl->second;
int i2 = itrr->second;
if(i1 > i2) swap(i1, i2);
int cnt = 0;
for(; itr != itrr; itr ++) {
cnt ++;
mp[{i1, i2}] ++;
vec[itr->second - n].push_back({i1, i2});
}
if(!cnt) ans ++;
}
foa(e, Y[i]) {
auto it = Y[i].upper_bound(e);
if(it == Y[i].end()) continue;
int r = *it;
auto itrl = Ys[i].lower_bound(make_pair(e, -1));
auto itrr = Ys[i].lower_bound(make_pair(r, -1));
auto itr = itrl;
itr ++;
int i1 = itrl->second;
int i2 = itrr->second;
if(i1 > i2) swap(i1, i2);
int cnt = 0;
for(; itr != itrr; itr ++) {
cnt ++;
mp[{i1, i2}] ++;
vec[itr->second - n].push_back({i1, i2});
}
if(!cnt) ans ++;
}
}
id = 0;
for(auto [x, y] : mp) {
mp[x] = id ++;
}
vector<vector<int>> v(id);
vector<int> cnt(id, 0);
vector<vector<int>> lis(id);
map<pair<int, int>, int> v2e;
vector<int> del0, del1, del2;
rep(i, m) {
int sz = vec[i].size();
if(sz == 0) {
del0.push_back(i + 1);
} else if(sz == 1) {
cnt[mp[vec[i][0]]] ++;
lis[mp[vec[i][0]]].push_back(i);
} else {
int a = mp[vec[i][0]];
int b = mp[vec[i][1]];
v[a].push_back(b);
v[b].push_back(a);
v2e[{a, b}] = i;
v2e[{b, a}] = i;
}
}
mf_graph<int> G(id + 2);
vector<int> seen(id, -1);
auto dfs = [&](auto dfs, int now) -> void {
foa(e, v[now]) {
if(seen[e] == -1) {
seen[e] = seen[now] ^ 1;
dfs(dfs, e);
}
}
};
rep(i, id) if(seen[i] == -1) {
seen[i] = 0;
dfs(dfs, i);
}
int s = id, t = id + 1;
rep(i, id) {
if(seen[i]) {
G.add_edge(s, i, 1);
foa(e, v[i]) {
G.add_edge(i, e, 1);
}
} else {
G.add_edge(i, t, 1);
}
}
G.flow(s, t);
auto ret = G.edges();
set<int> inc, mushi;
foa(e, ret) if(e.flow) {
if(e.from != s and e.to != t) {
inc.insert(e.from);
inc.insert(e.to);
mushi.insert(v2e[{e.from, e.to}]);
del2.push_back(v2e[{e.from, e.to}] + 1);
}
}
rep(i, id) {
if((int)v[i].size()) {
foa(e, lis[i]) del0.push_back(e + 1);
if(!inc.count(i)) {
int x = v2e[{i, v[i][0]}];
mushi.insert(x);
del1.push_back(x + 1);
}
} else {
int sz = lis[i].size();
rep(j, sz - 1) del0.push_back(lis[i][j] + 1);
del1.push_back(lis[i].back() + 1);
}
}
rep(i, id) foa(e, v[i]) if(!mushi.count(v2e[{i, e}])) {
mushi.insert(v2e[{i, e}]);
del0.push_back(v2e[{i, e}] + 1);
}
int sz0 = del0.size();
int sz1 = del1.size();
if(k <= sz0) {
cout << ans << endl;
rep(i, k) cout << del0[i] << " ";
cout << endl;
} else if(k <= sz0 + sz1) {
cout << ans + k - sz0 << endl;
foa(e, del0) cout << e << " ";
k -= sz0;
rep(i, k) cout << del1[i] << " ";
cout << endl;
} else {
cout << ans + sz1 + (k - sz0 - sz1) * 2 << endl;
foa(e, del0) cout << e << " ";
foa(e, del1) cout << e << " ";
k -= sz0 + sz1;
rep(i, k) cout << del2[i] << " ";
cout << endl;
}
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int t;
cin >> t;
rep(i, t) solve();
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3868kb
input:
3 8 6 4 1 3 2 1 2 6 4 1 4 7 6 1 6 3 6 6 2 3 3 1 4 3 4 6 5 2 6 4 3 2 1 10 12 10 10 10 11 1 4 1 5 1 3 2 1 1 2 1 2 2 2 3
output:
4 5 3 2 6 2 1 0 1 2
result:
ok ok 3 cases (3 test cases)
Test #2:
score: 0
Accepted
time: 231ms
memory: 13468kb
input:
1224 11 17 14 7 3 4 2 8 13 3 15 3 4 5 11 10 2 3 3 8 6 7 11 2 3 10 4 1 3 12 1 2 5 11 9 11 6 11 10 8 15 1 5 9 14 4 11 1 6 10 7 7 6 11 4 8 4 1 11 18 3 2 14 8 2 14 13 13 9 12 14 12 5 6 8 1 10 5 8 6 8 9 6 6 7 5 12 11 6 11 13 5 1 10 7 6 14 5 6 15 2 4 11 1 1 6 4 14 14 13 9 9 3 10 12 7 5 8 13 9 14 1 9 8 4 9...
output:
7 1 2 3 4 5 6 7 8 9 10 11 12 13 15 15 1 2 0 1 2 3 4 0 1 2 3 4 5 6 7 8 11 1 3 8 2 3 1 0 1 2 3 4 5 6 7 8 9 10 11 12 1 1 2 3 4 5 6 7 8 1 2 3 1 1 2 3 4 5 6 7 8 7 1 2 10 1 2 3 1 1 2 3 4 5 6 7 8 10 11 12 0 1 1 1 2 0 1 2 3 7 1 2 3 4 6 2 2 4 5 6 7 4 1 2 3 4 5 6 1 1 1 1 2 3 4 5 6 16 2 5 ...
result:
ok ok 1224 cases (1224 test cases)
Test #3:
score: 0
Accepted
time: 762ms
memory: 81480kb
input:
1 86289 95092 40401 911 152 1 270 135 731 347 451 283 224 338 348 166 346 12 385 590 763 939 176 232 405 122 946 397 576 795 823 546 392 33 718 444 598 954 852 185 662 732 539 172 681 386 148 76 495 163 323 711 201 278 363 531 275 66 122 823 983 234 792 102 188 985 423 804 712 419 636 318 331 693 68...
output:
81531 5696 6228 6289 9799 10034 13334 15623 17170 17467 18163 20486 23203 23978 26672 27834 31496 31767 33097 36946 38643 39086 42977 43495 46817 49572 49912 53087 53989 54927 55695 56414 56802 57054 57376 58942 59500 60112 62062 62161 64000 65379 65510 66191 66517 68564 68657 71168 72967 73008 7758...
result:
ok ok 1 cases (1 test case)
Test #4:
score: 0
Accepted
time: 521ms
memory: 97252kb
input:
1 99057 99722 73893 190482185 274379837 466851670 641324039 993028302 128875937 102891466 286559847 526771097 794238060 565736409 328262657 190329865 598878250 790626887 595298790 308031819 470646878 341575785 374318107 257299536 280924175 64420619 591124604 323023069 811512407 428956686 719615923 2...
output:
82045 1 6 10 13 15 16 20 21 24 25 28 30 37 39 45 50 51 52 54 55 60 61 62 69 70 71 79 81 82 83 87 90 91 94 96 99 100 101 102 105 107 110 111 112 129 131 133 138 142 143 147 149 151 152 153 154 156 159 166 172 174 179 182 183 189 194 198 203 210 214 218 220 221 222 230 234 241 248 252 255 257 259 260 ...
result:
ok ok 1 cases (1 test case)
Test #5:
score: 0
Accepted
time: 733ms
memory: 89552kb
input:
1 100000 99990 27662 913840909 999962982 690565691 31053 780601566 31053 54745498 31053 5383 859704869 538124857 999962982 5383 66851413 1444277 31053 119603839 999962982 999833258 543197820 999833258 349576387 999833258 759855830 999833258 124692224 266093388 999962982 5383 100041707 999833258 2843...
output:
100891 5180 35900 42203 46329 57694 67969 81055 40253 98019 66890 25086 47864 75848 43969 52819 97893 9861 19867 88324 88912 99118 27790 32252 47983 59395 9208 13544 31717 44404 20348 98773 2758 74517 82113 83912 86133 74751 95049 98098 92224 31803 70035 31510 40979 51923 22789 56440 83197 87183 766...
result:
ok ok 1 cases (1 test case)
Test #6:
score: 0
Accepted
time: 343ms
memory: 69924kb
input:
1 100000 49997 21428 9380 4333 9380 999999628 49202 4333 49202 999999628 50841 4333 50841 999999628 77418 4333 77418 999999628 95722 4333 95722 999999628 144002 4333 144002 999999628 234359 4333 234359 999999628 268942 4333 268942 999999628 288956 4333 288956 999999628 415094 4333 415094 999999628 4...
output:
100000 40124 8771 44007 40713 32207 7613 10077 30940 16691 24847 10459 5083 2401 30944 27573 23111 46191 28989 26546 43847 20401 29283 24840 22051 26616 11005 6532 39113 4441 12434 45082 31257 17076 10996 11938 49525 49992 32862 7655 42774 81 34007 30292 24649 29986 17767 6403 31884 29526 13780 4421...
result:
ok ok 1 cases (1 test case)
Test #7:
score: 0
Accepted
time: 424ms
memory: 98108kb
input:
1 100000 100000 76259 931427170 7 367311884 7 646435086 7 925372747 7 371054451 7 284185575 7 695090232 7 889183241 7 615617158 7 44230096 7 293281406 7 758261641 7 685549291 7 679471071 7 723138327 7 901136691 7 49281635 7 256352978 7 320188290 7 78730802 7 788131872 7 234735044 7 664906524 7 79430...
output:
76258 6253 23151 29605 66980 79517 8107 33236 42731 21734 63101 26450 53453 1516 42276 11840 670 16403 29959 32917 41102 65183 18071 24696 42780 24276 26516 82402 58621 11721 32329 27581 56046 91736 81458 38888 55499 77012 21042 28757 42578 80061 14411 62068 488 50013 50533 15031 28438 38373 46681 6...
result:
ok ok 1 cases (1 test case)
Test #8:
score: 0
Accepted
time: 235ms
memory: 62144kb
input:
1 100000 49999 24999 2 1 2 1000000000 3 1 3 1000000000 4 1 4 1000000000 5 1 5 1000000000 6 1 6 1000000000 7 1 7 1000000000 8 1 8 1000000000 9 1 9 1000000000 10 1 10 1000000000 11 1 11 1000000000 12 1 12 1000000000 13 1 13 1000000000 14 1 14 1000000000 15 1 15 1000000000 16 1 16 1000000000 17 1 17 10...
output:
99996 1 2 6251 3 6252 4 6253 5 6254 6 6255 7 6256 8 6257 9 6258 10 6259 11 6260 12 6261 13 6262 14 6263 15 6264 16 6265 17 6266 18 6267 19 6268 20 6269 21 6270 22 6271 23 6272 24 6273 25 6274 26 6275 27 6276 28 6277 29 6278 30 6279 31 6280 32 6281 33 6282 34 6283 35 6284 36 6285 37 6286 38 6287 39 6...
result:
ok ok 1 cases (1 test case)
Test #9:
score: 0
Accepted
time: 185ms
memory: 27772kb
input:
556 16 6 3 2 1 2 1000000000 3 1 3 1000000000 4 1 4 1000000000 1 2 1000000000 2 1 3 1000000000 3 1 4 1000000000 4 1 5 1000000000 5 1 6 1000000000 6 2 3 3 3 3 2 4 2 2 4 4 4 32 12 6 2 1 2 1000000000 3 1 3 1000000000 4 1 4 1000000000 5 1 5 1000000000 6 1 6 1000000000 7 1 7 1000000000 8 1 8 1000000000 9 ...
output:
14 5 2 4 32 1 3 7 9 6 8 31 3 7 14 16 6 8 11 5 8 1 13 3 1 19 1 2 6 10 3 11 2 4 3 20 3 6 5 15 3 4 7 6 33 2 5 7 13 11 3 1 31 7 4 9 16 6 11 12 13 19 1 10 5 6 9 31 8 4 7 1 3 15 4 8 5 3 28 5 9 3 2 1 11 1 19 7 2 10 3 5 23 7 11 8 4 2 3 34 5 6 8 4 2 9 15 3 31 16 2 4 15 1 6 10 11 29 1 10 1...
result:
ok ok 556 cases (556 test cases)
Test #10:
score: 0
Accepted
time: 406ms
memory: 64444kb
input:
1 100000 50000 25000 2 1 2 1000000000 3 1 3 1000000000 4 1 4 1000000000 5 1 5 1000000000 6 1 6 1000000000 7 1 7 1000000000 8 1 8 1000000000 9 1 9 1000000000 10 1 10 1000000000 11 1 11 1000000000 12 1 12 1000000000 13 1 13 1000000000 14 1 14 1000000000 15 1 15 1000000000 16 1 16 1000000000 17 1 17 10...
output:
99996 37780 18426 41520 13719 31581 7161 45006 918 49411 12467 27093 27855 2923 8574 29828 27195 36911 40941 7427 5948 27123 28936 47729 44919 13724 15921 30672 22874 34733 24547 49779 9413 34496 14301 26041 43702 10758 22400 9990 26758 18689 42386 7308 39171 716 41104 31059 42337 13742 24062 39012 ...
result:
ok ok 1 cases (1 test case)
Test #11:
score: 0
Accepted
time: 164ms
memory: 27872kb
input:
556 32 15 7 2 1 2 1000000000 3 1 3 1000000000 4 1 4 1000000000 5 1 5 1000000000 6 1 6 1000000000 7 1 7 1000000000 8 1 8 1000000000 9 1 9 1000000000 1 2 1000000000 2 1 3 1000000000 3 1 4 1000000000 4 1 5 1000000000 5 1 6 1000000000 6 1 7 1000000000 7 1 8 1000000000 8 1 9 1000000000 9 7 6 4 3 5 4 2 2 ...
output:
28 15 2 3 7 1 10 8 11 1 4 20 4 3 23 10 7 9 4 8 26 1 8 6 2 7 17 1 10 2 31 6 8 3 2 14 1 31 5 7 2 3 14 11 4 34 2 5 3 7 8 4 15 16 3 32 8 7 2 1 6 29 5 3 28 6 12 15 1 7 10 8 31 14 1 6 5 4 8 2 25 5 9 8 3 15 5 4 2 29 5 6 9 11 1 31 1 4 7 8 15 1 7 2 29 3 1 27 6 1 3 19 5 7 6 9 25 1 6 9 ...
result:
ok ok 556 cases (556 test cases)
Test #12:
score: 0
Accepted
time: 317ms
memory: 63960kb
input:
1 100000 49999 24999 2 1 2 1000000000 3 1 3 1000000000 4 1 4 1000000000 5 1 5 1000000000 6 1 6 1000000000 7 1 7 1000000000 8 1 8 1000000000 9 1 9 1000000000 10 1 10 1000000000 11 1 11 1000000000 12 1 12 1000000000 13 1 13 1000000000 14 1 14 1000000000 15 1 15 1000000000 16 1 16 1000000000 17 1 17 10...
output:
99996 40447 14075 28360 6856 22077 44128 9735 12924 11911 40253 17495 46492 19462 22062 49097 49054 25640 30991 23273 6570 27972 38246 45914 20880 32446 14492 6373 37755 37498 45435 15047 14743 35250 41572 5822 25083 15979 5945 27470 29034 19090 3753 9792 36148 34875 23701 26089 30876 33759 8789 243...
result:
ok ok 1 cases (1 test case)
Test #13:
score: 0
Accepted
time: 185ms
memory: 28416kb
input:
556 22 1 1 2 1 2 1000000000 1 2 1000000000 2 1 3 1000000000 3 1 4 1000000000 4 1 5 1000000000 5 1 6 1000000000 6 1 7 1000000000 7 1 8 1000000000 8 1 9 1000000000 9 1 10 1000000000 10 1 11 1000000000 11 2 2 18 3 1 2 1 2 1000000000 3 1 3 1000000000 1 2 1000000000 2 1 3 1000000000 3 1 4 1000000000 4 1 ...
output:
29 1 19 1 20 1 5 14 2 5 25 2 28 3 6 1 9 4 2 8 23 1 29 5 8 3 11 10 28 3 5 6 2 5 1 23 7 8 6 9 11 31 10 2 3 15 14 13 5 29 2 3 7 1 26 1 27 9 12 13 2 3 6 24 5 7 1 14 3 5 32 5 11 13 6 10 14 3 4 24 5 2 1 27 3 1 7 10 2 6 32 3 1 15 9 5 4 14 2 30 1 5 3 24 7 2 3 15 3 2 6 26 1 18 1 2 6...
result:
ok ok 556 cases (556 test cases)
Test #14:
score: 0
Accepted
time: 384ms
memory: 64688kb
input:
1 100000 49999 24999 2 1 2 1000000000 3 1 3 1000000000 4 1 4 1000000000 5 1 5 1000000000 6 1 6 1000000000 7 1 7 1000000000 8 1 8 1000000000 9 1 9 1000000000 10 1 10 1000000000 11 1 11 1000000000 12 1 12 1000000000 13 1 13 1000000000 14 1 14 1000000000 15 1 15 1000000000 16 1 16 1000000000 17 1 17 10...
output:
99996 31634 20011 6729 4631 14575 6127 16142 31019 12583 43682 11913 31187 29125 19858 32958 43279 40473 10025 43287 34396 47820 46549 12384 20710 31646 1998 25863 27901 10878 10348 36847 23385 15192 33710 36753 41805 21583 3623 43591 36234 22816 23283 17536 36693 35005 36397 9484 24789 22035 2102 7...
result:
ok ok 1 cases (1 test case)
Test #15:
score: 0
Accepted
time: 348ms
memory: 57744kb
input:
1 100000 49998 34141 2 1 2 1000000000 3 1 3 1000000000 4 1 4 1000000000 5 1 5 1000000000 6 1 6 1000000000 7 1 7 1000000000 8 1 8 1000000000 9 1 9 1000000000 10 1 10 1000000000 11 1 11 1000000000 12 1 12 1000000000 13 1 13 1000000000 14 1 14 1000000000 15 1 15 1000000000 16 1 16 1000000000 17 1 17 10...
output:
118282 4971 11888 29413 31327 49182 23981 12885 27072 26390 7706 18502 9597 6642 12329 42642 34241 12693 40464 42695 3318 17835 31666 32939 35322 37591 16158 30072 30752 36710 41126 13274 39604 41844 47416 47994 13577 32272 9737 33497 34608 28372 5027 17114 17950 45873 48946 44414 32792 35314 44433 ...
result:
ok ok 1 cases (1 test case)
Test #16:
score: 0
Accepted
time: 440ms
memory: 72288kb
input:
1 100000 82275 67072 2 1 2 1000000000 3 1 3 1000000000 4 1 4 1000000000 5 1 5 1000000000 6 1 6 1000000000 7 1 7 1000000000 8 1 8 1000000000 9 1 9 1000000000 10 1 10 1000000000 11 1 11 1000000000 12 1 12 1000000000 13 1 13 1000000000 14 1 14 1000000000 15 1 15 1000000000 16 1 16 1000000000 17 1 17 10...
output:
119590 31917 36173 36607 14846 33196 41880 73720 28883 40848 45215 24810 20972 45861 52283 61342 74961 10005 18117 40541 81859 73002 25968 74893 7390 17307 56796 60846 76853 37861 46068 42087 59256 77954 21937 49458 8365 46949 5479 30672 60764 19775 7266 17352 76855 36891 37507 70477 14072 49811 171...
result:
ok ok 1 cases (1 test case)
Test #17:
score: 0
Accepted
time: 245ms
memory: 35352kb
input:
556 30 12 6 2 1 2 1000000000 3 1 3 1000000000 4 1 4 1000000000 5 1 5 1000000000 6 1 6 1000000000 7 1 7 1000000000 8 1 8 1000000000 1 2 1000000000 2 1 3 1000000000 3 1 4 1000000000 4 1 5 1000000000 5 1 6 1000000000 6 1 7 1000000000 7 1 8 1000000000 8 1 9 1000000000 9 2 6 2 8 3 4 4 4 4 8 5 3 5 7 5 8 6...
output:
29 2 4 8 10 11 7 19 2 3 7 9 11 5 6 8 10 25 3 8 12 2 4 9 10 5 11 6 13 3 5 4 31 2 3 5 6 8 9 11 12 13 14 17 18 19 21 23 24 25 27 16 20 22 26 28 36 1 4 9 13 10 8 5 18 2 3 4 5 20 3 7 4 6 8 20 2 8 9 10 11 12 13 14 16 17 18 3 4 5 6 12 2 3 4 5 8 2 3 4 6 7 8 15 2 3 4 5 6 22 2 3 5 6 8 9 11 13 15 1...
result:
ok ok 556 cases (556 test cases)
Test #18:
score: 0
Accepted
time: 530ms
memory: 83372kb
input:
1 100000 99991 75553 2 1 2 1000000000 3 1 3 1000000000 4 1 4 1000000000 5 1 5 1000000000 6 1 6 1000000000 7 1 7 1000000000 8 1 8 1000000000 9 1 9 1000000000 10 1 10 1000000000 11 1 11 1000000000 12 1 12 1000000000 13 1 13 1000000000 14 1 14 1000000000 15 1 15 1000000000 16 1 16 1000000000 17 1 17 10...
output:
101120 2 3 5 7 8 9 11 12 13 15 16 17 18 20 21 22 23 24 25 26 27 30 32 33 34 35 37 39 41 42 43 44 47 48 50 52 54 55 57 58 59 60 61 62 64 65 66 67 68 71 72 73 75 76 77 78 79 80 81 82 85 86 87 88 89 90 91 92 93 95 97 98 99 101 102 103 104 105 107 108 109 110 111 112 114 115 116 117 119 120 121 122 124 ...
result:
ok ok 1 cases (1 test case)
Extra Test:
score: 0
Extra Test Passed