QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#185527 | #2550. Lion and Zebra | kkio | AC ✓ | 79ms | 33652kb | C++20 | 4.4kb | 2023-09-22 11:02:44 | 2023-09-22 11:02:44 |
Judging History
answer
#include <bits/stdc++.h>
//#include "PrettyDebug.hpp"
using namespace std;
namespace FastIO {
struct IO {
char ibuf[(1 << 20) + 1], *iS, *iT, obuf[(1 << 20) + 1], *oS;
IO() : iS(ibuf), iT(ibuf), oS(obuf) {} ~IO() { fwrite(obuf, 1, oS - obuf, stdout); }
#if ONLINE_JUDGE
#define gh() (iS == iT ? iT = (iS = ibuf) + fread(ibuf, 1, (1 << 20) + 1, stdin), (iS == iT ? EOF : *iS++) : *iS++)
#else
#define gh() getchar()
#endif
inline bool eof (const char &ch) { return ch == ' ' || ch == '\n' || ch == '\r' || ch == 't' || ch == EOF; }
inline long long read() {
char ch = gh();
long long x = 0;
bool t = 0;
while (ch < '0' || ch > '9') t |= ch == '-', ch = gh();
while (ch >= '0' && ch <= '9') x = (x << 1) + (x << 3) + (ch ^ 48), ch = gh();
return t ? ~(x - 1) : x;
}
inline void read (char *s) {
char ch = gh(); int l = 0;
while (eof(ch)) ch = gh();
while (!eof(ch)) s[l++] = ch, ch = gh();
}
inline void read (double &x) {
char ch = gh(); bool t = 0;
while (ch < '0' || ch > '9') t |= ch == '-', ch = gh();
while (ch >= '0' && ch <= '9') x = x * 10 + (ch ^ 48), ch = gh();
if (ch != '.') return t && (x = -x), void(); ch = gh();
for (double cf = 0.1; '0' <= ch && ch <= '9'; ch = gh(), cf *= 0.1) x += cf * (ch ^ 48);
t && (x = -x);
}
inline void pc (char ch) {
#ifdef ONLINE_JUDGE
if (oS == obuf + (1 << 20) + 1) fwrite(obuf, 1, oS - obuf, stdout), oS = obuf;
*oS++ = ch;
#else
putchar(ch);
#endif
}
template<typename _Tp>
inline void write (_Tp x) {
static char stk[64], *tp = stk;
if (x < 0) x = ~(x - 1), pc('-');
do *tp++ = x % 10, x /= 10;
while (x);
while (tp != stk) pc((*--tp) | 48);
}
inline void write (char *s) {
int n = strlen(s);
for (int i = 0; i < n; i++) pc(s[i]);
}
} io;
inline long long read () { return io.read(); }
template<typename Tp>
inline void read (Tp &x) { io.read(x); }
template<typename _Tp>
inline void write (_Tp x) { io.write(x); }
}
using namespace FastIO;
constexpr int maxn=1e5+10;
int n,q;vector<int> G[maxn];
int anc[maxn][19],dep[maxn];
inline void ancdfs(int u,int fa)
{
anc[u][0]=fa;dep[u]=dep[fa]+1;
for(int i=1;i<=18;i++)anc[u][i]=anc[anc[u][i-1]][i-1];
for(int v:G[u])
if(v!=fa)
ancdfs(v,u);
}
inline int getlca(int x,int y)
{
if(dep[x]<dep[y])swap(x,y);
for(int i=18;i>=0;i--)if(dep[anc[x][i]]>=dep[y])x=anc[x][i];
if(x==y)return x;
for(int i=18;i>=0;i--)if(anc[x][i]^anc[y][i])x=anc[x][i],y=anc[y][i];
return anc[x][0];
}
inline int k_anc(int x,int k)
{
for(int i=18;i>=0;i--)if(k>>i&1)x=anc[x][i];
return x;
}
inline int pathto(int x,int y,int d)
{
int z=getlca(x,y);
int disxz=dep[x]-dep[z],diszy=dep[y]-dep[z];
if(disxz>=d)return k_anc(x,d);
d=disxz+diszy-d;return k_anc(y,d);
}
int upd[maxn],dwd[maxn],ftd[maxn],udd[maxn];
set<int> sdep[maxn];
void downdfs(int u,int fa)
{
ftd[u]=u,dwd[u]=0;
udd[u]=u,upd[u]=0;
for(int v:G[u])
if(v!=fa)
{
downdfs(v,u);
dwd[u]=max(dwd[u],dwd[v]+1);
if(dwd[u]==dwd[v]+1)ftd[u]=ftd[v];
sdep[u].insert(dwd[v]+1);
}
}
void updfs(int u,int fa)
{
int mxd1=-1e9,pd=0,mxd2=-1e9,gd=0;
for(int v:G[u])
if(v!=fa)
{
if(dwd[v]+1>mxd1)mxd2=mxd1,mxd1=dwd[v]+1,gd=pd,pd=v;
else if(dwd[v]+1>mxd2)mxd2=dwd[v]+1,gd=v;
}
for(int v:G[u])
if(v!=fa)
{
if(v!=pd)upd[v]=upd[u]>mxd1?(udd[v]=udd[u],upd[u]+1):(udd[v]=ftd[pd],mxd1+1);
else upd[v]=upd[u]>mxd2?(udd[v]=udd[u],upd[u]+1):(udd[v]=ftd[gd],mxd2+1);
sdep[v].insert(upd[v]);
updfs(v,u);
}
}
int main()
{
// freopen("data.in","r",stdin);
// freopen("1.out","w",stdout);
n=read(),q=read();
for(int i=1,u,v;i<n;i++)
{
u=read(),v=read();
G[u].push_back(v);G[v].push_back(u);
}
ancdfs(1,1);
downdfs(1,1);
updfs(1,1);
for(int t=1;t<=q;t++)
{
int v=read(),d=read();
//debug(t,v,d);
int s=dwd[v]>upd[v]?ftd[v]:udd[v];
//debug(s,dwd[v],upd[v]);
int ed=(d-1)/2,c=pathto(v,s,ed),step=0;
//debug(ed,c);
if(d>2)
{
int p=pathto(v,s,ed-1);
//debug(p,dwd[p],upd[p]);
if(dep[c]<dep[p])step=max(step,dwd[p]+1);
else step=max(step,upd[c]);
}
if(d%2==0&&sdep[c].count(d/2))step=max(step,d/2);
//debug(step);
int ans=step+d-ed;
write(ans),io.pc('\n');
}
}
详细
Test #1:
score: 100
Accepted
time: 3ms
memory: 16432kb
input:
5 2 1 2 2 3 3 4 4 5 1 4 3 1
output:
4 1
result:
ok 2 number(s): "4 1"
Test #2:
score: 0
Accepted
time: 0ms
memory: 17648kb
input:
11 2 1 2 2 3 1 4 4 5 1 6 6 7 7 8 1 9 9 10 10 11 3 2 10 4
output:
2 5
result:
ok 2 number(s): "2 5"
Test #3:
score: 0
Accepted
time: 0ms
memory: 16220kb
input:
7 2 1 2 2 3 3 4 4 5 4 6 6 7 5 4 5 3
output:
5 3
result:
ok 2 number(s): "5 3"
Test #4:
score: 0
Accepted
time: 0ms
memory: 15524kb
input:
11 9 1 2 2 3 1 4 4 5 1 6 6 7 7 8 1 9 9 10 10 11 7 2 3 2 3 5 3 4 4 4 1 1 8 1 4 3 5 3
output:
3 2 5 4 5 1 1 4 3
result:
ok 9 numbers
Test #5:
score: 0
Accepted
time: 0ms
memory: 17856kb
input:
175 7862 70 167 102 128 3 76 46 42 104 112 53 46 52 99 172 116 48 158 40 138 11 103 26 8 59 147 163 88 71 133 130 134 98 73 115 104 28 166 5 173 148 61 38 45 173 73 96 10 36 58 124 59 94 73 137 136 79 164 21 11 27 161 9 152 37 101 123 131 145 68 111 156 153 51 61 73 4 93 54 157 33 69 47 12 144 115 1...
output:
1 2 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 1 2 28 29 30 31 32 33 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 1 2 27 28 29 30 31 32 33 34 35 36 38 39 40 4...
result:
ok 7862 numbers
Test #6:
score: 0
Accepted
time: 0ms
memory: 16004kb
input:
121 3803 42 27 26 2 120 41 72 6 39 35 98 53 102 79 21 74 90 98 88 13 18 107 68 91 53 16 52 112 111 39 46 12 116 87 10 77 22 80 115 10 55 17 109 49 89 61 60 11 86 1 65 47 79 24 20 76 35 25 63 84 73 28 47 60 85 88 104 55 54 97 62 118 45 115 110 18 17 75 96 93 37 14 57 67 7 62 30 21 24 78 81 90 25 69 4...
output:
1 2 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 42 1 2 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 40 41 42 1 2 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 ...
result:
ok 3803 numbers
Test #7:
score: 0
Accepted
time: 0ms
memory: 15184kb
input:
97 2467 13 69 63 62 45 53 48 79 28 7 4 25 12 54 94 92 39 10 82 48 47 87 84 9 25 17 46 43 26 8 61 96 88 55 69 86 96 41 2 13 22 45 8 23 74 28 40 89 71 7 15 81 60 49 58 90 19 67 97 4 95 39 55 51 67 46 81 42 44 7 72 66 29 44 36 73 49 36 50 32 91 78 43 75 9 21 27 20 68 12 53 74 65 71 93 29 66 63 1 22 34 ...
output:
1 2 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 1 2 12 13 14 15 16 17 18 19 20 21 22 23 24 25 27 28 29 30 31 32 33 34 1 2 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 1 2 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 29 30 31 32 33 34 1 2 11 12 13 14 15 16 17 18 1...
result:
ok 2467 numbers
Test #8:
score: 0
Accepted
time: 4ms
memory: 15104kb
input:
175 7862 95 145 169 90 166 160 9 168 35 166 149 173 156 85 8 19 120 88 96 117 155 66 101 10 63 94 151 120 92 4 28 129 106 141 135 151 59 121 137 157 103 46 5 135 107 41 18 21 150 63 133 37 26 13 121 112 123 101 162 72 154 106 69 62 19 150 14 146 67 49 21 79 93 64 148 20 172 156 131 17 97 104 108 119...
output:
1 2 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 1 2 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 55 56 57 58 59 60 1 2 3 4 5 6 7 8 9 10 1...
result:
ok 7862 numbers
Test #9:
score: 0
Accepted
time: 0ms
memory: 14652kb
input:
73 1419 48 1 51 28 46 36 33 28 55 17 7 4 50 66 38 53 56 42 47 21 21 30 32 50 19 26 39 45 66 73 37 28 63 10 41 29 68 69 8 24 29 62 53 37 9 72 24 68 18 43 5 65 42 71 58 49 26 8 22 13 57 16 11 22 40 41 65 7 6 56 36 20 3 34 69 70 59 18 4 27 25 19 49 59 10 55 44 35 2 47 61 9 73 58 71 28 16 28 60 63 72 15...
output:
1 2 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 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 1 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 1 2 8 9 10 11 12 13 14 15 16 17 18 19 20 21 23 24 25 26 1 2 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2...
result:
ok 1419 numbers
Test #10:
score: 0
Accepted
time: 3ms
memory: 15144kb
input:
6 1 1 2 2 3 3 4 2 5 5 6 4 4
output:
4
result:
ok 1 number(s): "4"
Test #11:
score: 0
Accepted
time: 78ms
memory: 32912kb
input:
100000 100000 6924 97704 51795 94079 85721 1451 51436 64102 22887 53289 62490 70035 53601 3516 35670 75950 99585 97911 10866 63419 36928 36457 72357 2042 9384 15284 31844 68380 60095 40587 47577 71274 7890 30139 12208 24775 31163 44315 9019 68509 79484 86871 77532 24228 80137 97728 54885 50661 91242...
output:
37 28 38 18 7 5 39 34 4 41 37 5 2 44 21 17 26 37 36 16 21 4 46 1 42 3 1 9 9 39 47 13 41 38 45 44 26 39 45 46 3 16 45 12 47 23 6 41 33 21 9 16 30 40 33 48 36 35 47 33 29 2 19 30 34 31 3 5 21 43 45 35 38 36 40 37 43 35 45 3 19 17 41 5 29 23 25 9 8 35 6 43 39 27 42 43 11 9 15 3 8 14 33 48 22 38 41 33 3...
result:
ok 100000 numbers
Test #12:
score: 0
Accepted
time: 77ms
memory: 33428kb
input:
100000 100000 42282 30296 32445 78256 56902 40954 19474 36833 91639 68626 83080 31330 98921 32700 6718 99589 12196 5630 97304 22128 95782 26160 13705 84648 64449 17914 76353 52676 28263 87235 53437 82852 15225 80995 26860 91588 60875 92100 93609 49098 88175 36302 51489 39871 52683 61718 49164 88788 ...
output:
39 39 47 53 1 30 24 45 23 31 33 21 48 53 29 36 44 51 23 41 11 5 4 52 14 37 28 11 14 50 7 52 45 49 50 15 7 43 50 41 52 39 51 47 40 37 46 16 30 6 20 49 33 37 52 50 34 14 20 27 26 9 48 6 13 39 33 31 37 30 45 9 8 53 10 36 43 51 52 42 10 48 35 17 19 30 45 48 46 23 53 14 52 41 23 27 40 48 44 40 6 51 40 8 ...
result:
ok 100000 numbers
Test #13:
score: 0
Accepted
time: 76ms
memory: 32984kb
input:
100000 100000 55517 72561 57027 29585 45706 2823 2394 23433 21535 67879 92240 18097 39085 49545 84428 45808 24446 37296 70993 97928 91362 54994 79961 41807 38618 12324 11746 8044 43354 61206 32273 9447 28024 29352 89670 74424 49301 16346 40849 50697 65996 52500 8495 2053 20121 62379 55835 29750 4058...
output:
18 45 38 39 38 17 36 20 44 48 2 25 2 15 17 44 27 47 34 12 45 48 30 14 11 1 21 41 46 16 28 10 42 34 29 44 2 7 24 12 10 32 11 2 45 7 15 46 48 23 48 24 10 13 16 8 45 17 44 16 6 32 3 25 40 27 2 38 43 33 10 4 18 44 49 43 20 39 29 19 22 46 20 1 23 45 18 17 42 39 25 1 9 32 49 28 29 23 45 49 30 5 13 20 4 41...
result:
ok 100000 numbers
Test #14:
score: 0
Accepted
time: 67ms
memory: 33544kb
input:
100000 100000 25725 42263 47298 98644 47253 87037 28943 68022 3551 53636 10120 33018 21603 22351 78911 6431 25900 83457 30369 88240 94762 96610 56090 58635 66912 75735 3577 23621 8963 35615 94482 58894 53741 56218 10330 92900 49089 42572 77150 65602 77346 9754 37339 5097 15499 42578 3910 1332 14677 ...
output:
19 3 1 29 47 43 36 46 21 12 48 1 43 39 40 1 37 8 14 26 38 36 2 28 16 39 32 37 34 7 37 34 27 39 5 33 44 47 36 28 6 1 28 1 29 11 27 32 38 42 31 4 47 33 46 30 46 12 46 41 33 3 44 22 32 33 10 27 38 33 37 6 48 23 3 42 37 16 7 16 43 46 16 25 32 8 21 30 2 29 48 13 30 13 24 45 48 31 31 11 25 28 33 43 26 1 3...
result:
ok 100000 numbers
Test #15:
score: 0
Accepted
time: 70ms
memory: 33200kb
input:
100000 100000 32635 69602 2024 8670 75 63730 40870 36380 57393 31314 37951 43995 18189 38583 45384 67274 32901 56348 53174 36059 80844 97185 8281 35787 12645 74203 72334 36061 63243 22663 69735 24584 74597 62557 12320 23534 98044 46153 53914 99182 9223 3611 76912 12564 9721 7667 83341 70699 46925 37...
output:
29 31 50 39 1 50 21 2 10 1 37 50 47 38 37 1 47 2 42 4 45 34 45 50 1 8 28 19 21 26 6 19 47 46 1 32 37 39 40 37 49 47 32 23 28 42 37 42 45 14 18 40 15 48 45 1 21 44 38 14 34 38 46 21 24 24 35 18 7 12 7 42 41 38 30 39 16 3 43 4 48 20 23 24 46 9 49 31 6 37 14 45 18 45 18 11 48 27 46 39 5 7 38 29 47 33 4...
result:
ok 100000 numbers
Test #16:
score: 0
Accepted
time: 77ms
memory: 33652kb
input:
100000 100000 2090 15125 15528 36207 65946 9860 39848 20085 82087 68377 36150 5042 72837 46248 99401 31608 7202 16022 57478 82452 35354 65698 86954 63275 51124 95423 69231 19521 76088 41414 33564 5898 11792 17966 33875 86052 33703 36086 29996 75827 17464 8386 63966 339 75670 29780 96892 83214 66919 ...
output:
9 18 7 40 37 8 46 29 44 41 43 31 23 29 7 47 46 47 1 10 41 45 39 46 34 17 21 16 19 4 4 4 44 12 19 1 42 46 41 13 30 46 30 27 20 6 18 37 46 18 34 31 39 39 42 24 45 29 10 41 43 43 31 23 22 43 44 12 15 17 6 34 9 36 17 46 39 40 22 43 41 18 24 2 32 33 18 37 43 45 27 42 2 6 11 43 6 36 47 13 1 3 36 23 32 14 ...
result:
ok 100000 numbers
Test #17:
score: 0
Accepted
time: 79ms
memory: 32968kb
input:
100000 100000 46130 66890 49341 33707 66797 40714 98750 83235 71721 3233 64098 78299 97650 70538 57960 7573 91981 23575 33385 72548 72564 32 11420 89112 27754 66236 96581 28071 16464 8512 13927 23341 66941 75104 1244 13640 96331 47805 79346 28049 70447 57766 7783 31593 48346 35721 79623 16491 33991 ...
output:
28 32 6 41 3 5 17 46 31 36 36 6 22 44 11 12 19 37 21 5 21 34 3 14 3 44 40 14 15 7 45 30 26 38 41 47 44 45 38 14 25 8 1 1 28 16 24 44 45 42 25 1 25 38 16 41 13 4 13 41 2 8 4 33 35 17 39 43 6 28 27 35 8 47 43 7 47 33 40 37 35 39 2 36 12 45 26 36 45 33 32 44 25 40 7 43 29 47 18 40 28 24 45 19 47 39 3 3...
result:
ok 100000 numbers
Test #18:
score: 0
Accepted
time: 74ms
memory: 33040kb
input:
100000 100000 88117 28731 35275 9078 23418 68425 24714 54904 40329 99237 52290 2726 82242 9858 47496 26112 64100 98650 80095 52846 31173 39475 48358 80762 71753 76081 19409 86762 86381 54930 20898 7513 416 49703 4828 84220 44328 38729 51519 52146 98741 64552 56575 80221 92170 83676 62062 13986 70132...
output:
39 25 21 12 47 25 3 34 42 47 5 47 10 33 21 3 14 10 7 17 21 46 13 5 37 4 19 6 29 29 8 42 47 20 2 45 32 29 10 7 12 24 42 42 16 44 18 11 14 20 41 23 28 19 1 2 42 47 8 35 8 28 42 5 45 25 33 38 45 4 28 14 38 9 35 17 48 29 38 43 45 41 25 29 1 32 4 14 23 16 1 2 28 46 48 37 28 37 39 28 18 22 26 40 32 44 46 ...
result:
ok 100000 numbers
Test #19:
score: 0
Accepted
time: 72ms
memory: 32980kb
input:
100000 100000 65508 24631 35274 74195 29865 5767 45372 49565 8880 4030 94634 21032 67495 65045 22790 30116 7823 37979 86709 90128 44568 76244 41397 3786 77253 92117 38508 71100 25012 26598 87624 77048 36540 50871 81319 34294 83369 99189 63455 64159 63906 54158 26057 63804 22117 37119 12418 50920 628...
output:
15 44 39 3 15 29 32 21 2 10 1 40 39 39 35 37 6 37 23 12 10 24 11 13 27 32 12 24 30 3 35 34 24 41 36 30 7 31 11 8 36 25 39 24 42 37 30 28 32 26 27 22 39 29 1 44 42 31 37 44 38 44 17 1 35 22 5 3 18 26 33 29 42 25 3 16 25 40 39 27 3 2 32 18 16 2 12 14 38 7 19 10 27 34 26 22 39 13 9 2 36 44 26 39 44 15 ...
result:
ok 100000 numbers
Test #20:
score: 0
Accepted
time: 72ms
memory: 32964kb
input:
100000 100000 33130 564 63726 5938 10358 12086 23228 78381 62051 43807 81692 12480 56621 82059 15114 53216 84252 6982 17326 841 21019 75992 55017 92927 61948 99799 25901 52627 74928 16348 43125 85142 46549 54021 93242 83147 94279 93417 54933 9421 762 21280 64550 14837 97637 48426 3334 78916 84761 67...
output:
13 12 9 41 32 34 42 13 24 17 37 21 7 19 46 25 46 36 47 6 1 37 13 30 41 38 8 43 48 26 16 23 17 35 37 24 34 31 19 15 28 27 28 8 40 40 23 23 14 38 45 14 1 12 43 23 21 46 47 30 41 39 2 11 28 47 27 29 37 7 35 35 30 9 6 38 9 3 42 6 38 27 31 43 13 18 36 37 48 40 41 7 26 19 17 12 46 46 12 47 36 29 26 14 13 ...
result:
ok 100000 numbers
Test #21:
score: 0
Accepted
time: 0ms
memory: 17820kb
input:
1000 1000 300 264 498 47 737 398 496 247 981 863 253 45 66 910 396 453 413 798 958 316 744 961 66 437 615 296 622 58 361 783 478 320 296 567 886 923 485 464 367 153 745 994 410 649 399 617 624 429 998 948 400 546 94 111 365 423 401 304 763 712 404 324 108 699 530 336 599 366 727 990 68 748 21 75 182...
output:
14 24 8 3 14 23 16 8 7 4 17 24 18 7 24 12 17 2 1 8 23 23 18 7 11 17 7 22 21 17 2 4 11 4 20 12 22 9 21 11 17 4 19 1 15 15 16 21 11 17 14 10 17 11 3 21 9 22 15 12 10 12 1 22 1 10 17 19 4 19 19 18 19 23 24 13 10 12 14 20 22 1 15 22 12 12 17 11 19 2 19 18 6 5 24 17 11 13 22 22 13 19 1 7 17 20 16 16 19 5...
result:
ok 1000 numbers
Test #22:
score: 0
Accepted
time: 0ms
memory: 14668kb
input:
1000 1000 300 658 302 341 165 264 787 131 603 525 786 675 159 220 99 480 980 210 231 993 120 634 724 636 867 502 964 700 475 479 60 644 233 771 887 226 95 842 684 748 111 323 776 617 68 472 792 388 769 184 436 638 67 686 739 379 286 652 770 726 394 444 447 205 640 991 824 274 212 665 11 672 650 632 ...
output:
8 24 22 1 14 15 20 5 22 20 13 5 19 4 16 20 11 24 23 20 5 3 24 1 17 19 11 1 22 1 23 8 9 1 11 22 10 6 16 17 1 3 4 22 13 6 21 14 12 24 13 12 21 15 5 20 22 8 1 8 9 10 7 15 14 9 15 1 23 5 2 9 9 1 16 22 20 7 4 24 7 13 7 21 6 2 10 15 23 7 9 10 11 12 19 19 1 23 20 15 23 8 12 1 8 3 6 11 8 23 3 3 2 14 8 19 23...
result:
ok 1000 numbers
Test #23:
score: 0
Accepted
time: 0ms
memory: 16136kb
input:
1000 1000 627 733 984 591 494 364 615 230 549 661 617 316 60 925 356 947 542 762 318 114 138 272 411 931 460 299 932 344 237 600 996 424 128 301 195 880 293 991 923 915 677 544 892 144 205 287 563 796 766 488 591 72 712 889 672 241 387 220 170 195 724 264 844 353 563 326 779 851 339 532 99 819 101 6...
output:
3 18 11 17 3 6 24 3 6 15 14 16 18 9 17 4 7 3 19 24 19 15 18 22 6 24 17 24 10 11 1 16 24 17 6 12 7 9 18 1 16 11 23 21 9 3 8 7 3 19 10 21 21 22 20 21 2 7 4 19 15 17 10 19 24 23 8 24 10 11 6 13 14 4 8 15 12 22 5 1 19 20 15 12 20 17 19 4 17 13 20 18 18 9 13 2 10 3 14 6 10 18 24 2 15 16 15 5 15 4 19 9 2 ...
result:
ok 1000 numbers
Test #24:
score: 0
Accepted
time: 0ms
memory: 15304kb
input:
1000 1000 390 305 920 735 782 62 918 692 214 89 493 41 876 433 98 99 833 23 66 409 435 620 6 502 807 120 896 978 153 510 993 559 869 49 452 986 33 501 707 176 537 166 712 739 644 9 125 697 66 373 296 395 646 652 364 47 145 57 82 177 380 333 696 664 646 956 142 938 857 327 943 487 956 780 994 945 926...
output:
3 5 6 9 14 1 21 11 5 17 1 16 20 11 4 16 23 24 23 6 10 17 2 5 5 22 21 21 3 11 4 24 23 11 3 19 14 23 8 21 12 7 19 14 11 18 19 19 17 20 3 14 19 22 4 6 15 24 15 18 5 14 17 3 23 24 24 2 12 18 13 21 23 23 23 3 12 20 23 20 20 5 24 20 24 16 17 2 8 9 6 23 14 13 21 24 24 8 22 17 16 24 22 17 23 23 18 8 19 23 7...
result:
ok 1000 numbers
Test #25:
score: 0
Accepted
time: 3ms
memory: 14816kb
input:
1000 1000 665 688 464 411 564 575 295 359 74 92 326 436 157 525 604 218 883 263 506 761 623 936 622 464 647 87 302 629 184 967 113 366 970 562 814 200 205 816 486 902 49 586 737 809 655 790 469 282 829 22 682 190 54 79 718 794 856 137 757 994 263 41 968 241 981 349 467 39 788 951 817 870 512 830 829...
output:
10 22 16 20 7 21 9 19 24 2 22 22 20 23 15 20 23 5 10 14 23 25 21 4 11 21 23 23 1 21 24 19 25 21 5 16 1 18 25 24 16 4 7 11 1 10 24 14 7 12 9 18 9 1 25 2 21 6 9 17 2 23 20 25 19 11 19 22 4 12 4 23 20 17 25 14 6 7 21 11 14 5 23 3 15 4 20 16 16 11 16 19 23 14 22 17 20 12 20 18 3 15 7 12 19 22 16 15 9 25...
result:
ok 1000 numbers
Test #26:
score: 0
Accepted
time: 0ms
memory: 16384kb
input:
1000 1000 275 525 202 926 107 360 541 707 88 680 866 65 202 412 219 786 351 800 299 31 680 445 226 751 31 925 960 7 811 764 3 220 858 913 163 431 874 253 56 333 665 466 726 39 753 791 517 287 175 403 526 336 352 180 30 225 804 193 264 845 630 3 10 153 76 310 672 89 962 746 412 492 888 97 683 22 481 ...
output:
16 3 16 21 18 13 10 14 15 1 21 18 15 20 13 2 10 1 7 1 19 13 11 3 21 18 19 17 23 14 18 8 8 23 13 3 20 23 24 8 5 5 20 15 24 5 19 23 18 7 18 13 24 4 21 9 11 16 18 3 21 24 4 18 1 19 18 16 11 23 23 24 20 16 20 2 1 23 24 4 18 3 22 11 18 24 5 17 21 7 20 2 7 22 1 9 9 16 2 3 21 19 6 6 21 22 21 18 20 16 21 19...
result:
ok 1000 numbers
Test #27:
score: 0
Accepted
time: 0ms
memory: 16328kb
input:
1000 1000 994 68 410 102 604 42 351 361 104 975 873 980 492 255 133 491 254 821 115 986 375 812 409 257 621 10 517 583 510 24 666 50 66 247 493 572 108 139 282 931 929 723 904 731 850 96 508 643 943 317 389 755 698 305 995 566 835 373 283 437 948 946 785 597 482 420 368 937 206 331 276 225 406 472 9...
output:
7 5 20 6 9 11 8 13 17 9 2 1 5 24 3 3 1 2 1 21 21 9 18 8 10 22 20 11 20 10 20 23 3 11 20 9 18 3 6 11 1 10 14 13 8 16 24 20 1 19 3 9 17 17 22 14 7 14 19 2 6 6 22 2 8 22 15 21 23 15 5 20 14 3 12 14 16 19 20 19 1 24 8 1 11 5 23 17 23 17 1 4 18 24 21 7 9 11 17 21 11 3 7 15 18 3 24 12 8 18 3 15 1 9 23 3 7...
result:
ok 1000 numbers
Test #28:
score: 0
Accepted
time: 3ms
memory: 15316kb
input:
1000 1000 738 507 521 177 725 185 908 693 6 778 853 813 985 264 367 711 519 756 113 915 774 587 668 687 515 486 735 355 803 860 779 79 47 356 726 548 499 779 901 538 796 802 803 343 997 240 169 715 277 108 908 58 135 354 708 419 308 1 572 733 240 725 804 135 530 348 259 162 5 459 385 398 985 667 311...
output:
17 19 22 20 9 2 15 20 12 6 5 4 7 12 22 13 22 3 3 24 18 8 22 19 19 5 3 14 12 20 10 13 7 19 18 18 23 7 6 14 20 19 23 11 6 13 7 23 10 3 21 23 2 17 3 21 19 16 4 17 9 8 5 15 20 22 24 20 1 15 19 12 2 9 24 1 6 8 16 17 18 3 1 6 22 7 3 2 17 15 15 12 21 1 20 22 24 16 14 21 1 22 22 14 10 2 21 20 1 20 21 2 2 20...
result:
ok 1000 numbers
Test #29:
score: 0
Accepted
time: 0ms
memory: 15600kb
input:
1000 1000 825 27 229 698 621 678 319 749 333 223 328 106 941 689 814 562 383 16 963 61 883 162 621 470 762 299 98 643 872 380 973 803 553 886 700 312 280 580 907 644 409 711 831 682 765 642 136 534 376 476 885 116 181 769 217 535 809 544 115 157 956 88 941 906 315 770 880 912 937 944 22 141 478 135 ...
output:
14 9 8 14 20 11 5 5 6 14 5 1 14 13 2 17 19 12 14 21 18 17 12 9 3 18 16 10 15 18 1 21 18 3 11 9 9 20 10 11 18 1 18 2 1 19 2 4 3 19 9 12 12 3 11 12 20 11 18 20 20 19 18 20 7 19 1 7 20 3 16 21 5 7 12 3 3 9 9 21 17 20 6 5 13 17 5 20 1 8 4 6 11 9 5 8 17 14 14 20 5 15 4 2 15 9 16 16 14 16 7 15 21 18 18 20...
result:
ok 1000 numbers
Test #30:
score: 0
Accepted
time: 0ms
memory: 16660kb
input:
1000 1000 377 450 232 866 181 307 877 212 171 487 79 335 833 912 998 353 829 638 400 847 99 585 659 289 803 695 371 516 778 543 24 154 79 737 325 663 621 136 279 739 928 46 770 725 530 205 200 482 163 952 418 837 620 809 768 32 125 304 706 823 979 70 407 409 696 391 909 451 130 775 198 854 285 575 5...
output:
9 3 11 12 4 18 22 24 19 16 15 17 11 19 8 1 14 23 12 20 8 20 15 12 6 17 10 15 18 24 14 18 17 6 12 7 23 17 10 3 1 7 21 2 9 23 16 22 1 9 19 18 9 15 13 21 7 11 14 17 7 1 1 1 14 21 6 22 18 14 17 2 18 3 21 6 23 19 24 1 8 15 2 18 23 5 19 20 1 2 20 6 5 3 19 9 24 6 19 9 24 13 5 15 8 5 8 7 1 11 19 1 1 22 2 7 ...
result:
ok 1000 numbers
Test #31:
score: 0
Accepted
time: 4ms
memory: 15324kb
input:
182 7085 147 64 128 42 84 142 36 55 63 147 93 126 133 144 1 46 131 16 140 82 174 120 143 154 56 62 117 151 75 112 69 109 47 29 166 76 115 142 91 138 111 58 10 91 129 94 155 142 30 45 121 115 16 20 57 107 182 41 158 17 164 165 39 177 68 163 127 176 72 174 80 117 130 105 46 178 160 127 118 122 6 61 54...
output:
1 2 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 1 2 15 16 17 18 19 20 21 22 23 24 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 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 ...
result:
ok 7085 numbers
Test #32:
score: 0
Accepted
time: 5ms
memory: 15328kb
input:
202 8341 126 147 87 164 106 168 32 47 124 94 40 145 102 54 49 166 17 51 19 18 139 177 127 75 169 34 163 161 180 152 85 106 201 18 141 74 194 144 11 39 39 10 189 124 34 26 62 60 116 77 137 12 82 78 58 137 61 170 42 127 131 188 72 197 9 109 37 71 26 181 138 42 95 102 123 134 25 169 120 28 76 160 78 68...
output:
1 2 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 1 2 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 1 2 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 2...
result:
ok 8341 numbers
Test #33:
score: 0
Accepted
time: 0ms
memory: 16060kb
input:
208 7760 69 179 148 91 77 10 203 121 63 128 180 126 185 140 23 109 36 130 33 175 80 9 178 17 103 194 142 63 191 189 42 107 121 136 123 204 160 42 29 24 163 157 62 29 167 47 189 21 162 76 27 106 119 62 44 85 195 39 190 146 138 161 174 183 205 204 118 52 144 171 84 1 101 50 75 163 152 165 145 103 39 9...
output:
1 2 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 43 44 45 46 47 48 49 50 51 52 1 2 17 18 19 20 21 22 23 24 25 26 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 1 2 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 4...
result:
ok 7760 numbers
Test #34:
score: 0
Accepted
time: 0ms
memory: 16060kb
input:
207 8268 28 167 195 84 56 60 73 66 149 96 124 62 4 28 132 69 95 49 138 201 203 164 58 68 83 35 154 127 91 22 104 131 207 84 186 191 43 205 184 93 70 148 181 172 140 115 198 113 172 55 92 192 143 6 187 180 99 84 71 79 119 20 153 14 180 202 38 197 109 47 32 203 136 84 85 104 142 118 67 101 134 44 202 ...
output:
1 2 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 1 2 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 1 2 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 ...
result:
ok 8268 numbers
Test #35:
score: 0
Accepted
time: 5ms
memory: 15364kb
input:
169 6034 86 140 167 131 42 59 54 119 63 71 164 2 143 125 107 124 115 46 94 104 105 87 6 91 103 71 133 62 154 115 85 47 82 92 88 165 168 6 129 66 83 88 150 48 140 113 11 57 139 71 14 90 27 117 3 72 81 121 87 110 95 71 114 99 84 25 46 19 102 84 75 26 79 141 118 60 17 168 7 18 21 65 157 29 39 71 60 52 ...
output:
1 2 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 1 2 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 1 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 39 40 41 42 43 44 45 46 47 48 49 50 51 52 1 2 14 15 30 31 32 33 34...
result:
ok 6034 numbers