QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#850651#8355. T3HuTao#19 8ms6916kbC++141.2kb2025-01-10 10:49:532025-01-10 10:49:54

Judging History

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

  • [2025-01-10 10:49:54]
  • 评测
  • 测评结果:19
  • 用时:8ms
  • 内存:6916kb
  • [2025-01-10 10:49:53]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

const int N = 305, M = N * N;

int n;
int u[N], d[N], l[N], r[N];
int p[N];
string ans[M];
int tot;

int main()
{
    scanf("%d", &n);
    for(int i = 1; i <= n; i ++ ) scanf("%d", &u[i]);
    for(int i = 1; i <= n; i ++ ) scanf("%d", &d[i]);
    for(int i = 1; i <= n; i ++ ) scanf("%d", &l[i]);
    for(int i = 1; i <= n; i ++ ) scanf("%d", &r[i]);
    
    for(int i = 1; i <= n; i ++ )
        if(u[i] + d[i] > n || l[i] + r[i] > n)
            return puts("NO"), 0;
    
    for(int i = 1; i <= n; i ++ )
    {
        int cnt = n - l[i] - r[i];
        for(int j = 1; j <= n; j ++ ) p[j] = j;
        sort(p + 1, p + n + 1, [](const int i, const int j) {return u[i] > u[j];});
        int t0 = tot;
        for(int t = 1; t <= n && cnt; t ++ )
        {
            int j = p[t];
            if(u[j]) u[j] -- , cnt -- , ans[ ++ tot] = "U" + to_string(j);
        }
        for(int j = 1; j <= l[i]; j ++ ) ans[ ++ tot] = "L" + to_string(i);
        for(int j = 1; j <= r[i]; j ++ ) ans[ ++ tot] = "R" + to_string(i);
        // printf("#%d %d\n", i, tot);
        assert(tot - t0 == n);
    }

    for(int i = 1; i <= tot; i ++ ) printf("%s\n", ans[i].c_str());
    return 0;
}

详细

Subtask #1:

score: 0
Runtime Error

Test #1:

score: 0
Runtime Error

input:

1
0
1
0
0

output:


result:


Subtask #2:

score: 0
Runtime Error

Test #11:

score: 15
Accepted
time: 7ms
memory: 6648kb

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:

U183
U103
U232
U80
U272
U199
U226
U94
U213
U142
U10
U253
U280
U23
U38
U228
U73
U270
U131
U21
U246
U287
U66
U156
U278
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
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
...

result:

ok OK

Test #12:

score: 15
Accepted
time: 7ms
memory: 6712kb

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:

U77
U236
U233
U41
U118
U91
U141
U174
U57
U39
U156
U66
U138
U164
U44
U262
U256
U221
U178
U239
U252
U275
U68
U264
U151
U95
U63
U223
U45
U183
U4
U167
U3
U145
U272
U224
U179
U276
U84
U165
U251
U222
U17
U268
U191
U220
U65
U72
U70
U237
U241
U274
U106
U35
U107
U29
U253
U26
U157
U21
U159
L1
L1
L1
L1
L1
L1
L...

result:

ok OK

Test #13:

score: 15
Accepted
time: 7ms
memory: 6620kb

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:

U228
U257
U194
U221
U38
U1
U158
U65
U5
U136
U50
U175
U10
U132
U154
U44
U189
U188
U94
U226
U55
U232
U208
U229
U177
U18
U185
U78
U254
U48
U223
U238
U67
U279
U199
U156
U165
U72
U15
U186
U150
U124
U118
U267
U258
U200
U171
U142
U4
U130
U167
U179
U180
U85
U266
U191
U9
U137
U148
U95
U102
U104
U110
U172
U16...

result:

ok OK

Test #14:

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

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:

U90
U246
U86
U12
U125
U123
U129
U285
U212
U251
U132
U76
U169
U170
U28
U59
U120
U263
U219
U282
U166
U193
U77
U10
U47
U113
U253
U202
U9
U121
U147
U216
U40
U50
U260
U75
U192
U98
U259
U39
U201
U200
U54
U73
U232
U237
U97
U91
U254
U208
U41
U49
U34
U155
U42
U203
U4
U122
U140
U258
U72
U101
U278
U79
U187
U66...

result:

ok OK

Test #15:

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

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:

U233
U23
U155
U187
U48
U103
U208
U145
U69
U196
U17
U175
U33
U132
U40
U140
U180
U154
U122
U1
U182
U158
U76
U249
U135
U10
U59
U265
U104
U38
U244
U51
U216
U207
U30
U246
U239
U78
U73
U66
U256
U42
U258
U100
U84
U39
U98
U41
U7
U156
U179
U88
U144
U210
U2
U202
U183
U92
U106
U114
U116
U121
U133
U153
U157
U18...

result:

ok OK

Test #16:

score: 0
Runtime Error

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:


result:


Subtask #3:

score: 19
Accepted

Test #21:

score: 19
Accepted
time: 8ms
memory: 6916kb

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:

