QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#116105#5280. Depot Rearrangementyoungsystem#0 101ms17320kbC++202.8kb2023-06-28 09:42:312024-05-31 14:20:38

Judging History

你现在查看的是最新测评结果

  • [2024-05-31 14:20:38]
  • 评测
  • 测评结果:0
  • 用时:101ms
  • 内存:17320kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-28 09:42:31]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
inline int read()
{
	int n=0,f=1,ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-')f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
	{
		n=n*10+ch-'0';
		ch=getchar();
	}
	return n*f;
}
int p[200005];
int sl[200005];
bool cz[200005],vis[200005];
vector<int>v[200005];
vector<int>yy[405],qs[405];
int fa[200005];
int findf(int n)
{
	if(fa[n]==n)return n;
	return fa[n]=findf(fa[n]);
}
int xl1[200005],cnt1;
int xl2[200005],cnt2;
bool visd[200005];
int n,m;
void dfs(int x)
{
	if(visd[x])return;
	visd[x]=true;
	vector<int>v1;
	for(int i=1;i<=n;i++)
	{
		v1.clear();
		for(int j=0;j<yy[i].size();j++)
		{
			if(yy[i][j]==x)v1.push_back(j);
		}
		for(int j=0;j<qs[i].size();j++)
		{
			if(qs[i][j]==0)continue;
			if(!visd[qs[i][j]]&&!v1.empty())
			{
				//printf("%d %d\n",x,qs[i][j]);
				v[x].push_back(qs[i][j]);
				int sth=qs[i][j];
				yy[i][v1[v1.size()-1]]=0;
				qs[i][j]=0;
				v1.pop_back();
				dfs(sth);
			}
		}
	}
}
vector<int>wz[200005];
int now[1000005];
int sta[1000005],ttop;
void dfs1(int x)
{
	for(int i=now[x];i<v[x].size();i=now[x])
	{
		now[x]=i+1;
		dfs1(v[x][i]);
	}
	sta[++ttop]=x;
}
int main()
{
	n=read();
	m=read();
	for(int i=1;i<=n*m;i++)
	{
		p[i]=read();
	}
	for(int i=1;i<=m;i++)fa[i]=i;
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)sl[j]=0;
		for(int j=1;j<=m;j++)
		{
			sl[p[(i-1)*m+j]]++;
			if(sl[p[(i-1)*m+j]]>=2)
			{
				cz[p[(i-1)*m+j]]=true;
				qs[i].push_back(p[(i-1)*m+j]);
				wz[p[(i-1)*m+j]].push_back((i-1)*m+j);
			}
		}
		for(int j=1;j<=m;j++)if(sl[j]==0)yy[i].push_back(j);
		if(!yy[i].empty())
		{
			for(int j=1;j<yy[i].size();j++)fa[findf(yy[i][0])]=findf(yy[i][j]);
			for(int j=0;j<qs[i].size();j++)fa[findf(yy[i][0])]=findf(qs[i][j]);
		}
	} 
	for(int j=1;j<=m;j++)
	{
		if(cz[j]==false)continue;
		if(findf(j)==j)
		{
			v[m+1].push_back(j);
			v[j].push_back(m+1);
			dfs(j);
		}
	}
	for(int i=1;i<=n;i++)
	{
		cnt1=cnt2=0;
		for(int j=0;j<yy[i].size();j++)
		{
			if(yy[i][j]!=0)xl1[++cnt1]=yy[i][j];
		}
		for(int j=0;j<qs[i].size();j++)
		{
			if(qs[i][j]!=0)xl2[++cnt2]=qs[i][j];
		}
		for(int j=1;j<=cnt1;j++)
		{
			v[xl1[j]].push_back(xl2[j]);
		}
	}
	dfs1(m+1);
	reverse(sta+1,sta+ttop+1);
	for(int i=1;i<=ttop;i++)printf("%d ",sta[i]);
	printf("\n");
	for(int i=1;i<=ttop;i++)
	{
		if(sta[i]==m+1)sta[i]=n*m+1;
		else
		{
			if(wz[sta[i]].empty())
			{
				sta[i]=0;
				continue;
			}
			int sth=sta[i];
			sta[i]=wz[sth][wz[sth].size()-1];
			wz[sth].pop_back();
		}
	}
	for(int i=1;i<=ttop;i++)printf("%d ",sta[i]);
	printf("\n");
	cnt1=0;
	for(int i=1;i<=ttop;i++)if(sta[i]!=0)sta[++cnt1]=sta[i];
	printf("%d\n",cnt1-1);
	for(int i=cnt1;i>=2;i--)printf("%d %d\n",sta[i-1],sta[i]);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 7896kb

