QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#203900#87. Devil's ShareAhmed57#0 58ms3812kbC++232.1kb2023-10-06 21:49:282024-07-04 02:17:01

Judging History

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

  • [2024-07-04 02:17:01]
  • 评测
  • 测评结果:0
  • 用时:58ms
  • 内存:3812kb
  • [2023-10-06 21:49:28]
  • 提交

answer

#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;

signed main(){
    ios_base::sync_with_stdio(false);cin.tie(0);
    int t;cin>>t;
    while(t--){
        int k;cin>>k;
        int arr[10] = {0};
        for(int i = 1;i<10;i++)cin>>arr[i];
        if(k<2){
            for(int i = 1;i<10;i++){
                for(int j = 0;j<arr[i];j++){
                    cout<<char(i+'0');
                }
            }
            cout<<endl;
        }else{
            int su = 0;
            string v;int ind = 0;
            for(int i = 9;i>=1;i--){
                su+=arr[i];
                if(su>=2){
                    su-=arr[i];
                    ind = i;break;
                }else{
                    for(int j = 0;j<arr[i];j++){
                        v+=char(i+'0');
                    }
                }
            }
            if(su==1){
                int lol = 1;
                while(arr[ind]){
                    while(arr[lol]==0)lol++;
                    v+=char(lol+'0');
                    arr[lol]--;
                    if(arr[ind]){
                        v+=char(ind+'0');
                        arr[ind]--;
                    }
                }
                for(int i = 1;i<10;i++){
                    for(int j = 0;j<arr[i];j++){
                        v+=char(i+'0');
                    }
                }
            }else{
                int lol = 1;
                while(arr[ind]){
                    if(arr[ind]){
                        v+=char(ind+'0');
                        arr[ind]--;
                    }
                    while(lol<10&&arr[lol]==0)lol++;
                    if(lol<10){
                    v+=char(lol+'0');
                    arr[lol]--;
                    }
                }
                for(int i = 1;i<10;i++){
                    for(int j = 0;j<arr[i];j++){
                        v+=char(i+'0');
                    }
                }
            }
            reverse(v.begin(),v.end());
        cout<<v<<endl;
        }
    }
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

input:

1536
4
2 1 2 2 0 0 0 0 0
2
3 2 3 3 0 0 0 0 0
3
1 2 0 3 0 0 0 0 0
4
2 2 3 2 0 0 0 0 0
1
3 3 2 2 0 0 0 0 0
3
1 2 2 0 0 0 0 0 0
3
2 1 2 3 0 0 0 0 0
6
1 3 3 0 0 0 0 0 0
4
1 0 1 2 0 0 0 0 0
4
2 1 2 3 0 0 0 0 0
4
2 3 0 2 0 0 0 0 0
5
3 2 3 3 0 0 0 0 0
3
2 2 1 1 0 0 0 0 0
3
2 3 2 0 0 0 0 0 0
8
1 3 1 3 0 0 0...

output:

3321414
33322141414
242414
333221414
1112223344
22313
33241414
2232313
3414
33241414
2221414
33322141414
4221314
2221313
32242414
13444
12223334
33141414
3332221414
32242414
122233
241414
11223
33221414
422231314
313
4223131314
332424
43232324
11334
3332241414
4114
332221414
31313
422314
222334
3141...

result:

wrong output format Extra information in the output file

Subtask #2:

score: 0
Wrong Answer

Test #2:

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

input:

35960
2
0 0 5 2 0 0 17 0 7
2
0 6 0 15 0 0 0 4 5
2
3 0 0 1 20 0 0 0 8
2
0 5 0 0 15 0 5 7 0
2
0 0 2 11 0 0 4 0 10
2
0 14 0 0 11 0 0 6 1
2
0 0 10 3 0 0 8 0 1
2
0 1 9 0 2 0 0 6 0
2
0 0 0 0 5 0 12 7 3
2
0 0 5 0 0 2 0 8 9
2
7 2 0 0 0 0 0 6 8
2
0 0 0 4 1 0 3 18 0
2
0 0 14 4 8 0 0 0 1
2
0 2 0 0 0 13 3 9 0
2...

output:

7777777777777777749493939393939
888844444444444444422929292929
55555555555555555959595949191919
77777555555555555558582828282828
777744449494949494949493939
955555555555222222228282828282829
94443373737373737373739
553333383838383828
888888877777777777755595959
888888898969693939393939
8888882291919...

result:

FAIL Condition failed: "s.length() == S"

Subtask #3:

score: 0
Wrong Answer

Test #11:

score: 0
Wrong Answer
time: 35ms
memory: 3812kb

input:

26488
21
7 19 0 0 0 0 0 0 0
3
15 21 0 0 0 0 0 0 0
7
4 35 0 0 0 0 0 0 0
5
28 12 0 0 0 0 0 0 0
22
40 3 0 0 0 0 0 0 0
1
7 6 0 0 0 0 0 0 0
5
12 21 0 0 0 0 0 0 0
18
27 13 0 0 0 0 0 0 0
2
36 6 0 0 0 0 0 0 0
15
19 14 0 0 0 0 0 0 0
34
17 20 0 0 0 0 0 0 0
11
17 5 0 0 0 0 0 0 0
19
10 12 0 0 0 0 0 0 0
28
29 9 ...

output:

22222222222212121212121212
222222121212121212121212121212121212
222222222222222222222222222222212121212
1111111111111111121212121212121212121212
1111111111111111111111111111111111111121212
1111111222222
222222222121212121212121212121212
1111111111111112121212121212121212121212
1111111111111111111111...

result:

wrong output format Extra information in the output file

Subtask #4:

score: 0
Skipped

Dependency #1:

0%