QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#236543 | #2809. Present | Ahmed57# | 0 | 527ms | 37844kb | C++23 | 1.1kb | 2023-11-04 03:52:40 | 2024-07-04 02:22:47 |
Judging History
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});
}
}
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: 8
Accepted
time: 378ms
memory: 4936kb
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: -8
Wrong Answer
time: 527ms
memory: 37844kb
input:
5 88 77 21 87 24
output:
4 1 4 7 8 3 1 7 8 5 1 2 3 4 5 4 1 3 7 8 2 2 6
result:
wrong answer 1st lines differ - expected: '4 1 2 6 8', found: '4 1 4 7 8 '
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%