QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#632198 | #9424. Stop the Castle 2 | ucup-team1134 | AC ✓ | 239ms | 38840kb | C++23 | 14.6kb | 2024-10-12 12:53:48 | 2024-10-12 12:53:50 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pair<int,int>>
#define vll vector<pair<ll,ll>>
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
#define vvii vector<vector<pair<int,int>>>
#define vvll vector<vector<pair<ll,ll>>>
#define vst vector<string>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define mkunique(x) sort(all(x));(x).erase(unique(all(x)),(x).end())
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=998244353,MAX=300005,INF=15<<26;
// フローのみ
// from: https://gist.github.com/yosupo06/ddd51afb727600fd95d9d8ad6c3c80c9
// (based on AtCoder STL)
#ifndef ATCODER_INTERNAL_QUEUE_HPP
#define ATCODER_INTERNAL_QUEUE_HPP 1
#include <vector>
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
#endif // ATCODER_INTERNAL_QUEUE_HPP
#ifndef ATCODER_MAXFLOW_HPP
#define ATCODER_MAXFLOW_HPP 1
#include <algorithm>
#include <cassert>
#include <limits>
#include <queue>
#include <vector>
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())});
g[from].push_back(_edge{to, int(g[to].size()), cap});
g[to].push_back(_edge{from, int(g[from].size()) - 1, 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);
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
#endif // ATCODER_MAXFLOW_HPP
#ifndef ATCODER_MINCOSTFLOW_HPP
#define ATCODER_MINCOSTFLOW_HPP 1
#include <algorithm>
#include <cassert>
#include <limits>
#include <queue>
#include <vector>
namespace atcoder {
template <class Cap, class Cost> struct mcf_graph {
public:
mcf_graph() {}
mcf_graph(int n) : _n(n), g(n) {}
int add_edge(int from, int to, Cap cap, Cost cost) {
assert(0 <= from && from < _n);
assert(0 <= to && to < _n);
int m = int(pos.size());
pos.push_back({from, int(g[from].size())});
g[from].push_back(_edge{to, int(g[to].size()), cap, cost});
g[to].push_back(_edge{from, int(g[from].size()) - 1, 0, -cost});
return m;
}
struct edge {
int from, to;
Cap cap, flow;
Cost cost;
};
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, _e.cost,
};
}
std::vector<edge> edges() {
int m = int(pos.size());
std::vector<edge> result(m);
for (int i = 0; i < m; i++) {
result[i] = get_edge(i);
}
return result;
}
std::pair<Cap, Cost> flow(int s, int t) {
return flow(s, t, std::numeric_limits<Cap>::max());
}
std::pair<Cap, Cost> flow(int s, int t, Cap flow_limit) {
return slope(s, t, flow_limit).back();
}
std::vector<std::pair<Cap, Cost>> slope(int s, int t) {
return slope(s, t, std::numeric_limits<Cap>::max());
}
std::vector<std::pair<Cap, Cost>> slope(int s, int t, Cap flow_limit) {
assert(0 <= s && s < _n);
assert(0 <= t && t < _n);
assert(s != t);
// variants (C = maxcost):
// -(n-1)C <= dual[s] <= dual[i] <= dual[t] = 0
// reduced cost (= e.cost + dual[e.from] - dual[e.to]) >= 0 for all edge
std::vector<Cost> dual(_n, 0), dist(_n);
std::vector<int> pv(_n), pe(_n);
std::vector<bool> vis(_n);
auto dual_ref = [&]() {
std::fill(dist.begin(), dist.end(),
std::numeric_limits<Cost>::max());
std::fill(pv.begin(), pv.end(), -1);
std::fill(pe.begin(), pe.end(), -1);
std::fill(vis.begin(), vis.end(), false);
struct Q {
Cost key;
int to;
bool operator<(Q r) const { return key > r.key; }
};
std::priority_queue<Q> que;
dist[s] = 0;
que.push(Q{0, s});
while (!que.empty()) {
int v = que.top().to;
que.pop();
if (vis[v]) continue;
vis[v] = true;
if (v == t) break;
// dist[v] = shortest(s, v) + dual[s] - dual[v]
// dist[v] >= 0 (all reduced cost are positive)
// dist[v] <= (n-1)C
for (int i = 0; i < int(g[v].size()); i++) {
auto e = g[v][i];
if (vis[e.to] || !e.cap) continue;
// |-dual[e.to] + dual[v]| <= (n-1)C
// cost <= C - -(n-1)C + 0 = nC
Cost cost = e.cost - dual[e.to] + dual[v];
if (dist[e.to] - dist[v] > cost) {
dist[e.to] = dist[v] + cost;
pv[e.to] = v;
pe[e.to] = i;
que.push(Q{dist[e.to], e.to});
}
}
}
if (!vis[t]) {
return false;
}
for (int v = 0; v < _n; v++) {
if (!vis[v]) continue;
// dual[v] = dual[v] - dist[t] + dist[v]
// = dual[v] - (shortest(s, t) + dual[s] - dual[t]) + (shortest(s, v) + dual[s] - dual[v])
// = - shortest(s, t) + dual[t] + shortest(s, v)
// = shortest(s, v) - shortest(s, t) >= 0 - (n-1)C
dual[v] -= dist[t] - dist[v];
}
return true;
};
Cap flow = 0;
Cost cost = 0, prev_cost = -1;
std::vector<std::pair<Cap, Cost>> result;
result.push_back({flow, cost});
while (flow < flow_limit) {
if (!dual_ref()) break;
Cap c = flow_limit - flow;
for (int v = t; v != s; v = pv[v]) {
c = std::min(c, g[pv[v]][pe[v]].cap);
}
for (int v = t; v != s; v = pv[v]) {
auto& e = g[pv[v]][pe[v]];
e.cap -= c;
g[v][e.rev].cap += c;
}
Cost d = -dual[s];
flow += c;
cost += c * d;
if (prev_cost == d) {
result.pop_back();
}
result.push_back({flow, cost});
prev_cost = d;
}
return result;
}
private:
int _n;
struct _edge {
int to, rev;
Cap cap;
Cost cost;
};
std::vector<std::pair<int, int>> pos;
std::vector<std::vector<_edge>> g;
};
} // namespace atcoder
#endif // ATCODER_MINCOSTFLOW_HPP
int main(){
std::ifstream in("text.txt");
std::cin.rdbuf(in.rdbuf());
cin.tie(0);
ios::sync_with_stdio(false);
int Q;cin>>Q;
while(Q--){
ll N,M,K;cin>>N>>M>>K;
vector<array<ll,3>> S(N+M);
for(int i=0;i<N;i++){
ll a,b;cin>>a>>b;
S[i]={a,b,-1};
}
for(int i=0;i<M;i++){
ll a,b;cin>>a>>b;
S[N+i]={a,b,i};
}
vector<array<ll,2>> wh(M,{-1,-1});
vl sz;
for(int q=0;q<2;q++){
sort(all(S));
vi use;
for(int i=0;i<si(S);i++) if(S[i][2]==-1) use.pb(i);
int t=0;
for(int i=0;i+1<si(use);i++){
int a=use[i],b=use[i+1];
if(S[a][0]==S[b][0]){
for(int k=a+1;k<b;k++){
wh[S[k][2]][q]=t;
}
t++;
}
}
sz.pb(t);
for(int i=0;i<si(S);i++) swap(S[i][0],S[i][1]);
}
atcoder::mf_graph<int> G(sz[0]+sz[1]+2);
int s=sz[0]+sz[1],t=s+1;
map<array<ll,2>,int> MA;
for(int i=0;i<M;i++){
if(wh[i][0]!=-1&&wh[i][1]!=-1){
MA[wh[i]]=i;
G.add_edge(wh[i][0],sz[0]+wh[i][1],1);
}
}
for(int i=0;i<sz[0];i++) G.add_edge(s,i,1);
for(int i=0;i<sz[1];i++) G.add_edge(sz[0]+i,t,1);
int can=M-K;
int ss=G.flow(s,t);
auto ee=G.edges();
int ans=sz[0]+sz[1];
vi res(M);
vi used(ans);
for(auto e:ee){
if(can==0) continue;
if(e.from<sz[0]&&e.to<sz[0]+sz[1]&&e.flow){
ans-=2;
used[e.from]=used[e.to]=1;
res[MA[{e.from,e.to-sz[0]}]]=true;
can--;
}
}
for(int i=0;i<M;i++){
if(can==0) continue;
if(res[i]) continue;
if(wh[i][0]==-1){
if(wh[i][1]==-1){
}else{
if(!used[wh[i][1]+sz[0]]){
ans--;
used[wh[i][1]+sz[0]]=1;
res[i]=true;
can--;
}
}
}else{
if(wh[i][1]==-1){
if(!used[wh[i][0]]){
ans--;
used[wh[i][0]]=1;
res[i]=true;
can--;
}
}else{
if(!used[wh[i][0]]){
ans--;
used[wh[i][0]]=1;
res[i]=true;
can--;
}
if(!used[wh[i][1]+sz[0]]){
ans--;
used[wh[i][1]+sz[0]]=1;
res[i]=true;
can--;
}
}
}
}
for(int i=0;i<M;i++){
if(can==0) continue;
if(res[i]) continue;
res[i]=true;
can--;
}
cout<<ans<<"\n";
for(int i=0;i<M;i++){
if(!res[i]) cout<<i+1<<" ";
}
cout<<"\n";
}
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3572kb
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 2 3 5 6 2 2 0 2 3
result:
ok ok 3 cases (3 test cases)
Test #2:
score: 0
Accepted
time: 73ms
memory: 6804kb
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 3 4 5 6 7 8 9 10 11 12 13 15 16 17 15 2 3 0 3 4 5 6 0 2 3 4 5 6 7 8 9 11 1 3 8 1 2 3 0 1 2 3 4 5 6 7 8 9 10 11 12 1 5 6 7 9 10 11 12 8 17 18 19 1 1 2 3 4 5 6 7 8 7 6 8 10 13 14 15 1 10 11 12 13 14 15 16 17 18 19 20 0 1 1 2 3 0 5 6 7 7 8 12 13 14 15 2 10 11 12 13 14 4 3 4 5 6 7 8 ...
result:
ok ok 1224 cases (1224 test cases)
Test #3:
score: 0
Accepted
time: 172ms
memory: 36568kb
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 5884 5885 5889 5893 5894 5895 5897 5898 5899 5911 5914 5917 5919 5920 5923 5924 5926 5927 5930 5934 5938 5940 5941 5949 5956 5961 5963 5964 5968 5969 5974 5975 5977 5979 5980 5981 5983 5984 5985 5987 5990 5992 5997 6000 6003 6006 6007 6008 6013 6017 6024 6028 6030 6031 6034 6037 6039 6042 6044...
result:
ok ok 1 cases (1 test case)
Test #4:
score: 0
Accepted
time: 87ms
memory: 28236kb
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 9 10 11 13 15 16 18 19 20 21 22 24 25 28 29 30 33 34 35 36 37 38 39 43 45 47 49 50 51 52 54 55 59 60 61 62 65 67 69 70 71 79 81 82 83 87 89 90 91 93 94 95 96 99 100 101 102 104 105 107 109 110 111 112 113 114 118 119 120 124 128 129 131 133 136 137 138 142 143 147 148 149 151 152 153 154 1...
result:
ok ok 1 cases (1 test case)
Test #5:
score: 0
Accepted
time: 173ms
memory: 38840kb
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 65623 65625 65626 65628 65629 65630 65631 65632 65633 65635 65636 65637 65638 65639 65640 65641 65643 65644 65645 65647 65649 65651 65654 65655 65656 65657 65658 65660 65661 65662 65663 65664 65665 65666 65667 65668 65669 65670 65671 65673 65674 65677 65678 65679 65680 65681 65682 65683 65684...
result:
ok ok 1 cases (1 test case)
Test #6:
score: 0
Accepted
time: 73ms
memory: 36532kb
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 7099 7100 7102 7103 7104 7105 7106 7108 7110 7113 7114 7117 7119 7120 7122 7123 7126 7130 7131 7134 7135 7136 7140 7145 7149 7151 7154 7157 7158 7160 7162 7163 7167 7170 7172 7173 7174 7176 7178 7182 7183 7184 7188 7190 7197 7199 7201 7204 7205 7206 7208 7209 7211 7212 7213 7215 7216 7221 722...
result:
ok ok 1 cases (1 test case)
Test #7:
score: 0
Accepted
time: 48ms
memory: 20164kb
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 463 577 797 819 881 890 900 923 993 1008 1061 1208 1267 1273 1283 1330 1357 1370 1381 1402 1438 1488 1493 1550 1556 1566 1614 1619 1655 1673 1721 1727 1758 1767 1804 1813 1829 1831 1844 1882 1906 1908 1914 1941 2020 2100 2193 2201 2209 2245 2284 2289 2303 2456 2466 2476 2484 2504 2537 2557 256...
result:
ok ok 1 cases (1 test case)
Test #8:
score: 0
Accepted
time: 57ms
memory: 30464kb
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 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 100 10...
result:
ok ok 1 cases (1 test case)
Test #9:
score: 0
Accepted
time: 82ms
memory: 14976kb
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 2 4 5 32 1 3 6 7 8 9 31 3 5 6 7 8 11 14 16 8 1 13 2 4 19 4 5 7 8 9 11 1 5 6 20 3 5 6 15 3 4 6 7 33 4 6 8 9 10 12 14 31 4 6 7 9 11 12 13 16 19 1 5 6 9 10 31 1 3 4 7 8 15 1 2 6 7 28 4 6 7 8 10 11 1 19 2 3 5 7 10 23 1 5 6 9 10 12 34 1 7 10 11 12 13 14 16 31 3 5 7 8 9 12 13 14 29 ...
result:
ok ok 556 cases (556 test cases)
Test #10:
score: 0
Accepted
time: 225ms
memory: 32748kb
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 2 3 6 9 12 13 16 17 21 23 24 26 27 29 31 32 35 37 40 42 44 49 50 52 53 58 59 62 66 67 69 70 71 72 73 74 75 76 77 79 80 81 83 84 86 87 92 93 95 96 98 99 100 101 105 106 107 108 110 112 116 120 123 125 126 127 128 131 133 134 136 139 140 142 144 150 154 161 163 166 167 168 169 171 172 175 181 18...
result:
ok ok 1 cases (1 test case)
Test #11:
score: 0
Accepted
time: 45ms
memory: 17152kb
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 1 2 3 7 8 10 15 11 1 4 20 3 4 23 4 7 8 9 10 26 1 2 6 7 8 17 1 10 2 31 2 3 6 8 14 1 31 2 3 4 5 7 11 14 34 2 3 4 5 7 8 15 16 3 32 1 2 6 7 8 29 3 5 28 1 6 7 8 10 12 15 31 1 2 4 5 6 8 14 25 3 5 8 9 15 2 4 5 29 1 5 6 9 11 31 1 4 7 8 15 1 2 7 29 1 3 27 1 3 6 19 5 6 7 9 25 1 6 7 ...
result:
ok ok 556 cases (556 test cases)
Test #12:
score: 0
Accepted
time: 71ms
memory: 36088kb
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 3 4 6 8 10 12 17 20 22 25 26 27 29 30 32 33 34 35 37 39 42 44 47 48 49 51 54 58 59 60 61 68 69 70 72 74 75 77 78 81 82 84 85 88 89 90 91 93 94 96 97 98 100 103 110 111 112 114 115 116 120 123 124 127 129 130 133 135 136 139 140 143 145 146 149 150 152 153 160 163 169 171 174 175 176 178 179 ...
result:
ok ok 1 cases (1 test case)
Test #13:
score: 0
Accepted
time: 81ms
memory: 15428kb
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 1 2 3 4 6 8 9 23 1 29 3 5 8 10 11 28 2 3 5 6 5 1 23 6 7 8 9 11 31 2 3 5 10 13 14 15 29 2 3 7 1 26 1 27 2 3 6 9 12 13 24 1 5 7 14 3 5 32 3 4 5 6 10 11 13 14 24 1 2 5 27 1 2 3 6 7 10 32 1 2 3 4 5 9 14 15 30 1 3 5 24 2 3 7 15 2 3 6 26 1 18 1 2 6...
result:
ok ok 556 cases (556 test cases)
Test #14:
score: 0
Accepted
time: 239ms
memory: 33344kb
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 8 11 13 14 15 16 17 19 20 21 26 29 31 36 39 42 45 46 49 51 53 54 55 57 61 62 64 67 68 69 71 73 74 76 78 79 80 81 82 84 85 88 89 91 94 100 101 103 104 109 110 112 113 115 116 120 123 127 130 131 132 133 136 141 147 149 150 151 153 154 155 158 159 161 163 167 168 170 171 173 174 175 177 178 ...
result:
ok ok 1 cases (1 test case)
Test #15:
score: 0
Accepted
time: 129ms
memory: 30476kb
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 1 4 5 6 7 8 11 12 14 15 16 19 23 25 26 27 28 30 31 32 33 34 35 37 38 39 42 43 44 45 46 47 48 49 50 51 53 54 55 56 57 58 59 60 63 65 66 67 68 69 71 72 73 74 75 76 77 79 80 82 83 84 85 86 87 88 91 92 93 94 95 96 98 99 100 101 102 103 104 109 111 112 113 114 115 117 119 120 121 122 124 126 127 1...
result:
ok ok 1 cases (1 test case)
Test #16:
score: 0
Accepted
time: 121ms
memory: 34472kb
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 7 8 9 10 14 15 20 21 22 26 28 29 31 32 33 34 37 41 45 46 47 51 53 54 56 58 59 60 61 63 64 65 66 68 69 70 71 75 76 83 85 89 92 94 97 98 99 101 104 105 110 111 113 118 119 122 125 127 128 129 130 132 133 134 136 138 139 140 143 149 152 153 154 155 160 162 163 164 165 166 168 171 175 176 177 179...
result:
ok ok 1 cases (1 test case)
Test #17:
score: 0
Accepted
time: 73ms
memory: 17640kb
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 7 8 10 11 19 2 3 5 6 7 8 9 10 11 25 2 3 4 5 6 8 9 10 11 12 13 3 4 5 31 2 3 5 6 8 9 11 12 13 14 16 17 18 19 20 21 22 23 24 25 26 27 28 36 1 4 5 8 9 10 13 18 2 3 4 5 20 3 4 6 7 8 20 2 3 4 5 6 8 9 10 11 12 13 14 16 17 18 12 2 3 4 5 8 2 3 4 6 7 8 15 2 3 4 5 6 22 2 3 5 6 7 8 9 11 12 13...
result:
ok ok 556 cases (556 test cases)
Test #18:
score: 0
Accepted
time: 147ms
memory: 38124kb
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 10 11 13 15 16 17 18 19 20 21 23 24 25 27 28 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 100 101 102 103 105 107 108 109 110 111 112 113 115 116 117 119 120 121 122 124 ...
result:
ok ok 1 cases (1 test case)
Extra Test:
score: 0
Extra Test Passed