QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#509981 | #5450. 比赛 | Antekb | 18 | 80ms | 4020kb | C++14 | 3.4kb | 2024-08-08 20:20:12 | 2024-08-08 20:20:12 |
Judging History
answer
#include "bits/stdc++.h" /** keep-include */
using namespace std;
#define rep(i, b, e) for(int i = (b); i <= (e); i++)
#define per(i, b, e) for(int i = (e); i >= (b); i--)
#define FOR(i, b, e) rep(i, b, (e) - 1)
#define SZ(x) int(x.size())
#define all(x) x.begin(), x.end()
#define pb push_back
#define mp make_pair
#define st first
#define nd second
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
auto &operator<<(auto &o, pair<auto, auto> p) {
return o << "(" << p.st << ", " << p.nd << ")"; }
auto operator<<(auto &o, auto x)->decltype(end(x), o) {
o << "{"; int i=0; for(auto e: x) o << ", " + 2*!i++ << e;
return o << "}"; }
#ifdef LOCAL
#define deb(x...) cerr << "[" #x "]: ", [](auto...$) { \
((cerr << $ << "; "),...) << endl; }(x)
#else
#define deb(...)
#endif
const int N=2005;
bool good(vector<int> V, vector<vector<vi> > &common){
for(int i=0; i<V.size(); i++)
{
int a=V[i], b=V[(i+1)%V.size()], c=V[(i+2)%V.size()];
for(int j:common[a][b]){
if(binary_search(all(common[b][c]), j)){
return 0;
}
}
}
return 1;
}
void solve() {
int n, m;
cin>>n>>m;
vector<vi> V(m);
vector<vector<vi> > common(n, vector<vi>(n, vi(0)));
vector<bitset<N> > kto(m);
int maks=0;
for(int i=0; i<m; i++){
int k;
cin>>k;
maks=max(maks, k);
V[i].resize(k);
for(int &j:V[i]){
cin>>j;
j--;
kto[i][j]=1;
}
for(int &j:V[i]){
for(int &l:V[i]){
common[j][l].pb(i);
}
}
}
if(maks>(2*n)/3){
cout<<-1<<"\n";
return;
}
vector<int> kol;
for(int ii=1; ii<=n; ii++){
deb(V, kol);
bitset<N> zle;
zle.flip();
for(int j:kol)zle[j]=0;
if(ii<=n-3){
for(int i=0; i<m; i++){
if(kto[i].count()>(2*(n-ii))/3){
zle&=kto[i];
}
}
}
assert(zle.any());
int t=zle._Find_first();
kol.pb(t);
for(int i=0; i<m; i++){
kto[i][t]=0;
}
}
vector<int> dobre;
for(int i=0; i<3; i++){
dobre.pb(kol.back());
kol.pop_back();
}
while(kol.size()){
deb(kol, dobre);
bool ok=0;
for(int i=0; i<dobre.size(); i++){
deb("b");
vector<int> dobre2;
dobre2=dobre;
rotate(dobre2.begin(), dobre2.begin()+i, dobre2.end());
dobre2.pb(kol.back());
rotate(dobre2.begin(), dobre2.end()-3, dobre2.end());
auto it=dobre2.begin(), it2=dobre2.begin()+7;
if(dobre2.size()<7)it2=dobre2.end();
sort(it, it2);
deb("a");
while(true){
if(good(dobre2, common)){
ok=1;
break;
}
if(!next_permutation(it, it2))break;
}
if(ok==1){
dobre=dobre2;
break;
}
}
assert(ok==1);
kol.pop_back();
}
assert(good(dobre, common));
for(int i:dobre){
cout<<i+1<<" ";
}
cout<<"\n";
}
int main() {
cin.tie(0)->sync_with_stdio(0);
int tt = 1;
cin>>tt;
FOR(te, 0, tt) solve();
return 0;
}
详细
Subtask #1:
score: 6
Accepted
Test #1:
score: 6
Accepted
time: 4ms
memory: 3600kb
input:
248 9 3 3 3 4 5 3 1 2 3 4 6 7 8 9 8 1 4 3 4 5 6 9 2 5 1 2 3 4 5 3 6 7 8 6 1 4 3 4 5 6 7 2 3 3 4 5 3 1 2 3 9 3 4 1 2 3 4 3 4 5 6 3 6 7 8 7 1 4 4 5 6 7 8 2 3 6 7 8 3 2 3 4 8 2 4 1 2 3 4 4 4 5 6 7 3 0 9 3 3 2 3 4 3 7 8 9 3 4 5 6 6 1 5 1 2 3 4 5 9 2 4 1 2 3 4 3 6 7 8 9 3 3 6 7 8 3 3 4 5 3 1 2 3 8 1 8 1 ...
output:
1 2 5 6 3 7 9 4 8 1 2 3 4 7 6 8 5 1 2 6 3 4 7 9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test #8:
score: 6
Accepted
time: 0ms
memory: 3568kb
input:
2 12 3 7 1 3 4 8 9 11 12 3 1 5 6 3 6 7 12 15 1 10 1 2 3 4 5 6 7 8 9 10
output:
1 2 3 4 5 9 11 6 10 12 8 7 1 2 11 3 4 13 10 5 15 8 6 12 9 7 14
result:
ok 2 testcases
Test #9:
score: 6
Accepted
time: 12ms
memory: 3584kb
input:
231 6 3 3 1 4 6 3 6 5 2 3 1 3 2 11 2 5 9 2 8 1 6 7 10 7 5 4 3 8 11 4 1 4 2 3 4 1 9 2 7 7 1 6 4 2 3 9 3 8 5 4 6 1 3 3 1 4 4 1 3 2 3 1 8 2 3 8 3 7 3 1 8 6 13 2 6 13 5 10 7 4 9 8 12 2 4 8 6 3 11 1 4 1 3 1 4 2 5 1 4 1 3 4 5 12 10 4 10 5 1 8 3 4 10 7 3 12 10 9 3 4 9 11 4 1 9 3 7 3 4 6 1 6 6 5 11 2 7 12 4...
output:
1 2 4 3 5 6 3 1 4 5 2 8 11 6 7 10 9 -1 -1 1 2 3 4 5 6 -1 1 2 3 4 5 8 7 6 1 2 5 3 4 10 8 6 9 12 7 11 13 -1 -1 1 2 3 4 5 9 12 6 10 11 8 7 1 2 3 5 4 9 11 6 7 10 8 1 2 3 4 5 9 6 8 10 7 11 1 2 5 3 4 7 8 11 9 12 6 10 1 2 3 4 5 6 1 2 3 4 5 7 9 6 8 -1 -1 -1 2 1 4 3 6 14 5 12 15 7 8 10 11 9 13 -1...
result:
ok 231 testcases
Test #10:
score: 6
Accepted
time: 14ms
memory: 3644kb
input:
219 4 1 3 3 1 2 4 1 3 3 2 1 7 2 4 4 2 1 5 3 7 3 6 7 4 4 4 1 3 2 3 7 6 1 3 7 4 5 3 2 5 6 7 4 3 4 6 1 4 6 3 5 7 3 4 2 3 3 1 2 7 15 8 3 6 12 14 3 15 14 2 3 7 10 14 3 8 14 11 8 6 1 5 9 11 3 10 15 3 14 9 4 7 4 12 13 8 7 2 1 3 13 14 5 9 2 3 5 9 3 6 6 4 8 1 3 7 9 5 4 2 7 6 3 5 7 1 8 4 9 3 9 5 6 3 5 1 2 3 4...
output:
-1 -1 1 2 3 4 5 6 7 1 2 5 3 6 4 7 1 2 3 5 4 7 6 1 2 3 4 5 12 9 7 13 15 6 14 10 8 11 2 1 3 5 4 7 9 6 8 1 2 3 4 9 5 7 6 8 -1 -1 3 1 2 4 6 12 14 5 15 9 7 10 11 8 13 1 2 3 4 6 8 11 5 9 10 7 1 3 2 4 11 6 7 9 5 12 8 10 1 2 3 4 5 6 1 2 4 3 5 11 9 6 8 10 7 1 3 2 4 5 1 2 3 4 5 9 8 6 10 12 7 11 2...
result:
ok 219 testcases
Test #11:
score: 6
Accepted
time: 10ms
memory: 3808kb
input:
213 8 4 3 4 7 3 5 4 1 2 6 5 3 7 8 5 3 6 3 8 4 1 3 4 1 2 6 1 3 2 3 1 5 0 9 7 3 9 1 5 3 7 2 9 3 2 8 1 3 8 3 9 3 4 5 8 5 6 3 4 1 7 3 3 2 5 14 9 3 11 12 5 8 1 5 9 10 14 6 8 2 3 3 1 7 5 3 8 4 11 13 3 11 10 7 3 10 13 12 3 7 14 13 3 14 12 3 4 12 4 9 7 11 2 5 5 3 7 10 11 7 9 1 8 2 6 5 4 11 2 6 5 10 1 7 6 3 ...
output:
1 2 3 4 5 8 6 7 -1 1 2 4 3 5 6 1 2 3 4 5 2 1 3 5 4 9 8 6 7 1 3 2 4 5 12 14 7 9 13 6 10 11 8 1 3 2 4 10 5 9 7 8 11 6 1 3 2 4 5 9 10 6 11 7 8 3 2 1 1 2 3 4 5 6 9 8 7 10 1 2 4 3 6 8 14 5 12 15 7 9 11 13 10 1 2 3 5 4 8 9 6 7 1 2 3 4 5 8 11 6 14 12 13 15 10 7 9 1 2 3 5 6 9 8 4 7 1 2 3 4 5 7 ...
result:
ok 213 testcases
Test #12:
score: 6
Accepted
time: 15ms
memory: 3588kb
input:
226 13 7 6 10 7 5 9 1 8 3 11 13 9 3 5 12 13 3 13 7 4 3 13 6 1 3 13 8 3 7 10 4 12 6 2 11 3 5 1 4 1 3 4 5 5 1 3 3 4 2 13 9 4 3 8 1 7 3 13 8 9 3 7 13 4 3 8 5 11 3 10 5 7 3 12 6 7 3 8 10 12 5 13 5 2 1 12 7 3 11 9 4 6 10 2 6 4 3 5 2 1 3 3 6 5 3 4 1 3 3 4 6 2 14 11 3 14 1 10 4 5 14 2 6 3 2 9 7 3 4 7 14 7 ...
output:
1 2 3 5 4 8 12 9 6 11 7 10 13 -1 1 2 3 5 4 1 2 3 5 4 8 10 13 6 9 12 11 7 1 2 3 4 5 6 1 2 3 4 5 10 14 6 9 13 7 11 12 8 -1 3 2 1 1 3 2 5 4 7 8 6 1 4 2 3 6 7 9 5 8 10 1 2 3 5 6 4 2 1 3 4 8 5 9 6 10 11 7 12 1 4 9 6 7 14 13 15 11 10 12 5 2 3 8 1 2 3 11 6 7 14 4 8 10 13 9 12 5 -1 1 2 3 6 4 5 ...
result:
ok 226 testcases
Test #13:
score: 6
Accepted
time: 13ms
memory: 3644kb
input:
233 9 3 3 9 3 2 3 1 8 3 4 5 6 4 1 8 2 4 3 1 2 7 5 5 1 6 8 4 3 0 15 17 3 10 4 5 3 13 5 15 6 9 7 8 15 10 2 3 6 15 11 4 13 14 9 12 3 9 5 11 5 8 1 4 13 11 3 11 10 14 3 2 12 11 3 4 15 14 3 8 12 5 4 7 4 6 12 6 3 14 1 5 2 6 3 7 11 3 3 4 9 3 3 13 10 3 3 12 15 1 14 9 3 1 2 4 3 4 10 9 3 5 11 2 8 14 1 7 6 8 12...
output:
1 2 3 4 5 9 6 7 8 1 4 2 5 3 6 8 7 3 2 1 1 4 2 3 10 5 12 6 15 13 7 9 11 8 14 2 1 3 4 6 9 12 5 11 8 7 13 14 10 3 2 1 1 2 3 4 5 8 10 6 9 11 12 7 -1 -1 1 2 5 4 6 7 9 3 8 1 2 3 4 5 6 7 1 2 3 4 5 8 12 6 9 10 7 11 13 1 2 3 5 4 -1 1 2 3 4 5 7 8 6 10 12 9 11 1 2 3 4 9 6 10 12 7 8 5 11 13 1 2 4 3...
result:
ok 233 testcases
Test #14:
score: 6
Accepted
time: 14ms
memory: 3608kb
input:
218 3 1 3 1 2 3 10 5 3 8 9 10 3 2 7 10 6 6 8 1 5 2 3 4 4 9 5 7 3 4 10 6 11 2 8 1 10 5 3 4 2 8 7 4 9 11 6 1 3 1 3 2 1 3 9 5 4 5 7 1 8 3 7 6 9 3 9 5 3 5 1 3 4 6 2 3 9 8 2 8 2 4 3 4 6 7 5 3 2 8 5 1 8 5 3 2 4 6 3 4 1 7 4 7 6 8 5 3 5 4 3 4 8 2 1 3 12 2 6 3 9 4 2 7 12 7 5 7 11 6 8 1 10 10 2 3 9 3 6 4 10 2...
output:
-1 1 4 2 3 9 5 6 10 7 8 -1 -1 1 2 5 3 7 4 9 6 8 1 2 4 3 5 7 8 6 1 2 5 6 3 7 8 4 2 1 3 5 7 9 6 4 10 12 8 11 1 2 3 4 5 7 9 6 8 10 1 2 3 4 5 9 8 6 11 10 7 12 1 2 3 4 9 5 12 7 13 15 6 14 10 8 11 -1 1 2 3 4 7 6 9 5 8 10 1 2 3 4 7 5 6 1 2 3 4 7 5 8 6 1 2 3 5 6 4 7 1 2 3 4 5 6 8 7 1 2 3 4 5 6 ...
result:
ok 218 testcases
Test #15:
score: 6
Accepted
time: 10ms
memory: 3596kb
input:
222 4 0 10 1 6 10 7 6 4 3 5 11 2 5 1 5 4 6 8 7 11 1 7 2 10 9 3 6 1 5 3 4 6 1 2 7 7 3 1 5 4 3 5 7 3 3 1 6 3 3 2 6 5 3 3 2 4 3 7 1 2 3 6 7 4 15 12 3 13 2 12 4 13 4 14 11 4 8 6 4 2 3 10 12 4 4 9 1 10 13 3 4 1 3 3 13 6 5 4 10 3 2 14 3 1 7 2 8 3 15 5 8 7 12 11 9 3 10 11 6 4 14 12 6 1 7 4 3 5 6 7 3 3 2 5 ...
output:
1 2 3 4 1 3 2 4 5 9 6 7 8 10 1 2 4 3 5 9 11 6 7 10 8 -1 1 2 3 6 5 7 4 1 2 3 5 4 8 12 6 15 13 7 9 14 11 10 1 2 3 6 4 5 7 3 1 4 6 2 7 8 5 3 2 1 1 2 3 4 5 6 1 2 4 3 5 14 7 6 13 15 9 8 12 10 11 2 1 4 5 3 6 7 8 1 2 3 4 5 1 2 3 5 4 1 2 3 4 5 8 7 6 1 2 3 4 5 10 9 7 11 8 6 1 2 4 3 5 1 2 3 5 ...
result:
ok 222 testcases
Test #16:
score: 6
Accepted
time: 14ms
memory: 3672kb
input:
228 6 1 5 5 3 4 2 1 5 1 4 4 5 3 2 10 2 6 6 7 4 10 5 3 5 2 4 9 8 1 6 4 3 2 4 3 3 5 3 1 3 1 4 6 3 6 2 5 9 2 3 7 4 6 3 5 7 9 9 6 4 1 5 6 3 3 7 4 6 4 7 8 9 2 3 1 4 2 3 9 3 4 3 4 8 5 7 2 4 6 5 7 1 4 5 4 3 2 15 11 4 2 1 8 11 3 1 10 14 3 7 5 1 3 1 13 6 6 6 15 7 4 2 14 3 11 5 14 3 10 11 15 3 9 6 11 3 7 11 1...
output:
-1 -1 1 3 2 4 5 9 6 7 8 10 1 2 3 6 4 5 1 2 3 5 4 7 9 6 8 1 2 3 4 6 9 7 5 8 1 2 3 6 5 4 7 1 2 3 4 6 9 14 11 13 15 5 12 7 8 10 -1 1 2 3 4 5 8 11 10 7 15 6 13 9 14 12 3 2 1 1 3 2 4 9 6 14 5 8 10 11 13 12 7 1 4 2 3 7 5 10 6 9 8 1 3 4 5 2 7 8 6 2 1 3 8 4 6 9 5 7 1 2 4 3 5 6 7 4 1 2 5 3 8 9 1...
result:
ok 228 testcases
Subtask #3:
score: 6
Accepted
Dependency #1:
100%
Accepted
Test #17:
score: 6
Accepted
time: 62ms
memory: 4020kb
input:
66 43 106 3 42 1 38 4 3 16 13 39 3 42 37 8 3 5 2 37 3 35 40 19 4 8 10 6 12 3 2 42 32 3 8 28 5 3 37 11 31 3 35 1 30 3 12 24 26 5 13 1 5 12 36 3 24 37 43 4 16 34 20 17 3 34 30 2 3 16 1 10 3 20 3 19 3 28 31 35 3 2 27 3 4 36 16 24 30 3 7 4 24 3 41 14 31 3 23 14 16 4 36 26 17 42 3 29 37 3 3 1 40 3 3 20 2...
output:
1 2 3 4 5 19 37 6 20 39 7 29 40 8 34 21 9 22 28 10 43 33 11 23 30 12 25 35 31 13 41 14 24 38 16 26 42 15 17 32 27 36 18 1 2 3 6 4 15 19 5 17 12 7 23 13 8 16 22 14 20 9 10 18 21 11 1 3 2 4 6 24 22 14 5 25 7 19 17 9 12 20 10 8 15 18 21 16 23 11 13 1 2 3 4 5 15 34 6 17 23 7 30 31 8 22 16 9 27 18 12 ...
result:
ok 66 testcases
Test #18:
score: 6
Accepted
time: 68ms
memory: 3864kb
input:
57 33 60 3 21 20 19 3 17 25 30 3 20 33 16 4 21 23 24 29 3 13 26 15 3 27 7 15 3 4 30 20 3 5 16 13 3 1 11 16 3 31 13 9 3 12 26 17 3 10 26 20 3 5 25 31 3 27 2 24 3 8 7 21 3 18 24 17 3 27 10 8 4 27 32 3 16 3 20 14 31 3 17 13 27 3 12 5 24 4 12 6 21 16 3 16 19 9 3 24 20 25 3 9 24 14 3 9 23 26 11 32 5 17 2...
output:
1 5 2 3 29 4 14 6 28 30 7 16 21 8 26 17 23 9 31 10 18 27 11 19 32 12 24 33 13 20 25 15 22 1 2 3 5 4 6 8 7 35 21 22 38 9 29 39 11 23 32 10 24 42 12 36 45 13 27 31 14 25 37 15 33 43 16 28 40 19 26 44 17 20 34 18 41 30 1 2 3 6 4 9 29 5 25 7 17 8 20 37 10 32 34 11 21 26 12 19 30 27 13 33 14 22 31 23 1...
result:
ok 57 testcases
Test #19:
score: 6
Accepted
time: 56ms
memory: 3840kb
input:
65 17 17 3 6 17 14 4 17 9 16 7 4 5 17 4 3 4 15 11 8 17 3 11 4 14 5 11 7 3 1 12 3 3 16 8 3 8 5 12 3 3 15 13 3 3 2 14 8 13 2 10 1 9 8 4 6 3 4 7 15 4 14 5 13 7 3 17 2 12 4 2 16 11 5 3 9 15 5 5 16 14 12 15 10 26 21 7 23 10 25 9 7 3 21 3 15 9 20 3 20 25 13 3 14 21 5 3 14 15 23 16 12 6 10 2 15 17 8 24 5 1...
output:
1 3 2 4 11 6 14 5 12 13 7 15 16 8 10 17 9 1 2 3 4 5 7 24 12 18 6 13 25 23 8 26 9 15 21 10 16 19 11 20 22 17 14 2 1 3 4 5 10 15 6 14 21 7 17 11 8 19 16 9 12 20 13 18 1 2 4 3 15 5 18 6 20 16 7 11 19 8 13 9 10 21 12 14 22 23 17 1 2 4 3 5 13 18 6 14 25 7 20 22 8 17 12 9 16 24 10 21 19 15 11 23 1 2 ...
result:
ok 65 testcases
Test #20:
score: 6
Accepted
time: 67ms
memory: 3908kb
input:
65 26 43 3 6 5 22 3 1 4 26 3 7 14 26 3 19 2 24 3 10 19 13 3 9 7 19 3 21 22 1 3 22 20 24 3 9 2 17 3 4 20 15 10 20 23 2 6 13 8 12 7 25 1 3 22 11 23 3 2 18 22 3 19 12 5 3 3 17 12 3 10 20 14 3 4 10 2 3 1 14 3 3 23 14 5 3 4 7 11 3 15 1 19 3 15 6 17 3 26 12 22 3 17 23 26 3 21 20 17 3 4 9 6 3 11 14 2 3 24 ...
output:
1 2 3 4 17 5 24 7 18 13 6 14 26 9 20 21 8 23 16 15 12 22 10 19 25 11 1 2 4 3 13 5 23 20 6 26 7 15 24 8 21 30 9 22 28 10 16 19 11 17 29 27 12 25 14 18 1 2 3 4 5 13 9 6 14 15 8 10 16 7 11 12 1 2 3 4 5 27 33 6 19 29 7 20 40 8 37 38 10 21 28 9 22 41 12 42 30 11 24 35 23 14 34 13 31 36 15 32 25 16 26 ...
result:
ok 65 testcases
Test #21:
score: 6
Accepted
time: 80ms
memory: 3820kb
input:
63 41 101 3 7 25 14 3 5 39 22 3 22 38 32 3 19 8 12 3 19 23 32 3 2 40 16 4 22 24 9 16 3 20 6 10 3 6 27 21 3 22 11 21 3 2 30 8 3 35 16 20 3 33 9 26 4 21 41 35 18 4 33 18 4 16 3 21 34 5 5 1 18 22 10 8 3 31 7 33 4 9 21 23 38 3 1 25 16 3 29 3 32 3 2 32 20 4 35 25 39 8 3 36 30 32 3 33 21 40 3 9 41 6 3 38 ...
output:
1 2 4 3 5 31 38 18 6 26 7 19 33 8 41 32 9 40 20 10 27 36 34 21 12 22 11 28 13 37 23 14 29 35 15 24 30 16 25 39 17 1 2 3 13 4 5 23 7 20 27 6 24 28 8 15 16 9 21 30 10 17 25 11 26 29 18 12 22 14 19 1 3 2 4 25 5 27 6 14 15 7 20 21 16 9 24 8 30 17 10 29 22 12 18 23 19 11 31 13 26 28 1 2 3 4 5 14 9 6 1...
result:
ok 63 testcases
Test #22:
score: 6
Accepted
time: 57ms
memory: 4008kb
input:
65 17 19 8 5 2 11 14 7 1 12 17 3 11 8 15 6 4 16 8 17 3 10 6 15 3 6 9 14 13 3 11 9 4 3 1 16 9 3 12 10 9 3 5 10 15 3 4 12 6 3 9 7 8 3 6 16 11 3 13 4 5 3 7 13 16 3 15 12 16 3 7 10 6 3 5 8 6 3 1 13 8 3 13 11 10 3 1 15 4 17 21 7 11 6 15 2 16 10 7 4 12 8 7 9 4 12 3 13 15 3 1 4 7 4 13 8 16 17 3 3 17 7 3 12...
output:
1 3 2 4 5 10 14 6 12 13 7 9 17 8 15 16 11 1 2 3 5 4 12 16 7 9 10 6 14 11 8 15 17 13 1 2 3 4 5 25 33 6 16 18 19 34 7 8 32 36 9 37 20 10 21 26 11 30 27 12 23 28 22 13 35 14 29 38 15 24 31 17 1 2 3 4 5 18 19 6 12 16 7 13 21 8 17 22 9 14 23 10 15 20 11 1 2 3 4 5 24 12 6 19 21 8 17 13 14 7 20 9 23 18...
result:
ok 65 testcases
Test #23:
score: 6
Accepted
time: 73ms
memory: 3892kb
input:
68 32 57 3 15 17 27 3 26 3 19 3 25 4 13 3 4 16 1 3 16 30 25 3 31 10 1 3 17 22 10 3 22 30 29 3 5 32 27 3 29 6 32 3 1 28 5 3 25 8 5 3 24 5 3 3 25 2 10 3 32 22 16 3 11 9 3 3 19 17 1 3 10 23 3 3 23 15 22 3 2 16 6 3 30 6 9 3 24 1 13 3 27 24 29 3 1 9 8 17 31 7 26 17 21 2 24 11 28 14 30 4 18 8 20 32 23 3 2...
output:
2 1 3 4 5 21 25 7 14 22 8 15 23 6 24 30 9 16 32 10 18 27 11 28 29 12 26 31 13 20 19 17 1 2 3 4 5 13 22 6 17 25 7 20 15 9 12 19 8 14 21 11 18 24 10 16 23 1 2 5 3 4 20 15 7 17 27 8 28 21 6 16 24 11 9 29 10 12 19 14 22 18 25 13 23 26 1 5 2 3 16 4 9 6 10 12 7 14 13 11 8 15 1 2 4 3 5 26 18 32 37 6 19...
result:
ok 68 testcases
Test #24:
score: 6
Accepted
time: 51ms
memory: 3784kb
input:
67 26 37 3 9 24 16 3 20 5 16 4 12 14 3 11 4 18 15 9 23 6 19 2 10 16 12 18 3 8 15 3 5 21 7 18 6 11 4 17 7 15 19 3 20 21 15 4 1 25 12 7 5 2 11 22 15 5 3 9 22 12 3 12 24 21 3 1 16 21 3 7 10 8 3 25 17 2 3 11 4 19 4 13 16 14 7 3 12 6 5 3 25 11 13 4 8 11 17 16 8 26 19 8 21 14 25 5 9 4 2 7 20 9 3 7 5 23 3 ...
output:
2 1 3 5 4 16 23 13 7 26 6 14 18 8 21 22 15 17 20 9 10 24 11 19 25 12 2 1 3 5 8 15 11 6 9 14 4 13 16 7 10 12 1 3 2 4 19 5 14 13 6 27 7 15 25 8 17 23 20 9 28 10 16 24 11 18 26 12 22 21 1 2 3 7 4 15 34 5 16 21 6 28 32 17 8 22 9 27 33 10 18 29 11 19 23 12 20 30 13 25 31 14 24 26 1 2 3 4 22 27 5 6 30...
result:
ok 67 testcases
Subtask #4:
score: 0
Time Limit Exceeded
Test #25:
score: 0
Time Limit Exceeded
input:
5 400 1 266 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:
result:
Subtask #5:
score: 0
Time Limit Exceeded
Test #36:
score: 0
Time Limit Exceeded
input:
5 400 1 266 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:
result:
Subtask #6:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
0%
Subtask #7:
score: 0
Skipped
Dependency #4:
0%
Subtask #8:
score: 0
Skipped
Dependency #5:
0%
Subtask #9:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
0%