QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#236547 | #2809. Present | Ahmed57# | 0 | 542ms | 37608kb | C++23 | 1021b | 2023-11-04 04:11:02 | 2024-07-04 02:22:47 |
Judging History
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<int,int>,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));
//cout<<i<<endl;
la.push_back({{i,v.size()},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<<la[k].first.second<<" ";
for(int i = 0;i<30;i++){
if(la[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: 542ms
memory: 37608kb
input:
5 62 37 88 57 72
output:
6 1 2 3 4 5 7 6 1 2 3 4 5 6 4 1 4 7 8 5 1 3 4 5 7 3 1 3 8
result:
wrong answer 1st lines differ - expected: '5 1 2 5 6 7', found: '6 1 2 3 4 5 7 '
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%