QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#850894#8355. T3kkkgjyismine4#45 166ms78988kbC++203.5kb2025-01-10 12:46:112025-01-10 12:46:12

Judging History

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

  • [2025-01-10 12:46:12]
  • 评测
  • 测评结果:45
  • 用时:166ms
  • 内存:78988kb
  • [2025-01-10 12:46:11]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int n;
#define N 303
int up[N],dwn[N],lf[N],rg[N],op[N*N],ps[N*N],tt;
void print(){
	for(int i=1;i<=n*n;++i){
		if(op[i]==1)cout<<"U"<<ps[i]<<endl;
		else if(op[i]==2)cout<<"D"<<ps[i]<<endl;
		else if(op[i]==3)cout<<"L"<<ps[i]<<endl;
		else cout<<"R"<<ps[i]<<endl;
	}
}
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back
pii val[N];
int vis[N],col[N][N];
vector<int>rd[N*N];
int dg[N*N];
int getid(int x,int y){
	return (x-1)*n+y;
}
void Add(int u,int v){
	rd[u].pb(v),++dg[v];
}
void Dfs(int x){
	if(!x)return;
	int ct=0;
	for(int i=1;i<=n;++i)val[i].fi=up[i]+dwn[i],val[i].se=i,ct+=(val[i].fi>0);
	sort(val+1,val+n+1),reverse(val+1,val+n+1);
	if(lf[x]+rg[x]+ct<n){
		cout<<"NO\n";
		exit(0);
	}
	ct=n-lf[x]-rg[x];vector<int>vec;
	for(int i=1;i<=ct;++i){
		vec.pb(val[i].se);
		if(dwn[val[i].se])--dwn[val[i].se],col[x][val[i].se]=2;
		else --up[val[i].se],col[x][val[i].se]=1;
	}
	Dfs(x-1);
	for(int i=1;i<=n;++i)vis[i]=0;
	for(int v:vec)vis[v]=1;
	int y=1,z1,z2;
	while(lf[x]){
		if(vis[y]){++y;continue;}
		col[x][y]=3,--lf[x],++y;
	}
	z1=y;
	y=n;
	while(rg[x]){
		if(vis[y]){--y;continue;}
		col[x][y]=4,--rg[x],--y;
	}
	z2=y;
}
int vis1[N*N],ins[N*N],fa[N*N],Fl;
int p[N*N],vp[N*N],tot;
void Rbd(int u){
	int j=(u-1)%n+1;
	int i=(u-j)/n+1;
	for(int v:rd[u])--dg[v];
	rd[u].clear();
	if(col[i][j]==1){
		for(int k=1;k<i;++k)
			Add(getid(i,j),getid(k,j));
	}else if(col[i][j]==2){
		for(int k=i+1;k<=n;++k)
			Add(getid(i,j),getid(k,j));
	}else if(col[i][j]==3){
		for(int k=1;k<j;++k)
			Add(getid(i,j),getid(i,k));
	}else{
		for(int k=j+1;k<=n;++k)
			Add(getid(i,j),getid(i,k));
	}
}
void Dfs1(int u,int cc){
	if(Fl)return;
	vis1[u]=ins[u]=cc;
	for(int v:rd[u]){
		if(Fl)return;
		if(!vis1[v]){
			fa[v]=u;
			Dfs1(v,cc);
			continue;
		}
		if(ins[v]!=cc)continue;
		tot=0,Fl=1;
		for(int x=u;x!=v;x=fa[x])p[++tot]=x;
		p[++tot]=p[0]=v;
		for(int i=1;i<=tot;++i){
			int Py=(p[i%tot+1]-1)%n+1;
			int Px=(p[i%tot+1]-Py)/n+1;
			vp[i]=col[Px][Py];
		}
		for(int i=1;i<=tot;++i){
			int Py=(p[i]-1)%n+1;
			int Px=(p[i]-Py)/n+1;
			col[Px][Py]=vp[i];
			Rbd(p[i]);
		}
		return;
	}ins[u]=0;
}
void Init(){
	for(int i=1;i<=n;++i){
		for(int j=1;j<=n;++j){
			if(col[i][j]==1){
				for(int k=1;k<i;++k)
					Add(getid(i,j),getid(k,j));
			}else if(col[i][j]==2){
				for(int k=i+1;k<=n;++k)
					Add(getid(i,j),getid(k,j));
			}else if(col[i][j]==3){
				for(int k=1;k<j;++k)
					Add(getid(i,j),getid(i,k));
			}else{
				for(int k=j+1;k<=n;++k)
					Add(getid(i,j),getid(i,k));
			}
		}
	}
	int cc=0;
	for(int i=1;i<=n*n;++i){
		Fl=0;
		do{
			Fl=0,Dfs1(i,++cc);
		}while(Fl);
	}
	for(int i=1;i<=n;++i)
		for(int j=1;j<=n;++j)
			Rbd(getid(i,j));
}
queue<int>q;
void Topo(){
	for(int i=1;i<=n*n;++i)
		if(!dg[i])q.push(i);
	while(!q.empty()){
		int u=q.front();
		q.pop();
		int py=(u-1)%n+1;
		int px=(u-py)/n+1;
		op[++tt]=col[px][py];
		if(col[px][py]<=2)ps[tt]=py;
		else ps[tt]=px;
		for(int v:rd[u]){
			--dg[v];
			if(!dg[v])q.push(v);
		}
	}
	reverse(op+1,op+tt+1);
	reverse(ps+1,ps+tt+1);
}
int main(){
	ios::sync_with_stdio(0);
	cin>>n;
	for(int i=1;i<=n;++i)cin>>up[i];
	for(int i=1;i<=n;++i)cin>>dwn[i];
	for(int i=1;i<=n;++i)cin>>lf[i];
	for(int i=1;i<=n;++i){
		cin>>rg[i];
		if(up[i]+dwn[i]>n){
			cout<<"NO\n";
			return 0;
		}
		if(lf[i]+rg[i]>n){
			cout<<"NO\n";
			return 0;
		}
	}
	Dfs(n);
	Init();
	Topo();
	print();
	return 0;
}