input:

10 3
1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3


output:

4 
31 
0

result:

wrong answer first subtask is incorrect

Test #2:

score: 0
Wrong Answer
time: 2ms
memory: 9908kb

input:

5 4
1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4


output:

5 1 2 3 4 1 3 1 4 2 4 3 2 1 5 
21 4 10 15 20 3 14 2 19 8 18 12 7 0 21 
13
7 21
12 7
18 12
8 18
19 8
2 19
14 2
3 14
20 3
15 20
10 15
4 10
21 4

result:

wrong answer first subtask is incorrect

Test #3:

score: 0
Wrong Answer
time: 1ms
memory: 7800kb

input:

10 10
8 10 10 3 7 3 5 6 1 4 3 8 2 9 1 8 4 2 7 3 10 7 9 2 1 10 10 9 1 2 9 7 4 5 2 9 10 5 7 6 6 8 6 8 4 2 9 1 2 8 6 1 4 2 2 1 5 6 3 10 10 7 9 4 8 9 8 2 5 6 4 3 1 6 3 3 10 7 7 5 3 6 8 5 9 4 6 7 9 4 10 5 3 4 5 1 1 7 8 5


output:

11 7 6 8 10 2 3 9 1 5 3 9 10 8 7 2 3 8 3 8 6 2 6 1 4 10 9 5 2 5 1 9 7 11 
101 79 87 67 27 55 76 89 97 100 75 66 26 50 39 49 20 44 6 16 58 30 43 56 90 3 36 95 18 38 29 28 0 101 
32
28 101
29 28
38 29
18 38
95 18
36 95
3 36
90 3
56 90
43 56
30 43
58 30
16 58
6 16
44 6
20 44
49 20
39 49
50 39
26 50
66 ...

result:

wrong answer first subtask is incorrect

Test #4:

score: 0
Wrong Answer
time: 2ms
memory: 10148kb

input:

100 10
1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 9 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10...

output:

11 7 6 7 11 9 4 3 1 9 2 5 2 1 3 4 10 5 10 2 9 11 
1001 707 747 0 1001 359 814 713 819 109 949 670 775 453 184 734 850 175 830 210 0 1001 
19
210 1001
830 210
175 830
850 175
734 850
184 734
453 184
775 453
670 775
949 670
109 949
819 109
713 819
814 713
359 814
1001 359
747 1001
707 747
1001 707

result:

wrong answer first subtask is incorrect

Test #5:

score: 0
Wrong Answer
time: 2ms
memory: 9984kb

input:

200 100
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 ...

output:

101 32 82 43 15 29 74 38 52 23 42 38 74 94 99 87 4 54 48 40 21 34 17 71 92 58 55 49 59 75 26 4 10 13 50 5 88 76 88 13 59 28 59 61 33 16 84 79 51 90 68 57 77 98 85 1 67 7 67 14 72 57 72 90 11 79 92 24 92 83 6 83 35 41 26 41 71 17 65 98 65 35 55 4 55 47 10 73 27 48 73 36 30 44 30 53 22 46 47 55 4 46 3...

result:

wrong answer first subtask is incorrect

Test #6:

score: 0
Wrong Answer
time: 2ms
memory: 10020kb

input:

201 20
20 18 5 5 1 7 8 17 12 10 20 12 13 19 16 2 9 8 20 20 19 10 17 20 9 11 15 17 9 2 3 4 17 10 7 20 7 19 17 11 20 2 1 13 11 9 11 6 10 8 11 3 2 16 9 15 16 12 13 6 5 13 4 13 3 8 20 18 10 3 14 1 11 20 17 17 2 11 20 1 4 10 3 3 9 13 7 10 19 16 14 16 9 19 14 15 12 9 20 12 2 19 18 2 7 7 2 12 10 8 20 18 16...

output:

21 2 3 5 17 11 20 18 9 13 10 12 7 16 19 6 8 14 4 15 1 17 9 20 4 12 17 18 13 18 12 7 20 4 11 19 20 10 18 20 17 20 14 20 7 8 17 12 9 3 7 10 8 5 2 12 13 18 7 1 10 11 10 18 17 8 12 9 11 6 20 8 7 6 3 1 2 19 16 11 19 12 11 19 2 7 6 9 2 19 13 6 2 8 18 2 20 16 12 6 19 6 16 2 1 19 14 11 7 12 3 5 16 6 13 6 18...

result:

wrong answer first subtask is incorrect

Test #7:

score: 0
Wrong Answer
time: 2ms
memory: 8252kb

input:

300 300
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 ...

output:

301 8 253 8 301 47 51 47 301 178 300 178 301 208 53 245 236 208 301 221 25 221 301 255 171 255 301 282 280 282 301 
90001 34753 64753 0 90001 5151 41751 0 90001 30900 59100 0 90001 60508 87208 60545 35645 0 90001 59621 83621 0 90001 45855 47655 0 90001 28482 57282 0 90001 
23
57282 90001
28482 57282...

result:

wrong answer first subtask is incorrect

Test #8:

score: 0
Wrong Answer
time: 5ms
memory: 10944kb

input:

301 40
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

41 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 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 7 1 7 1 7 1 7 1 7 1 7 1 7 1 8 1 8 1 ...

result:

wrong answer first subtask is incorrect

Test #9:

score: 0
Wrong Answer
time: 9ms
memory: 11192kb

input:

400 100
11 65 1 79 15 18 79 46 9 30 71 53 58 55 94 73 39 16 6 91 49 30 23 30 28 81 90 48 97 54 79 30 94 18 42 77 44 36 5 48 55 97 79 36 41 59 79 71 32 59 3 10 63 52 44 41 9 46 31 31 56 87 60 80 12 51 15 78 41 65 95 34 29 83 46 64 37 53 98 17 41 45 36 73 20 53 48 80 57 54 57 72 39 56 98 6 10 78 11 72...

output:

101 58 68 79 32 100 30 92 94 56 47 18 24 48 53 40 55 65 71 31 26 97 5 72 36 74 59 16 42 54 25 44 83 28 12 95 17 57 34 84 41 77 19 9 63 90 66 46 73 82 15 70 80 29 76 39 20 14 98 2 6 10 87 69 78 21 11 33 60 23 8 93 61 89 85 27 67 45 38 7 81 43 22 37 86 75 13 64 99 35 91 88 50 49 4 96 52 1 3 62 51 47 2...

result:

wrong answer first subtask is incorrect

Test #10:

score: 0
Wrong Answer
time: 2ms
memory: 10112kb

input:

40 160
17 2 3 4 5 6 7 91 9 10 154 12 103 14 15 16 17 25 19 58 21 8 23 24 52 26 27 58 120 105 50 55 104 32 35 36 37 38 45 10 41 42 43 44 45 71 47 48 49 34 140 52 53 54 115 44 28 58 59 60 61 62 63 64 132 66 67 68 69 70 71 69 24 74 75 76 77 133 79 80 81 82 100 84 31 86 87 88 100 90 91 92 93 94 95 96 97...

output:

161 127 1 17 16 11 58 54 24 15 3 35 43 33 10 32 26 13 45 30 52 63 5 50 49 110 44 38 62 41 69 57 71 77 37 73 100 39 46 91 56 94 81 23 65 93 80 82 75 31 59 12 101 103 48 87 144 20 86 124 68 36 14 154 72 84 115 21 53 25 109 130 79 19 74 118 120 119 90 148 47 96 4 107 83 132 27 116 133 98 89 55 131 60 1...

result:

wrong answer first subtask is incorrect

Test #11:

score: 0
Wrong Answer
time: 6ms
memory: 11520kb

input:

400 100
88 82 9 2 90 1 83 32 32 79 8 79 63 67 85 82 50 63 69 2 7 91 21 90 69 3 39 78 66 83 96 53 24 65 56 63 90 54 35 55 94 22 76 12 54 55 5 49 91 73 8 19 64 54 39 23 13 27 34 4 81 52 13 11 36 45 3 50 82 81 42 50 75 15 99 70 29 26 70 66 34 15 42 83 16 19 19 12 76 1 68 49 7 17 64 37 98 34 99 37 34 64...

output:

101 24 44 32 36 41 79 25 82 18 63 43 2 28 90 23 67 68 70 13 89 69 48 83 92 54 91 52 37 27 15 47 55 46 8 64 51 39 98 87 3 34 95 50 58 81 30 66 4 53 49 99 29 59 42 16 74 19 9 78 65 1 73 100 12 17 11 45 76 60 7 33 77 57 5 88 62 97 20 22 26 96 93 31 75 72 84 80 71 10 94 6 40 85 14 86 35 21 56 38 61 15 4...

result:

wrong answer first subtask is incorrect

Test #12:

score: 0
Wrong Answer
time: 3ms
memory: 8204kb

input:

301 20
8 1 1 1 1 1 1 17 1 9 1 5 1 1 1 1 13 1 9 1 18 1 1 16 1 15 5 19 1 8 11 10 1 1 1 1 18 4 1 1 1 1 16 1 1 1 12 10 1 1 1 14 11 13 1 1 1 1 1 1 10 1 1 1 1 1 1 19 14 1 1 1 5 1 1 1 1 13 1 18 1 1 4 1 1 1 1 1 1 1 1 1 1 16 16 10 1 14 18 1 1 1 7 1 1 1 1 6 9 1 13 1 1 1 2 1 1 1 1 1 1 10 1 1 1 17 1 10 10 1 12 ...

output:

21 8 1 2 9 18 13 16 10 20 14 12 11 5 3 4 17 19 6 7 15 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 11 1 2 1 2 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 2 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 6 1 6 1 6 1 6 1 6 1 6 10 1 6 1 6 1 6 1 6 1 6 1 7 1 7 1 7 1 7 1 7 ...

result:

wrong answer first subtask is incorrect

Test #13:

score: 0
Wrong Answer
time: 25ms
memory: 12620kb

input:

300 300
215 159 263 206 201 183 286 56 142 10 231 214 34 54 263 250 169 208 239 148 104 22 244 17 74 68 184 52 2 30 42 83 222 106 25 152 37 225 213 213 69 273 91 221 207 48 166 28 221 50 46 64 10 254 207 109 206 144 270 291 195 197 253 235 141 186 102 68 52 24 38 6 181 44 256 200 77 233 285 163 223 ...

output:

301 59 5 263 217 213 21 221 187 10 45 207 223 295 155 206 274 33 47 68 229 28 66 52 50 62 288 30 22 42 13 80 44 152 48 252 46 203 181 1 256 23 184 118 63 266 127 72 245 290 56 220 262 163 255 183 192 112 117 270 55 228 291 178 129 26 94 139 74 106 108 123 37 96 85 134 234 171 76 242 73 235 34 260 24...

result:

wrong answer first subtask is incorrect

Test #14:

score: 0
Wrong Answer
time: 58ms
memory: 15188kb

input:

201 400
1 1 1 1 1 152 1 1 1 1 1 1 1 33 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 300 154 1 1 147 1 1 1 383 186 1 1 90 256 1 1 1 1 1 1 1 63 1 1 1 1 208 1 1 1 1 31 1 1 1 1 1 1 1 127 1 1 29 216 397 393 1 1 1 1 1 1 279 1 1 1 1 55 1 1 215 249 1 1 1 1 1 1 172 1 1 1 1 1 1 1 1 1 1 1 1 349 1 331 1 1 1 1 1 1 1 34...

output:

401 363 6 8 1 3 349 247 126 4 2 7 62 176 351 396 377 5 314 200 132 130 172 341 29 299 154 223 348 264 213 66 350 9 122 344 131 215 249 228 10 141 382 183 181 11 73 51 12 216 13 144 111 41 201 358 356 14 315 259 206 392 368 15 345 160 302 290 347 128 230 270 236 202 398 16 98 112 242 142 146 17 22 18...

result:

wrong answer first subtask is incorrect

Test #15:

score: 0
Wrong Answer
time: 0ms
memory: 10380kb

input:

400 400
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 ...

output:

401 38 66 38 401 63 205 63 401 85 352 85 401 105 210 105 401 107 149 107 401 132 184 380 243 86 345 132 401 138 248 138 401 166 327 166 401 172 77 172 401 194 213 194 401 227 111 227 401 298 350 55 168 298 401 315 393 314 393 150 395 4 395 315 401 334 44 334 401 338 266 264 94 42 335 338 401 367 397...

result:

wrong answer first subtask is incorrect

Test #16:

score: 0
Wrong Answer
time: 17ms
memory: 11904kb

input:

301 200
50 129 146 60 183 51 47 77 26 73 1 45 1 44 149 1 81 196 17 16 163 35 159 71 1 94 161 138 138 27 76 1 102 42 5 186 176 1 111 198 37 63 81 155 95 164 132 135 155 194 126 98 31 34 121 19 175 148 33 105 25 122 91 165 1 69 1 197 12 98 1 155 5 53 42 1 60 98 78 61 155 13 1 171 102 152 95 61 87 200 ...

output:

201 100 79 1 3 18 138 184 81 43 155 13 53 179 98 57 200 172 5 59 42 142 133 60 101 102 91 69 15 2 12 34 25 120 36 95 76 168 149 171 30 61 47 14 44 89 17 10 158 148 137 58 33 157 56 118 19 24 130 159 20 167 37 108 11 196 140 176 197 139 35 160 194 150 136 145 22 105 113 135 78 83 199 51 156 29 6 74 6...

result:

wrong answer first subtask is incorrect

Test #17:

score: 0
Wrong Answer
time: 68ms
memory: 15764kb

input:

201 400
1 1 1 1 1 1 1 1 1 1 1 1 1 263 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 246 1 1 1 1 1 1 1 1 1 1 1 1 1 1 107 1 1 1 1 1 1 1 1 57 1 1 1 1 1 1 1 224 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 90 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

401 3 4 1 5 2 6 8 10 7 9 12 14 11 13 15 16 18 20 17 19 21 22 24 26 23 25 27 30 28 31 29 32 34 36 33 35 37 38 40 42 39 41 43 44 46 48 45 47 49 50 52 54 51 53 257 55 56 58 60 57 59 61 62 64 66 63 65 67 68 70 72 69 71 73 74 76 78 75 77 79 80 82 84 81 83 85 86 88 90 87 89 91 146 92 94 96 93 95 97 98 100...

result:

wrong answer first subtask is incorrect

Test #18:

score: 0
Wrong Answer
time: 34ms
memory: 13752kb

input:

400 300
75 26 289 176 131 196 124 8 230 157 247 265 13 2 210 141 17 200 187 83 21 22 118 144 232 26 284 75 48 30 132 32 65 34 72 36 73 286 164 40 41 261 65 270 221 12 139 48 49 143 91 39 17 258 275 56 151 194 282 55 228 266 296 64 22 232 67 142 69 152 10 102 109 45 75 49 283 112 78 283 81 236 169 22...

output:

301 272 164 202 26 8 64 17 113 245 18 75 130 65 149 48 115 22 66 271 37 232 73 59 34 69 137 49 93 10 23 283 140 36 38 187 169 167 221 193 4 165 20 98 171 295 29 90 293 275 250 118 138 300 196 159 2 52 131 134 135 91 170 280 70 231 174 41 156 132 112 95 194 82 76 141 197 81 157 47 204 32 216 173 258 ...

result:

wrong answer first subtask is incorrect

Test #19:

score: 0
Wrong Answer
time: 101ms
memory: 17320kb

input:

333 399
1 1 1 1 1 1 1 28 1 1 1 1 1 1 161 1 17 1 1 1 1 262 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 43 1 1 1 1 1 70 1 1 1 142 1 1 1 1 1 1 1 1 1 1 1 1 70 1 1 1 1 1 1 278 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 245 1 1 1 1 1 1 33 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 106 1 1 1 1 268 1 1 1 172 1 1 1 1 1 312 1 286 1 1 1 1 ...

output:

400 140 4 1 2 3 5 70 270 332 279 297 165 170 85 6 8 10 7 80 207 257 190 44 385 365 180 262 369 178 198 25 184 30 129 9 11 164 303 351 84 336 12 60 229 50 13 121 397 120 350 261 14 15 137 309 16 151 144 160 52 254 290 245 17 18 45 61 33 19 115 20 318 187 21 156 337 158 249 22 23 192 77 24 123 373 26 ...

result:

wrong answer first subtask is incorrect

Test #20:

score: 0
Wrong Answer
time: 49ms
memory: 14668kb

input:

400 400
100 35 353 385 317 228 7 148 113 165 11 306 209 89 21 166 17 2 19 249 27 305 377 22 3 353 38 28 29 96 191 32 33 309 35 308 100 176 152 40 176 42 43 86 45 46 96 48 396 381 218 246 53 54 334 159 243 360 294 60 33 62 185 64 65 66 191 121 351 107 10 343 367 74 75 201 77 247 79 134 304 92 42 126 ...

output:

401 324 274 353 22 173 35 153 100 56 176 33 3 61 96 168 191 45 30 97 42 286 5 84 309 34 74 8 78 149 51 31 89 83 92 41 11 340 66 150 13 126 249 55 377 253 21 263 107 28 278 29 64 335 113 98 262 202 49 134 184 24 7 91 115 367 157 10 25 62 199 124 121 370 72 2 125 67 379 383 350 208 152 20 165 119 133 ...

result:

wrong answer first subtask is incorrect