QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#236549#2809. PresentAhmed57#29 379ms54384kbC++231023b2023-11-04 04:48:122024-07-04 02:22:48

Judging History

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

  • [2024-07-04 02:22:48]
  • 评测
  • 测评结果:29
  • 用时:379ms
  • 内存:54384kb
  • [2023-11-04 04:48:12]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
vector<long long> v;
long long xd = 0;
long long vis[35];long long op = 0;
vector<pair<pair<long long,long long>,long long>> la;
void solve(long long i){
    if(i>25)return;
    solve(i+1);op++;
    bool ss = 1;
    for(int j = 0;j<v.size();j++){
        vis[v[j]] = op;
        if(vis[__gcd(i,v[j])]!=op){
            ss = 0;
            break;
        }
    }
    if(ss){
        v.push_back(i);
        xd^=(1<<(i-1));
        la.push_back({{i,xd},xd});
        solve(i+1);
        v.pop_back();
        xd^=(1<<(i-1));
    }
}
signed main() {
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    solve(1);
    la.push_back({{0,0},0});
    sort(la.begin(),la.end());
    int t;cin>>t;
    while(t--){
        int k;cin>>k;
        cout<<__builtin_popcount(la[k].second)<<" ";
        for(long long i = 0;i<30;i++){
            if(la[k].second&(1ll<<i))cout<<i+1<<" ";
        }
        cout<<endl;
    }
    return 0;
}

详细

Subtask #1:

score: 8
Accepted

Test #1:

score: 8
Accepted
time: 379ms
memory: 53804kb

input:

5
62
37
88
57
72

output:

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

result:

ok 5 lines

Test #2:

score: 0
Accepted
time: 368ms
memory: 54108kb

input:

5
88
77
21
87
24

output:

4 1 2 6 8 
4 1 3 4 8 
5 1 2 3 4 5 
3 2 6 8 
2 2 6 

result:

ok 5 lines

Test #3:

score: 0
Accepted
time: 372ms
memory: 53708kb

input:

5
59
5
72
76
95

output:

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

result:

ok 5 lines

Test #4:

score: 0
Accepted
time: 377ms
memory: 53404kb

input:

5
3
58
50
91
38

output:

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

result:

ok 5 lines

Test #5:

score: 0
Accepted
time: 375ms
memory: 53892kb

input:

5
6
38
78
60
52

output:

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

result:

ok 5 lines

Test #6:

score: 0
Accepted
time: 367ms
memory: 53280kb

input:

5
53
2
54
17
77

output:

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

result:

ok 5 lines

Subtask #2:

score: 21
Accepted

Dependency #1:

100%
Accepted

Test #7:

score: 21
Accepted
time: 374ms
memory: 53336kb

input:

5
967473
149056
95798
903699
54343

output:

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

result:

ok 5 lines

Test #8:

score: 0
Accepted
time: 376ms
memory: 53944kb

input:

5
824612
692511
834141
820975
111302

output:

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

result:

ok 5 lines

Test #9:

score: 0
Accepted
time: 374ms
memory: 54384kb

input:

5
115600
813100
742542
206782
714068

output:

13 1 2 3 5 6 7 9 10 11 13 15 17 21 
9 1 2 3 4 11 12 14 23 24 
12 1 2 3 5 6 11 12 14 17 18 22 24 
11 1 2 3 5 7 9 11 12 17 19 22 
14 1 2 3 4 5 6 9 10 13 17 18 19 21 24 

result:

ok 5 lines

Test #10:

score: 0
Accepted
time: 377ms
memory: 53960kb

input:

5
271953
490598
560137
729339
980828

output:

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

result:

ok 5 lines

Test #11:

score: 0
Accepted
time: 371ms
memory: 53664kb

input:

5
78005
94222
345802
240639
797525

output:

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

result:

ok 5 lines

Test #12:

score: 0
Accepted
time: 361ms
memory: 53332kb

input:

5
213815
388934
704608
638223
965441

output:

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

result:

ok 5 lines

Subtask #3:

score: 0
Runtime Error

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #13:

score: 0
Runtime Error

input:

5
264009813
338082986
193952046
78609665
69397288

output:


result:


Subtask #4:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

0%

Subtask #5:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

0%