詳細信息

Subtask #1:

score: 11
Accepted

Test #1:

score: 11
Accepted
time: 1ms
memory: 3860kb

input:

1
0
1
0
0

output:

D1

result:

ok OK

Test #2:

score: 11
Accepted
time: 1ms
memory: 3880kb

input:

3
0 0 1
1 1 1
0 1 0
1 2 1

output:

D3
D2
R2
U3
R3
L2
R2
R1
D1

result:

ok OK

Test #3:

score: 11
Accepted
time: 1ms
memory: 3588kb

input:

3
0 0 2
2 0 0
1 0 2
1 1 0

output:

L3
R1
D1
U3
D1
U3
L3
R2
L1

result:

ok OK

Test #4:

score: 11
Accepted
time: 1ms
memory: 3536kb

input:

3
0 0 0
0 1 0
1 0 0
1 3 3

output:

R3
R2
R3
R2
R3
R2
R1
D2
L1

result:

ok OK

Test #5:

score: 11
Accepted
time: 1ms
memory: 3596kb

input:

2
1 0
0 0
0 0
1 2

output:

R2
R2
R1
U1

result:

ok OK

Test #6:

score: 11
Accepted
time: 1ms
memory: 5700kb

input:

3
0 1 0
1 1 0
0 2 2
1 1 0

output:

D2
L3
L2
L3
R2
L2
R1
U2
D1

result:

ok OK

Test #7:

score: 11
Accepted
time: 1ms
memory: 3800kb

input:

2
0 0
2 0
1 0
1 0

output:

NO

result:

ok OK

Test #8:

score: 11
Accepted
time: 0ms
memory: 5696kb

input:

3
0 0 1
0 1 2
1 2 0
0 0 2

output:

D3
L2
R3
L2
R3
D3
U3
D2
L1

result:

ok OK

Test #9:

score: 11
Accepted
time: 1ms
memory: 3596kb

input:

