QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#236542#2809. PresentAhmed57#0 310ms4744kbC++231.2kb2023-11-04 03:51:352024-07-04 02:51:01

Judging History

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

  • [2024-07-04 02:51:01]
  • 评测
  • 测评结果:0
  • 用时:310ms
  • 内存:4744kb
  • [2023-11-04 03:51:35]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
long long lim = 20;
signed main() {
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    long long all = 0;
    vector<pair<pair<int,int>,int>> v;
    for(int i = 0;i<(1<<lim);i++){
        bool ss = 1;
        for(int e1 = 0;e1<lim;e1++){
            if(!(i&(1<<e1)))continue;
            for(int e2 = 0;e2<lim;e2++){
                if(!(i&(1<<e2)))continue;
                if(!(i&(1<<(__gcd(e1+1,e2+1)-1)))){
                    ss = 0;
                    break;
                }
            }
            if(!ss)break;
        }
        all+=ss;
        if(ss){
            int la = -1 , sz = 0;
            for(int e1 = 0;e1<lim;e1++){
                if(i&(1<<e1)){
                    la = i;
                    sz++;
                }
            }
            v.push_back({{la,sz},i});
        }
    }
    cout<<all<<endl;
    sort(v.begin(),v.end());
    int t;cin>>t;
    while(t--){
        int k;cin>>k;
        cout<<v[k].first.second<<" ";
        for(int i = 0;i<lim;i++){
            if(v[k].second&(1<<i))cout<<i+1<<" ";
        }
        cout<<endl;
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 310ms
memory: 4744kb

input:

5
62
37
88
57
72

output:

106919
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:

wrong answer 1st lines differ - expected: '5 1 2 5 6 7', found: '106919'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%

Subtask #5:

score: 0
Skipped

Dependency #1:

0%