U48
U11
U21
U33
U89
U133
U147
U24
U187
U64
U171
U143
U128
U220
U39
U242
U285
U91
U108
U18
U138
U255
U194
U71
U51
U26
U254
U166
U92
U259
U221
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
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
L1
...

result:

ok OK

Test #22:

score: 19
Accepted
time: 7ms
memory: 6904kb

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:

U79
U199
U171
U227
U68
U210
U110
U10
U223
U173
U88
U146
U230
U58
U39
U239
U184
U252
U104
U149
U85
U29
U105
U260
U12
U211
U236
U100
U253
U176
U145
U142
U91
U31
U214
U74
U119
U71
U67
U55
U59
U160
U4
U6
U233
U188
U49
U70
U22
U14
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...

result:

ok OK

Test #23:

score: 19
Accepted
time: 7ms
memory: 6620kb

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:

U45
U105
U95
U6
U186
U162
U197
U239
U148
U91
U141
U248
U147
U230
U225
U145
U14
U176
U160
U109
U247
U246
U235
U166
U144
U107
U210
U39
U213
U34
U258
U243
U249
U216
U18
U171
U87
U257
U155
U259
U151
U88
U100
U237
U130
U61
U103
U1
U81
U121
U99
U125
U92
U50
U32
U37
U261
U172
U97
U120
U226
U26
U27
U204
U71...

result:

ok OK

Test #24:

score: 19
Accepted
time: 7ms
memory: 6696kb

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:

U285
U42
U178
U39
U85
U90
U201
U89
U160
U258
U231
U228
U154
U189
U98
U101
U177
U169
U224
U56
U91
U73
U127
U131
U192
U225
U255
U266
U162
U273
U292
U140
U57
U66
U212
U88
U92
U220
U254
U28
U158
U35
U41
U146
U260
U120
U116
U222
U104
U84
U284
U281
U153
U202
U45
U147
U152
U213
U102
U110
U235
U196
U180
U67...

result:

ok OK

Test #25:

score: 19
Accepted
time: 6ms
memory: 6620kb

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:

U7
U158
U78
U45
U55
U163
U161
U109
U214
U228
U202
U123
U238
U132
U146
U181
U167
U164
U63
U246
U11
U81
U37
U121
U204
U13
U196
U89
U140
U114
U2
U203
U96
U242
U198
U191
U229
U113
U128
U67
U70
U77
U247
U80
U162
U120
U130
U177
U187
U82
U141
U190
U119
U5
U17
U15
U200
U171
U237
U107
U14
U73
U117
U251
U232
...

result:

ok OK

Test #26:

score: 19
Accepted
time: 2ms
memory: 6620kb

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: 7ms
memory: 6700kb

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:

U18
U207
U100
U213
U263
U77
U217
U185
U161
U94
U45
U193
U228
U242
U44
U67
U232
U143
U153
U140
U61
U83
U240
U173
U167
U181
U227
U132
U32
U135
U206
U199
U156
U237
U90
U98
U174
U108
U81
U171
U71
U134
U129
U162
U210
U195
U264
U3
U46
U230
U176
U252
U251
U244
U115
U5
U80
U256
U4
U119
U215
U13
U257
U214
U2...

result:

ok OK

Test #28:

score: 19
Accepted
time: 7ms
memory: 6736kb

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:

U92
U220
U201
U55
U84
U273
U228
U52
U27
U86
U22
U110
U226
U160
U47
U87
U172
U49
U85
U219
U268
U17
U13
U116
U166
U117
U124
U255
U264
U88
U234
U144
U82
U7
U271
U129
U68
U216
U63
U114
U9
U121
U57
U156
U276
U42
U240
U194
U158
U128
U32
U31
U146
U188
U18
U184
U62
U175
U109
U107
U187
U209
U102
U134
U157
U2...

result:

ok OK

Test #29:

score: 19
Accepted
time: 5ms
memory: 6712kb

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:

U91
U205
U197
U219
U209
U194
U139
U231
U64
U94
U186
U135
U162
U228
U96
U180
U279
U145
U56
U24
U122
U204
U185
U168
U6
U82
U36
U268
U187
U264
U73
U246
U62
U165
U255
U196
U20
U17
U286
U134
U143
U12
U81
U232
U193
U290
U287
U89
U4
U253
U1
U173
U280
U129
U60
U21
U220
U138
U33
U272
U40
U265
U34
U222
U161
U...

result:

ok OK

Test #30:

score: 19
Accepted
time: 3ms
memory: 6680kb

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:

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

result:

ok OK

Subtask #4:

score: 0
Runtime Error

Test #31:

score: 25
Accepted
time: 0ms
memory: 6708kb

input:

1
1
0
0
0

output:

U1

result:

ok OK

Test #32:

score: 0
Runtime Error

input:

2
0 1
0 1
0 0
1 1

output:


result:


Subtask #5:

score: 0
Runtime Error

Test #77:

score: 0
Runtime Error

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:


result: