QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#287648 | #5665. AA Country and King Dreamoon | user224 | RE | 55ms | 30096kb | C++14 | 3.6kb | 2023-12-20 21:06:51 | 2023-12-20 21:06:52 |
Judging History
answer
#include <bits/stdc++.h>
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize(2)
#pragma unroll 5
#define fori(i,a,b) for(int i = a;i <= b;i ++)
#define fore(i,a,b) for(int i = a;i >= b;i --)
#define batbit(x,i) (x | (1ll << i))
#define tatbit(x,i) (x &~ (1 << i))
#define bit(n,i) ((n >> i) & 1)
#define pii pair<int,int>
#define se second
#define fi first
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define pob pop_back
using namespace std;
typedef long long ll;
mt19937 rng (chrono::steady_clock::now().time_since_epoch().count());
int rnd(int l,int r)
{
return l + rng() % (r - l + 1);
}
mt19937 mrand(random_device{}());
int const N = 5e5 + 10;
vector<int> ve[N];
void speed()
{
ios_base::sync_with_stdio(NULL);
cin.tie(NULL);
cout.tie(NULL);
}
int n;
int a[N],ans[N];
int vis[N],h[N],pa[N];
set<int> s;
vector<int> ui,yi;
void reset(int m)
{
s.clear();
ui.clear();
yi.clear();
fori(i,1,m)
{
h[i] = 0;
vis[i] = 0;
pa[i] = 0;
ans[i] = 0;
}
}
bool check()
{
if(!s.empty() && ui.empty()) return true;
int u = *s.begin();
int v = ui.back();
if(!s.empty() && u < v)
return true;
return false;
}
void solve()
{
cin >> n;
int m = 2 * n - 1;
fori(i,1,m) cin >> a[i];
ans[1] = ans[m] = 1;
a[1] = a[m] = 1;
int l = 0,r = 0;
fori(i,1,m)
{
if(a[i]) continue;
if(!l) l = i;
r = i;
}
if(l == 1 && r == m)
{
int cnt = 1;
fori(i,2,m - 1)
{
if(i % 2) ans[i] = 1;
else ans[i] = ++ cnt;
}
fori(i,1,m) cout << ans[i] << " ";
reset(m);
return;
}
if(l == 0 && r == 0)
{
fori(i,1,m) cout << a[i] << " ";
reset(m);
return;
}
int p = 1;
fori(i,1,l - 1)
{
int j = a[i];
if(pa[j]) p = j;
else
{
pa[j] = p;
h[j] = h[p] + 1;
p = j;
}
}
//ans[m] = 1;
int q = 1;
fore(i,m,r + 1)
{
int j = a[i];
if(pa[j]) q = j;
else
{
pa[j] = q;
h[j] = h[q] + 1;
q = j;
}
}
fori(i,1,m) vis[a[i]] ++;
fori(i,1,n)
{
if(vis[i]) continue;
s.insert(i);
}
ll x = p,X = q;
while(x != X)
{
if(h[x] >= h[X])
{
x = pa[x];
if(x != X) ui.pb(x);
}
else
{
X = pa[X];
if(x != X) yi.pb(X);
}
}
reverse(yi.begin(),yi.end());
if(p != q) yi.pb(q);
for(auto v : yi) ui.pb(v);
reverse(ui.begin(),ui.end());
fori(i,1,l - 1) ans[i] = a[i];
fori(i,l,r)
{
if(check())
{
ui.pb(p);
p = *s.begin();
s.erase(s.begin());
ans[i] = p;
}
else
{
ans[i] = ui.back();
p = ui.back();
ui.pob();
}
}
fori(i,r + 1,m) ans[i] = a[i];
fori(i,1,m) cout << ans[i] << " ";
reset(m);
}
int main()
{
speed();
if(fopen("task.inp.txt","r"))
{
freopen("task.inp.txt","r",stdin);
freopen("task.out.txt","w",stdout);
}
if(fopen("euler.inp","r"))
{
freopen("euler.inp","r",stdin);
freopen("euler.out","w",stdout);
}
int t;
cin >> t;
while(t --)
{
solve();
cout << "\n";
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 21428kb
input:
9 5 1 2 3 2 0 2 1 5 1 5 1 2 3 0 0 2 1 5 1 5 1 2 0 0 0 2 1 5 1 5 1 2 0 0 0 0 1 5 1 5 1 0 0 0 0 0 1 5 1 5 1 0 0 0 0 0 0 5 1 5 1 0 0 0 0 0 0 0 1 5 1 0 0 0 0 0 0 0 0 5 0 0 0 0 0 0 0 0 0
output:
1 2 3 2 4 2 1 5 1 1 2 3 2 4 2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1 2...
result:
ok 23077 lines
Test #29:
score: 0
Accepted
time: 26ms
memory: 22120kb
input:
11941 7 1 2 7 5 4 3 4 5 0 0 0 0 0 7 1 2 7 5 4 3 4 5 7 0 1 6 1 7 1 2 7 5 4 3 4 5 7 0 0 6 1 7 1 2 7 5 4 3 4 5 7 0 0 0 1 7 1 2 7 5 4 3 4 5 7 0 0 0 0 7 1 2 7 5 4 3 4 5 7 2 0 6 1 7 1 2 7 5 4 3 4 5 7 2 0 0 1 7 1 2 7 5 4 3 4 5 7 2 0 0 0 7 1 2 7 5 4 3 4 5 7 2 1 0 1 7 1 2 7 5 4 3 4 5 7 2 1 0 0 7 1 2 7 5 4 3 ...
output:
1 2 7 5 4 3 4 5 6 5 7 2 1 1 2 7 5 4 3 4 5 7 2 1 6 1 1 2 7 5 4 3 4 5 7 2 1 6 1 1 2 7 5 4 3 4 5 7 2 1 6 1 1 2 7 5 4 3 4 5 7 2 1 6 1 1 2 7 5 4 3 4 5 7 2 1 6 1 1 2 7 5 4 3 4 5 7 2 1 6 1 1 2 7 5 4 3 4 5 7 2 1 6 1 1 2 7 5 4 3 4 5 7 2 1 6 1 1 2 7 5 4 3 4 5 7 2 1 6 1 1 2 7 5 4 3 4 5 7 2 1 6 1 1 2...
result:
ok 11941 lines
Test #30:
score: 0
Accepted
time: 27ms
memory: 22208kb
input:
2805 40 1 2 1 17 1 7 1 19 1 36 25 36 3 21 3 29 3 23 3 31 15 31 37 39 37 16 37 6 37 31 3 36 8 36 1 14 38 14 20 14 9 14 34 14 1 40 1 24 33 32 33 5 33 22 33 28 33 24 30 24 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 27 1 62 1 21 25 29 25 21 50 34 45 49 45 34 27 38 27 62 27 34 50 51 41 51 60 10 16 7 16 10 28 10 ...
output:
1 2 1 17 1 7 1 19 1 36 25 36 3 21 3 29 3 23 3 31 15 31 37 39 37 16 37 6 37 31 3 36 8 36 1 14 38 14 20 14 9 14 34 14 1 40 1 24 33 32 33 5 33 22 33 28 33 24 30 24 10 11 10 12 10 13 10 18 10 24 1 26 1 27 4 35 4 27 1 1 21 25 29 25 21 50 34 45 49 45 34 27 38 27 62 27 34 50 51 41 51 60 10 16 7 16 10 28 1...
result:
ok 2805 lines
Test #31:
score: 0
Accepted
time: 28ms
memory: 23152kb
input:
2813 85 1 17 1 85 84 14 84 72 84 85 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 26 65 76 82 32 82 44 56 44 11 44 82 24 82 76 74 1 43 71 67 29 6 77 6 29 36 29 67 31 67 27 19 27 7 3 7 4...
output:
1 17 1 85 84 14 84 72 84 85 1 2 1 4 1 9 1 12 1 13 1 15 1 16 1 18 1 20 1 21 1 22 1 23 1 28 1 30 1 33 1 34 1 38 1 39 1 41 1 42 1 45 1 46 1 49 1 51 1 52 1 54 1 57 1 60 1 61 1 63 1 66 1 68 1 69 1 73 1 74 76 65 26 10 78 10 79 10 80 10 26 65 76 82 32 82 44 56 44 11 44 82 24 82 76 74 1 43 71 67 29 6 77 6 2...
result:
ok 2813 lines
Test #32:
score: 0
Accepted
time: 23ms
memory: 21860kb
input:
2846 97 1 12 20 12 38 12 1 8 59 47 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
1 12 20 12 38 12 1 8 59 47 2 3 2 4 2 5 2 6 2 7 2 9 2 11 2 13 2 14 2 16 2 17 2 18 2 19 2 21 2 22 2 23 2 24 2 25 2 26 2 28 2 29 2 30 2 31 2 32 2 34 2 35 2 36 2 37 2 39 2 40 2 41 2 42 2 43 2 44 2 45 2 46 2 47 48 47 49 47 50 47 51 47 52 47 53 47 54 47 55 47 56 47 57 47 58 47 59 8 1 60 1 61 1 62 1 64 1 6...
result:
ok 2846 lines
Test #33:
score: 0
Accepted
time: 28ms
memory: 21956kb
input:
2812 47 1 27 9 33 24 46 28 35 6 20 2 16 3 32 29 21 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 42 12 17 25 36 38 23 45 15 30 41 26 4 47 44 14 3 16 2 20 6 35 28 46 24 33 9 27 1 86 1 60 69 29 86 22 71 26 65 52 46 27 51 16 75 61 5 10 81 77 24 34 63 0...
output:
1 27 9 33 24 46 28 35 6 20 2 16 3 32 29 21 34 5 7 5 8 5 10 5 11 5 13 5 18 5 19 5 22 5 31 5 34 21 29 32 3 14 37 14 39 14 40 14 43 14 44 47 4 26 41 30 15 45 23 38 36 25 17 12 42 12 17 25 36 38 23 45 15 30 41 26 4 47 44 14 3 16 2 20 6 35 28 46 24 33 9 27 1 1 60 69 29 86 22 71 26 65 52 46 27 51 16 75 6...
result:
ok 2812 lines
Test #34:
score: 0
Accepted
time: 27ms
memory: 21944kb
input:
2853 37 1 16 11 7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 32 29 6 9 4 12 8 18 31 10 13 34 37 15 3 2 33 36 26 21 20 22 19 5 28 14 30 25 35 23 27 16 1 48 1 16 7 23 20 26 8 38 27 3 24 17 41 12 36 33 19 48 30 37 46 34 10 42 2 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
1 16 11 7 11 16 17 16 24 16 27 23 35 25 30 14 28 5 19 22 20 21 26 36 33 2 3 15 37 34 13 10 31 18 8 12 4 9 6 29 32 29 6 9 4 12 8 18 31 10 13 34 37 15 3 2 33 36 26 21 20 22 19 5 28 14 30 25 35 23 27 16 1 1 16 7 23 20 26 8 38 27 3 24 17 41 12 36 33 19 48 30 37 46 34 10 42 2 6 2 25 2 42 10 34 46 37 30 ...
result:
ok 2853 lines
Test #35:
score: 0
Accepted
time: 27ms
memory: 23008kb
input:
2818 38 1 30 17 2 28 15 27 35 5 32 24 26 3 12 22 4 18 7 21 8 37 34 33 25 20 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 23 36 11 19 31 9 27 15 28 2 17 30 1 53 1 31 8 23 41 46 29 24 36 15 48 12 25 34 28 47 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
1 30 17 2 28 15 27 35 5 32 24 26 3 12 22 4 18 7 21 8 37 34 33 25 20 6 10 6 13 6 14 6 16 6 20 25 29 25 33 34 37 8 21 7 18 4 22 12 3 26 24 32 5 35 27 9 31 19 11 36 23 38 23 36 11 19 31 9 27 15 28 2 17 30 1 1 31 8 23 41 46 29 24 36 15 48 12 25 34 28 47 2 3 2 6 2 9 2 13 2 14 2 19 2 27 2 30 2 32 2 35 2 ...
result:
ok 2818 lines
Test #36:
score: 0
Accepted
time: 55ms
memory: 30096kb
input:
1507 43 1 29 24 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 70 1 64 12 46 31 14 24 43 7 51 27 23 22 42 67 69 53 68 56 44 8 54 30 13 45 34 29 28 2 38 66 39 17 35 5 40 65 33 63 49 52...
output:
1 29 24 2 3 2 4 2 5 2 6 2 7 2 8 2 9 2 10 2 11 2 12 2 13 2 14 2 15 2 16 2 17 2 18 2 19 2 20 2 21 2 22 2 23 2 24 25 24 26 24 27 24 28 24 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 1 64 12 46 31 14 24 43 7 51 27 23 22 42 67 69 53 68 56 44 8 54 30 13 45 34 29 28 2 38 66 ...
result:
ok 1507 lines
Test #37:
score: 0
Accepted
time: 29ms
memory: 24676kb
input:
2 60000 1 38990 31835 24650 31835 38990 27077 38990 53018 44774 53018 38990 27653 31899 29043 28272 29043 52124 29043 31899 44900 31899 10295 57102 44638 37209 39249 37209 1614 21680 1614 37209 44638 57986 51871 57986 41778 57986 44638 42094 44638 19175 49095 36798 34736 15883 34736 36798 49095 1917...
output:
1 38990 31835 24650 31835 38990 27077 38990 53018 44774 53018 38990 27653 31899 29043 28272 29043 52124 29043 31899 44900 31899 10295 57102 44638 37209 39249 37209 1614 21680 1614 37209 44638 57986 51871 57986 41778 57986 44638 42094 44638 19175 49095 36798 34736 15883 34736 36798 49095 19175 1368 1...
result:
ok 2 lines
Test #38:
score: 0
Accepted
time: 32ms
memory: 24516kb
input:
2 60001 1 25936 1 59262 23200 59683 14618 9485 6034 52890 6034 33413 49906 32050 49906 33413 6034 9485 33137 9485 26158 9485 17847 992 36864 992 3796 992 38649 17344 38649 992 17847 33213 17847 32799 2178 51324 2178 32799 17847 9485 29978 54605 29978 4723 29978 9485 14618 15268 14618 55477 14618 384...
output:
1 25936 1 59262 23200 59683 14618 9485 6034 52890 6034 33413 49906 32050 49906 33413 6034 9485 33137 9485 26158 9485 17847 992 36864 992 3796 992 38649 17344 38649 992 17847 33213 17847 32799 2178 51324 2178 32799 17847 9485 29978 54605 29978 4723 29978 9485 14618 15268 14618 55477 14618 38416 47898...
result:
ok 2 lines
Test #39:
score: 0
Accepted
time: 29ms
memory: 23192kb
input:
4 60001 1 58398 8763 26373 25026 26373 8763 21610 42614 53373 42614 34857 26394 5306 26394 34857 42614 21610 5167 21610 9728 46428 9728 50693 3672 50693 42938 50693 9728 11329 951 54443 951 19779 32939 19779 39137 7400 39137 56477 38236 56477 40583 56477 59614 56477 5894 56477 52938 35489 52938 5647...
output:
1 58398 8763 26373 25026 26373 8763 21610 42614 53373 42614 34857 26394 5306 26394 34857 42614 21610 5167 21610 9728 46428 9728 50693 3672 50693 42938 50693 9728 11329 951 54443 951 19779 32939 19779 39137 7400 39137 56477 38236 56477 40583 56477 59614 56477 5894 56477 52938 35489 52938 56477 39137 ...
result:
ok 4 lines
Test #40:
score: 0
Accepted
time: 25ms
memory: 23428kb
input:
5 30001 1 6837 29673 29555 7305 14902 9631 14902 7305 29555 29673 1276 29673 6837 20728 1985 14191 13092 14191 4499 14191 1985 20728 4145 20728 6837 7310 6837 1 15447 13104 15447 1 26935 4014 26935 5939 12852 2170 6826 2170 12852 910 12852 5939 199 29372 903 29372 199 5939 6495 12651 2834 12651 6495...
output:
1 6837 29673 29555 7305 14902 9631 14902 7305 29555 29673 1276 29673 6837 20728 1985 14191 13092 14191 4499 14191 1985 20728 4145 20728 6837 7310 6837 1 15447 13104 15447 1 26935 4014 26935 5939 12852 2170 6826 2170 12852 910 12852 5939 199 29372 903 29372 199 5939 6495 12651 2834 12651 6495 12637 3...
result:
ok 5 lines
Test #41:
score: 0
Accepted
time: 27ms
memory: 23292kb
input:
6 30001 1 1236 1058 16708 16367 25882 18222 25882 16367 21515 10787 21515 10341 21515 18687 21515 16367 16708 4514 11111 4514 16708 20859 14640 1976 14640 20859 16708 1058 24391 1058 1236 23617 13307 23468 13307 16567 13307 23617 2259 20767 416 1538 3887 1538 416 20767 19157 1455 19157 20767 7272 20...
output:
1 1236 1058 16708 16367 25882 18222 25882 16367 21515 10787 21515 10341 21515 18687 21515 16367 16708 4514 11111 4514 16708 20859 14640 1976 14640 20859 16708 1058 24391 1058 1236 23617 13307 23468 13307 16567 13307 23617 2259 20767 416 1538 3887 1538 416 20767 19157 1455 19157 20767 7272 20767 2259...
result:
ok 6 lines
Test #42:
score: 0
Accepted
time: 23ms
memory: 23588kb
input:
7 20001 1 19450 16570 673 1697 10976 1697 15457 969 10785 3162 8063 3162 10785 969 7112 969 15457 1697 673 16570 19203 3262 17973 3262 4128 3262 4759 3262 17503 7255 17280 7255 17503 7113 17503 3262 19674 10691 6623 7131 12599 2260 2060 12440 2060 5722 2060 11078 2060 2260 12599 7131 6623 10691 1967...
output:
1 19450 16570 673 1697 10976 1697 15457 969 10785 3162 8063 3162 10785 969 7112 969 15457 1697 673 16570 19203 3262 17973 3262 4128 3262 4759 3262 17503 7255 17280 7255 17503 7113 17503 3262 19674 10691 6623 7131 12599 2260 2060 12440 2060 5722 2060 11078 2060 2260 12599 7131 6623 10691 19674 6385 2...
result:
ok 7 lines
Test #43:
score: 0
Accepted
time: 38ms
memory: 23600kb
input:
9 20001 1 6496 7147 10728 6357 1495 7741 6512 7741 1495 6357 10728 8794 14430 8794 8510 8794 10728 7147 160 7147 18057 12851 18057 7147 6496 5391 11936 2500 3317 488 6981 16607 6981 488 3317 9021 3317 2500 13440 15229 8466 4489 14436 4489 8466 15229 13440 2500 18972 3401 8543 3401 18972 2500 11936 2...
output:
1 6496 7147 10728 6357 1495 7741 6512 7741 1495 6357 10728 8794 14430 8794 8510 8794 10728 7147 160 7147 18057 12851 18057 7147 6496 5391 11936 2500 3317 488 6981 16607 6981 488 3317 9021 3317 2500 13440 15229 8466 4489 14436 4489 8466 15229 13440 2500 18972 3401 8543 3401 18972 2500 11936 2248 1460...
result:
ok 9 lines
Test #44:
score: 0
Accepted
time: 36ms
memory: 24020kb
input:
10 15001 1 12647 2703 1643 2703 12647 1 6901 5839 14029 5839 2639 10845 2639 2742 2639 5839 7071 10352 13991 10352 7071 4905 5786 4905 7071 8718 7126 8718 10457 8718 7071 2567 7263 2567 10505 13229 10505 14277 4855 14277 6836 4140 13913 4140 6836 4093 6836 14277 10505 2567 9863 2567 7071 5839 2689 1...
output:
1 12647 2703 1643 2703 12647 1 6901 5839 14029 5839 2639 10845 2639 2742 2639 5839 7071 10352 13991 10352 7071 4905 5786 4905 7071 8718 7126 8718 10457 8718 7071 2567 7263 2567 10505 13229 10505 14277 4855 14277 6836 4140 13913 4140 6836 4093 6836 14277 10505 2567 9863 2567 7071 5839 2689 12425 2689...
result:
ok 10 lines
Test #45:
score: 0
Accepted
time: 27ms
memory: 22640kb
input:
11 15001 1 2516 14902 88 14902 2516 3762 1680 3762 2516 1 3468 12730 4558 3153 1846 3850 1846 5533 2753 5533 1846 3153 4558 12730 11200 12730 3468 5454 9877 9584 786 9584 9877 6123 2733 6123 9877 5454 6060 1904 6060 5454 7324 12221 7324 14079 7324 5454 3468 11361 14557 11361 3468 14172 3273 12723 32...
output:
1 2516 14902 88 14902 2516 3762 1680 3762 2516 1 3468 12730 4558 3153 1846 3850 1846 5533 2753 5533 1846 3153 4558 12730 11200 12730 3468 5454 9877 9584 786 9584 9877 6123 2733 6123 9877 5454 6060 1904 6060 5454 7324 12221 7324 14079 7324 5454 3468 11361 14557 11361 3468 14172 3273 12723 3273 11356 ...
result:
ok 11 lines
Test #46:
score: 0
Accepted
time: 29ms
memory: 22180kb
input:
12 12001 1 6246 8304 6246 4086 6535 10007 6535 4086 6246 1 8798 4488 8798 8389 1173 6199 1173 8389 8798 4101 11867 4101 8554 4101 4624 6494 7348 6494 4624 4101 6525 7094 2605 2972 1367 2972 5748 11421 5748 2972 2705 10579 2705 620 2705 2972 2605 4622 2605 7094 6525 6582 6525 9061 11236 7045 11236 55...
output:
1 6246 8304 6246 4086 6535 10007 6535 4086 6246 1 8798 4488 8798 8389 1173 6199 1173 8389 8798 4101 11867 4101 8554 4101 4624 6494 7348 6494 4624 4101 6525 7094 2605 2972 1367 2972 5748 11421 5748 2972 2705 10579 2705 620 2705 2972 2605 4622 2605 7094 6525 6582 6525 9061 11236 7045 11236 5525 11236 ...
result:
ok 12 lines
Test #47:
score: 0
Accepted
time: 21ms
memory: 22468kb
input:
7 12001 1 674 4851 1524 8809 1524 2686 1524 4851 6496 2848 6949 7382 6949 2848 1650 2848 11873 8951 7997 8951 11873 10748 11873 2848 6496 10629 6496 4851 674 7949 3968 6382 5576 6382 1020 3922 1020 6538 1020 6382 3968 5121 6858 5121 3777 5121 3968 7949 1999 5154 5646 5154 1999 7949 4227 8356 4227 80...
output:
1 674 4851 1524 8809 1524 2686 1524 4851 6496 2848 6949 7382 6949 2848 1650 2848 11873 8951 7997 8951 11873 10748 11873 2848 6496 10629 6496 4851 674 7949 3968 6382 5576 6382 1020 3922 1020 6538 1020 6382 3968 5121 6858 5121 3777 5121 3968 7949 1999 5154 5646 5154 1999 7949 4227 8356 4227 8096 9849 ...
result:
ok 7 lines
Test #48:
score: -100
Runtime Error
input:
1 300000 1 219291 136908 12972 259346 182232 141184 37796 92821 23695 7295 14724 162011 101696 30677 97223 15322 265386 222 7200 226460 76583 272681 163593 126597 255851 237329 176400 74517 259507 169133 73244 203550 253579 253480 79247 168106 216570 238081 212303 197915 160794 236536 177796 25823 1...