2
1 1
0 0
0 0
2 0

output:

R1
R1
U2
U1

result:

ok OK

Test #10:

score: 11
Accepted
time: 1ms
memory: 5940kb

input:

3
2 0 1
1 1 1
1 1 0
0 0 1

output:

U1
D3
U1
R3
L2
D2
L1
D1
U3

result:

ok OK

Subtask #2:

score: 15
Accepted

Test #11:

score: 15
Accepted
time: 143ms
memory: 78056kb

input:

290
28 35 25 29 26 23 36 36 24 39 27 36 24 26 31 28 30 27 25 32 37 26 38 20 31 30 30 35 33 24 25 27 20 26 32 26 33 38 25 29 27 34 25 31 21 22 33 33 24 24 31 31 26 31 25 28 33 27 30 27 24 30 29 26 32 36 20 31 28 23 22 23 37 32 32 27 33 30 27 42 25 31 25 25 26 32 25 35 28 27 33 26 35 39 23 22 26 29 35...

output:

L10
L9
L8
L7
L6
L5
L4
L3
L2
L10
L9
L8
L7
L6
L5
L4
L3
L2
L20
L19
L18
L17
L16
L15
L14
L13
L10
L9
L8
L7
L6
L5
L4
L3
L2
L20
L19
L18
L17
L16
L15
L14
L13
L10
L9
L8
L7
L6
L5
L4
L3
L2
U1
L12
L30
L29
L28
L27
L26
L25
L24
L23
L22
L20
L19
L18
L17
L16
L15
L14
L13
L10
L9
L8
L7
L6
L5
L4
L3
L2
U1
L12
L30
L29
L28
L2...

result:

ok OK

Test #12:

score: 15
Accepted
time: 153ms
memory: 66852kb

input:

277
53 51 63 63 45 55 51 56 53 55 59 51 54 60 48 59 62 45 51 55 61 55 57 51 52 61 47 59 61 52 50 51 44 59 61 59 45 47 66 55 71 59 55 66 63 56 50 56 55 53 53 51 58 55 48 60 67 54 58 49 48 52 63 52 61 66 52 64 57 61 50 61 58 58 48 56 76 56 49 55 57 52 44 62 59 55 50 47 53 52 69 51 56 55 64 52 49 59 55...

output:

L4
L3
L2
L4
L3
L2
L9
L8
L7
L4
L3
L2
L6
L14
L13
L12
L11
L9
L8
L7
L4
L3
L2
L6
L19
L18
L17
L16
L14
L13
L12
L11
L9
L8
L7
L4
L3
L2
L6
L24
L23
L22
L21
L19
L18
L17
L16
L14
L13
L12
L11
L9
L8
L7
L4
L3
L2
L6
L29
L28
L27
L26
L24
L23
L22
L21
L19
L18
L17
L16
L14
L13
L12
L11
L9
L8
L7
L4
L3
L2
L6
L29
L28
L27
L26
L...

result:

ok OK

Test #13:

score: 15
Accepted
time: 159ms
memory: 71228kb

input:

282
100 80 83 92 99 86 81 73 90 97 79 88 78 90 93 75 80 95 88 75 73 86 84 76 86 80 89 87 84 81 78 84 75 86 76 81 85 101 69 88 80 86 86 97 83 83 71 94 82 98 79 79 82 84 96 83 90 82 69 82 90 80 85 89 99 76 94 87 85 78 74 93 69 85 87 75 87 95 77 77 86 71 88 73 91 88 72 86 85 78 88 82 82 96 90 79 79 82 ...

output:

L3
L2
L6
L5
L3
L2
L9
L8
L6
L5
L3
L2
U1
L13
L12
L11
L9
L8
L6
L5
L3
L2
U4
U3
U2
U1
L16
L15
L13
L12
L11
L9
L8
L6
L5
U4
U3
U2
L3
L2
U1
L19
L18
L16
L15
L13
L12
L11
L9
L8
U4
U3
U2
L6
L5
L3
L2
U1
L22
L21
L19
L18
L16
L15
L13
L12
L11
U4
U3
U2
L9
L8
L6
L5
L3
L2
U1
L25
L24
L22
L21
L19
L18
L16
L15
U4
U3
U2
L9
L...

