Submission #991720

# Submission time Handle Problem Language Result Execution time Memory
991720 2024-06-02T21:53:43 Z De3b0o Present (RMI21_present) C++14
8 / 100
58 ms 13056 KB
#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define in insert
#define pb push_back
#define ppb pop_back()
#define d3 ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define cans cout << ans << "\n";
#define yes cout << "Yes" << "\n";
#define no cout << "No" << "\n";
#define pll pair<ll,ll>
#define lin cout << "\n";
#define sqr 340
#define mod 1000000007
#define mid ((l+r)/2)
#define lc (2*n)
#define rc (2*n+1)

using namespace std;

int16_t gc[26][26];
vector<vector<int16_t>> ans;
bool cnt[26];

void solve(int16_t idx)
{
    if(idx==0)
    {
        vector<int16_t> v;
        for(int16_t i = 1 ; 25>=i ; i++)
        {
            if(cnt[i]==1)
                v.pb(i);
        }
        reverse(v.begin(),v.end());
        ans.pb(v);
        return;
    }
    solve(idx-1);
    if(cnt[idx])
        return;
    cnt[idx]=1;
    vector<int16_t> vis;
    vis.pb(idx);
    for(int16_t i = 1 ; 25>=i ; i++)
    {
        if(cnt[i]&&cnt[gc[i][idx]]==0)
        {
            vis.pb(gc[i][idx]);
            cnt[gc[i][idx]]=1;
        }
    }
    solve(idx-1);
    for(auto it : vis)
        cnt[it]=0;
}

int main()
{
    d3
    for(int16_t i = 1 ; 25>=i ; i++)
        for(int16_t j = 1 ; 25>=j ; j++)
            gc[i][j]=__gcd(i,j);
    solve(20);
    sort(ans.begin(),ans.end());
    int16_t t;
    cin >> t;
    while(t--)
    {
        int k;
        cin >> k;
        cout << ans[k].size() << " ";
        for(int i = ans[k].size()-1 ; i>=0 ; i--)
            cout << ans[k][i] << " ";
        lin
    }
}
# Verdict Execution time Memory Grader output
1 Correct 58 ms 6916 KB Output is correct
2 Correct 45 ms 6412 KB Output is correct
3 Correct 47 ms 6416 KB Output is correct
4 Correct 47 ms 6404 KB Output is correct
5 Correct 46 ms 6432 KB Output is correct
6 Correct 49 ms 6424 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 58 ms 6916 KB Output is correct
2 Correct 45 ms 6412 KB Output is correct
3 Correct 47 ms 6416 KB Output is correct
4 Correct 47 ms 6404 KB Output is correct
5 Correct 46 ms 6432 KB Output is correct
6 Correct 49 ms 6424 KB Output is correct
7 Runtime error 54 ms 13056 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 58 ms 6916 KB Output is correct
2 Correct 45 ms 6412 KB Output is correct
3 Correct 47 ms 6416 KB Output is correct
4 Correct 47 ms 6404 KB Output is correct
5 Correct 46 ms 6432 KB Output is correct
6 Correct 49 ms 6424 KB Output is correct
7 Runtime error 54 ms 13056 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 58 ms 6916 KB Output is correct
2 Correct 45 ms 6412 KB Output is correct
3 Correct 47 ms 6416 KB Output is correct
4 Correct 47 ms 6404 KB Output is correct
5 Correct 46 ms 6432 KB Output is correct
6 Correct 49 ms 6424 KB Output is correct
7 Runtime error 54 ms 13056 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 58 ms 6916 KB Output is correct
2 Correct 45 ms 6412 KB Output is correct
3 Correct 47 ms 6416 KB Output is correct
4 Correct 47 ms 6404 KB Output is correct
5 Correct 46 ms 6432 KB Output is correct
6 Correct 49 ms 6424 KB Output is correct
7 Runtime error 54 ms 13056 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -