QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#203934#87. Devil's ShareAhmed57#13 1281ms3948kbC++231.4kb2023-10-06 22:28:512024-07-04 02:17:04

Judging History

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

  • [2024-07-04 02:17:04]
  • 评测
  • 测评结果:13
  • 用时:1281ms
  • 内存:3948kb
  • [2023-10-06 22:28:51]
  • 提交

answer

#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
int arr[5];string s;
string maa;string w;int k,x;
string lol[4*4*4*4][13];
void rec(){
    bool ss = 0;
    for(int i = 1;i<=4;i++){
        if(arr[i]){
            ss = 1;
            arr[i]--;s+=char(i+'0');
            rec();
            arr[i]++;
            s.pop_back();
        }
    }
    if(ss==0){
        string ma;
        for(int j = 0;j<s.size()-k+1;j++){
            string se;
            for(int e = j;e<j+k;e++)se+=s[e];
            if(ma.empty())ma = se;
            ma = max(ma,se);
        }
        if(maa.empty()||ma<maa){
            maa = ma;
            w = s;
        }
    }
}
signed main(){
    ios_base::sync_with_stdio(false);cin.tie(0);
    for(int t = 1;t<4*4*4*4;t++){
        int de = 0;
        int e = t;
        int sum = 0;
        for(int i = 1;i<=4;i++){
            arr[i] = e%4;
            e/=4;
            sum+=arr[i];
        }for(int K = 1;K<=sum;K++){
        k = K;
        maa = "";
        rec();
        lol[t][k] = w;
        }
    }
    int t;cin>>t;
    while(t--){
        int k;cin>>k;
        int de = 0;
        for(int i = 1;i<=4;i++){
            cin>>arr[i];
        }
        for(int i = 5;i<10;i++)cin>>x;
        for(int i = 4;i>=1;i--){de*=4;de+=arr[i];}
        cout<<lol[de][k]<<endl;
    }
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 13
Accepted

Test #1:

score: 13
Accepted
time: 1281ms
memory: 3604kb

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:

3112344
12233341414
241244
312312344
1112223344
22133
23341144
2122333
1344
31312444
2121244
31131223444
212134
2122133
12223444
13444
12223334
13341144
2313132244
12342424
122233
211444
11223
11223344
11222334
13
223131314
323244
2323234
11334
3123123444
114
122233414
11333
12234
222334
3111444
144...

result:

ok Correct!

Subtask #2:

score: 0
Runtime Error

Test #2:

score: 0
Runtime Error

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:

3444

result:


Subtask #3:

score: 0
Wrong Answer

Test #11:

score: 0
Wrong Answer
time: 1274ms
memory: 3948kb

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:


131134



1112223


232323
2224


11122333
1114
21112333
11244



133314


2333
223
22244
112224


122233

112224


11122234
11122234

21224
2333
2121244
113
211224

11122334
11244
1123

222334
131144
333



11233


314
22233


222333
1124




212333
113232324
21211333
111224
21211234
1122244

1223...

result:

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

Subtask #4:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%