result:

ok OK

Test #14:

score: 15
Accepted
time: 166ms
memory: 75556kb

input:

287
98 119 107 123 117 117 121 115 127 128 115 133 111 117 110 96 91 113 110 110 114 105 114 109 98 108 120 129 113 103 99 119 104 123 100 111 117 118 125 126 124 123 114 105 121 108 128 107 124 126 118 116 114 125 119 103 111 119 129 120 121 109 113 108 109 122 119 119 116 119 113 122 124 117 126 1...

output:

L2
L5
L4
L2
L7
L5
L4
L2
L10
L9
L7
L5
L4
L2
L12
L10
L9
L7
L5
L4
L2
L15
L14
L12
L10
L9
L7
L5
L4
L2
L17
L15
L14
L12
L10
L9
L7
L5
L4
L2
U7
U6
U5
U4
U3
U2
U1
L20
L19
L17
L15
L14
L12
L10
L9
L7
L5
L4
U7
U6
U5
U4
U3
U2
U1
L2
L22
L20
L19
L17
L15
L14
L12
L10
L9
L7
U7
U6
U5
U4
U3
U2
U1
L5
L4
L2
U9
U8
L22
L20
L...

result:

ok OK

Test #15:

score: 15
Accepted
time: 117ms
memory: 57620kb

input:

265
144 139 128 130 134 135 140 122 129 143 129 132 132 135 120 135 146 138 129 132 111 123 154 138 128 124 125 135 134 141 130 127 146 123 131 133 122 142 140 146 140 141 128 119 133 134 137 148 123 134 142 127 124 137 130 132 136 128 142 126 134 126 138 137 133 141 119 137 146 137 136 126 141 127 ...

output:

L2
U1
L4
U1
L6
U1
L2
L8
U1
L4
L2
L10
U1
L6
L4
L2
U3
U2
L12
U1
L8
L6
L4
L2
U5
U4
U3
U2
L14
U1
L10
L8
L6
L4
U5
U4
L2
U3
U2
L16
U1
L12
L10
L8
L6
U5
U4
L4
L2
U3
U2
L18
U1
L14
L12
L10
L8
U5
U4
L6
L4
L2
U3
U2
U7
U6
L20
U1
L16
L14
L12
L10
U5
U4
L8
L6
L4
L2
U3
U2
U7
U6
L22
U1
L18
L16
L14
L12
U5
U4
U9
U8
L10...

result:

ok OK

Test #16:

score: 15
Accepted
time: 3ms
memory: 5820kb

input:

286
235 245 221 241 222 248 226 244 228 207 234 229 241 261 209 231 222 203 225 230 256 224 236 243 222 246 235 243 247 234 241 255 232 234 211 258 249 238 252 237 240 221 244 223 212 240 259 261 235 264 238 205 224 223 238 222 199 225 222 217 236 220 212 204 230 253 221 214 195 216 219 239 220 233 ...

output:

NO

result:

ok OK

Test #17:

score: 15
Accepted
time: 141ms
memory: 60456kb

input:

268
187 183 183 184 179 189 177 173 176 186 183 182 187 175 185 218 176 191 195 183 182 197 182 195 195 183 185 193 205 182 192 179 183 176 190 185 195 182 189 189 196 184 194 184 199 189 190 190 191 201 197 196 190 186 186 197 188 190 188 171 191 186 181 188 170 188 176 188 190 190 187 181 190 187 ...

output:

L4
L4
U2
U1
L7
L4
U2
U1
L7
L4
U2
U1
L10
L7
L4
U2
U1
L10
L7
L4
U8
U7
U6
U5
U4
U3
U2
U1
L13
L10
L7
L4
U8
U7
U6
U5
U4
U3
U2
U1
L13
L10
L7
L4
U8
U7
U6
U5
U4
U3
U2
U1
L13
L10
L7
U8
U7
U6
U5
U4
U3
L4
U2
U1
L17
L13
L10
L7
U8
U7
U6
U5
U4
U3
L4
U12
U11
U10
U9
U2
U1
L17
L13
L10
U8
U7
U6
U5
U4
U3
L7
L4
U12
U11...

result:

ok OK

Test #18:

score: 15
Accepted
time: 107ms
memory: 54524kb

input:

261
204 204 215 204 209 212 197 219 216 205 210 208 216 205 207 203 217 203 209 208 211 207 210 213 200 206 213 208 214 205 200 220 206 210 213 209 206 207 207 201 212 213 212 206 225 210 196 221 205 217 202 206 212 205 196 218 205 209 194 206 199 204 219 204 222 208 208 210 195 208 215 211 201 206 ...

output:

U5
U4
U3
U2
U1
U5
U4
U3
U2
U1
U5
U4
U3
U2
U1
U5
U4
U3
U2
U1
U7
U6
L6
L10
U5
U4
U3
U2
U1
U7
U6
L6
L10
L5
U7
U6
L6
L10
L5
U7
U6
L6
L10
U7
U6
L6
L15
L10
U7
U6
U5
U4
U3
U2
U1
L5
L15
L10
U7
U6
U5
U4
U3
U2
U1
L5
L15
L10
U7
U6
U5
U4
U3
U2
U1
L5
L15
U7
U6
U5
U4
U3
U2
U1
L5
U14
U13
U12
U11
U10
U9
U8
L20
L15
...

result:

ok OK

Test #19:

score: 15
Accepted
time: 159ms
memory: 70752kb

input:

281
251 252 254 244 260 254 254 245 251 258 258 253 256 263 249 256 252 253 247 253 250 249 243 248 264 246 246 264 242 256 245 258 257 251 252 247 252 259 251 253 252 246 255 261 255 249 251 250 255 255 257 246 251 254 250 255 256 258 256 257 254 254 252 254 263 258 262 253 255 250 250 254 245 264 ...

output:

U4
U3
U2
U1
U4
U3
U2
U1
U4
U3
U2
U1
U4
U3
U2
U1
U4
U3
U2
U1
U4
U3
U2
U1
U4
U3
U2
U1
U4
U3
U2
U1
U10
U9
U8
U7
U6
U5
U4
U3
U2
U1
U10
U9
U8
U7
U6
U5
L9
U10
U9
U8
U7
U6
U5
L9
U10
U9
U8
U7
U6
U5
L9
U10
U9
U8
U7
U6
U5
L9
U10
U9
U8
U7
U6
U5
L10
U14
U13
U12
U11
L9
U16
U15
U10
U9
U8
U7
U6
U5
L10
U14
U13
U12
...

result:

ok OK

Test #20:

score: 15
Accepted
time: 95ms
memory: 51108kb

input:

253
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

L253
L252
L251
L250
L249
L248
L247
L246
L245
L244
L243
L242
L241
L240
L239
L238
L237
L236
L235
L234
L233
L232
L231
L230
L229
L228
L227
L226
L225
L224
L223
L222
L221
L220
L219
L218
L217
L216
L215
L214
L213
L212
L211
L210
L209
L208
L207
L206
L205
L204
L203
L202
L201
L200
L199
L198
L197
L196
L195
L194
...

result:

ok OK

Subtask #3:

score: 19
Accepted

Test #21:

score: 19
Accepted
time: 123ms
memory: 56180kb

input:

289
30 29 31 35 25 34 26 28 25 25 44 26 33 30 27 30 33 37 26 27 43 28 28 40 31 36 21 26 35 28 31 29 41 25 30 25 35 28 38 24 26 26 24 24 25 27 18 44 31 24 37 28 26 31 27 32 29 24 24 32 20 35 26 39 30 28 33 30 27 28 37 35 29 22 27 27 31 30 25 31 31 22 30 34 33 31 30 29 41 26 38 36 28 28 21 22 31 34 32...

output:

U31
U30
U29
U28
U27
U26
U25
U24
U23
U22
U21
U20
U19
U18
U17
U16
U15
U14
U13
U12
U11
U10
U9
U8
U7
U6
U5
U4
U3
U2
U1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
R2
L1
R2
L1
R2
L1
R2
L1
R6
R5
R4
R3
R2
L1
R6
R5
R4
R3
R2
L1
R6
R5
R4...

result:

ok OK

Test #22:

score: 19
Accepted
time: 117ms
memory: 55640kb

input:

283
56 62 53 64 57 64 52 61 46 71 63 66 56 63 59 52 46 54 61 58 56 63 61 55 53 52 58 53 66 57 65 57 53 62 53 59 44 60 68 51 55 61 45 53 53 43 51 44 63 62 52 57 42 56 64 43 48 68 64 62 56 48 46 52 56 61 64 72 37 63 64 48 53 64 55 61 57 56 78 60 50 50 55 59 66 43 62 69 52 52 65 57 50 52 57 54 44 58 58...

output:

U50
U49
U48
U47
U46
U45
U44
U43
U42
U41
U40
U39
U38
U37
U36
U35
U34
U33
U32
U31
U30
U29
U28
U27
U26
U25
U24
U23
U22
U21
U20
U19
U18
U17
U16
U15
U14
U13
U12
U11
U10
U9
U8
U7
U6
U5
U4
U3
U2
U1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L2
L1
L2
L1
L2
L1
L2
L1
L2
L1
L2
L1
L2
L1
L2
L1
L2
L1
L2
L1
L2
L1
L2
L5
L4
L3
L...

result:

ok OK

Test #23:

score: 19
Accepted
time: 108ms
memory: 52652kb

input:

272
89 85 79 73 83 99 83 77 75 85 87 87 76 93 85 87 86 91 86 82 77 73 80 79 79 88 88 77 81 77 78 89 84 91 79 87 89 78 92 77 81 86 85 78 102 85 70 86 81 89 73 66 77 86 75 83 77 86 79 85 90 78 80 84 74 76 78 75 83 81 88 77 77 78 81 80 76 86 79 87 89 82 79 86 77 82 91 90 82 66 96 89 78 84 100 80 88 81 ...

output:

L3
L2
L3
L2
L3
L2
L3
L2
L3
L2
L3
L2
L3
L2
L3
L2
L3
L2
L3
L2
L3
L2
L3
L2
L3
L2
U90
U89
U88
U87
U86
U85
U84
U83
U82
U81
U80
U79
U78
U77
U76
U75
U74
U73
U72
U71
U70
U69
U68
U67
U66
U65
U64
U63
U62
U61
U60
U59
U58
U57
U56
U55
U54
U53
U52
U51
U50
U49
U48
U47
U46
U45
U44
U43
U42
U41
U40
U39
U38
U37
U36
U3...

result:

ok OK

Test #24:

score: 19
Accepted
time: 157ms
memory: 67096kb

input:

293
116 105 112 108 113 115 120 108 122 119 116 119 118 111 123 122 107 116 114 121 112 118 104 124 110 119 104 127 99 123 105 108 122 123 127 120 102 122 135 113 126 139 115 106 125 117 105 122 108 117 107 111 111 95 124 131 128 99 111 110 115 120 115 121 112 128 124 114 118 118 102 109 130 123 105...

output:

L2
L2
L2
L2
L2
R2
R1
L2
R2
R1
L2
R2
R1
L2
U127
U126
U125
U124
U123
U122
U121
U120
U119
U118
U117
U116
U115
U114
U113
U112
U111
U110
U109
U108
U107
U106
U105
U104
U103
U102
U101
U100
U99
U98
U97
U96
U95
U94
U93
U92
U91
U90
U89
U88
U87
U86
U85
U84
U83
U82
U81
U80
U79
U78
U77
U76
U75
U74
U73
U72
U71
U7...

result:

ok OK

Test #25:

score: 19
Accepted
time: 87ms
memory: 47192kb

input:

259
134 137 126 126 135 120 150 126 129 131 139 132 139 134 135 112 135 119 132 133 128 127 123 129 127 125 132 127 121 126 124 121 126 124 119 129 139 118 130 131 132 121 121 130 145 133 127 131 131 123 132 117 124 127 144 120 119 125 118 133 128 133 140 132 127 119 136 128 123 136 133 132 134 127 ...

output:

R1
R1
R1
R1
R1
R1
R1
R1
R1
R1
R1
R1
R1
R1
R1
R1
R1
R1
R1
R1
R1
R1
R1
R1
R1
R1
R1
R1
R1
R1
R1
R1
R1
R1
R1
R1
R1
R1
R1
R1
R1
R1
L2
R1
L2
R1
L2
R1
L2
R1
L2
R1
L2
R1
L2
R1
L2
R1
L2
R1
L2
R1
L2
R1
L2
R1
L2
R1
L2
R1
L2
R1
L2
R1
L2
R1
L2
R1
L2
R1
L2
R1
L2
R1
L2
R1
L2
R1
L2
R1
L2
R1
L2
R1
L2
R1
L2
R1
L2
R1
...

result:

ok OK

Test #26:

score: 19
Accepted
time: 1ms
memory: 3564kb

input:

278
263 255 245 237 232 249 262 256 219 227 217 256 228 224 239 224 221 256 255 218 235 221 203 220 232 228 237 238 268 225 237 231 241 258 236 248 246 231 230 241 252 215 228 255 249 214 213 218 228 248 205 229 245 70 86 73 77 67 70 73 73 81 84 83 93 78 71 56 80 98 71 79 77 84 74 89 54 80 73 80 75 ...

output:

NO

result:

ok OK

Test #27:

score: 19
Accepted
time: 125ms
memory: 60036kb

input:

272
190 190 198 197 197 192 190 184 191 182 194 188 197 193 190 176 188 210 177 196 192 186 191 181 169 182 189 183 188 172 193 199 194 189 191 193 195 188 194 193 173 190 193 202 204 197 177 191 183 194 184 176 193 195 179 190 187 190 194 188 201 192 182 191 184 193 202 186 194 187 198 189 188 186 ...

output:

U180
U179
U178
U177
U176
U175
U174
U173
U172
U171
U170
U169
U168
U167
U166
U165
U164
U163
U162
U161
U160
U159
U158
U157
U156
U155
U154
U153
U152
U151
U150
U149
U148
U147
U146
U145
U144
U143
U142
U141
U140
U139
U138
U137
U136
U135
U134
U133
U132
U131
U130
U129
U128
U127
U126
U125
U124
U123
U122
U121
...

result:

ok OK

Test #28:

score: 19
Accepted
time: 144ms
memory: 65344kb

input:

277
222 221 224 218 221 215 228 221 227 224 225 219 229 220 220 216 230 227 224 224 222 232 220 215 214 222 234 219 216 222 227 227 217 217 221 214 225 209 216 220 216 227 207 215 222 226 231 223 230 220 220 234 213 219 236 223 227 221 214 220 225 226 228 223 218 216 216 228 220 224 217 218 219 214 ...

output:

U221
U220
U219
U218
U217
U216
U215
U214
U213
U212
U211
U210
U209
U208
U207
U206
U205
U204
U203
U202
U201
U200
U199
U198
U197
U196
U195
U194
U193
U192
U191
U190
U189
U188
U187
U186
U185
U184
U183
U182
U181
U180
U179
U178
U177
U176
U175
U174
U173
U172
U171
U170
U169
U168
U167
U166
U165
U164
U163
U162
...

result:

ok OK

Test #29:

score: 19
Accepted
time: 152ms
memory: 78988kb

input:

292
268 263 259 268 254 270 263 262 254 263 266 269 260 264 261 257 269 254 256 269 268 267 261 270 265 265 265 264 260 264 267 263 268 268 266 269 265 255 261 268 266 266 263 265 248 264 255 259 263 262 257 267 260 265 257 270 257 263 267 268 264 269 259 272 254 262 263 252 260 264 267 260 269 259 ...

output:

U266
U265
U264
U263
U262
U261
U260
U259
U258
U257
U256
U255
U254
U253
U252
U251
U250
U249
U248
U247
U246
U245
U244
U243
U242
U241
U240
U239
U238
U237
U236
U235
U234
U233
U232
U231
U230
U229
U228
U227
U226
U225
U224
U223
U222
U221
U220
U219
U218
U217
U216
U215
U214
U213
U212
U211
U210
U209
U208
U207
...

result:

ok OK

Test #30:

score: 19
Accepted
time: 118ms
memory: 52848kb

input:

287
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

R46
R230
R46
R230
L193
R58
R46
R36
R26
R230
L193
L142
R64
R58
R46
R36
R26
R19
R232
R230
L193
L147
L142
R64
R58
R46
R36
R26
R19
R7
R232
R230
L193
R172
R170
L147
L142
R94
L67
R64
R58
R46
R36
R26
R19
R7
R232
R230
L193
R172
R170
L147
L142
R94
L67
R64
R58
R46
R36
R26
R19
L16
R7
R238
R232
R230
L193
R172
R...

result:

ok OK

Subtask #4:

score: 0
Wrong Answer

Test #31:

score: 25
Accepted
time: 1ms
memory: 3660kb

input:

1
1
0
0
0

output:

U1

result:

ok OK

Test #32:

score: 25
Accepted
time: 1ms
memory: 5840kb

input:

2
0 1
0 1
0 0
1 1

output:

D2
U2
R2
R1

result:

ok OK

Test #33:

score: 25
Accepted
time: 1ms
memory: 3672kb

input:

3
0 1 0
0 1 2
2 1 0
0 1 1

output:

D3
D2
D3
U2
L1
R3
R2
L2
L1

result:

ok OK

Test #34:

score: 25
Accepted
time: 2ms
memory: 5900kb

input:

9
2 1 3 4 3 3 2 3 2
2 4 2 1 1 2 4 2 2
4 0 3 3 1 1 2 3 2
0 2 2 2 2 4 1 2 4

output:

U5
U4
U3
U2
U1
L1
R9
D8
D7
D6
L1
R9
L1
L3
L9
L8
L7
R9
R8
L1
R3
L3
D1
L5
R9
L9
D9
U9
U8
U7
U6
R3
L3
U3
D1
D4
D3
D2
D9
R2
U9
U8
U3
L4
L8
R6
R2
D7
R4
L4
L7
R8
L8
R6
U4
D7
R4
U6
L4
U5
D2
D8
D6
D5
R6
U4
R5
U8
D7
U6
U5
D2
R7
D3
R6
U4
L6
R5
U7
D2
U1

result:

ok OK

Test #35:

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

input:

18
5 5 2 7 4 3 4 2 7 4 5 0 3 4 3 3 7 1
5 6 6 5 2 7 6 6 0 3 4 3 6 3 4 5 3 7
4 4 5 6 2 8 2 3 4 3 4 7 6 6 6 5 1 4
10 5 7 4 5 6 7 4 6 2 4 3 5 3 8 2 7 6

output:

R9
D6
D12
L18
R15
R9
D3
D12
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0...

result:

wrong answer WA

Subtask #5:

score: 0
Wrong Answer

Test #77:

score: 0
Wrong Answer
time: 157ms
memory: 49784kb

input:

299
72 66 62 73 80 85 70 93 79 88 77 72 67 70 73 84 77 62 80 77 88 63 69 76 73 91 64 76 75 65 74 71 71 68 81 80 74 77 69 75 73 87 90 82 86 79 76 83 69 72 73 73 75 78 76 80 66 76 67 75 72 71 77 63 80 68 82 63 74 67 74 72 73 76 71 72 66 78 74 65 69 80 76 71 72 74 77 70 85 60 65 89 66 64 77 63 78 82 80...

output:

D220
D214
U156
D153
R154
U216
D204
U194
D143
U128
U125
D116
U112
D104
U81
R127
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0
R0...

result:

wrong answer WA