답안 #991721

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
991721 2024-06-02T21:53:51 Z Abito Present (RMI21_present) C++17
29 / 100
1026 ms 299988 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;

int gc[30][30];
vector<vector<int>> ans;
bool cnt[30];

void solve(int idx)
{
    if(idx==0)
    {
        vector<int> v;
        for(int i = 1 ; i<=25 ; i++)
            if(cnt[i])
                v.pb(i);
        reverse(v.begin(),v.end());
        ans.pb(v);
        return;
    }
    solve(idx-1);
    if(cnt[idx])
        return;
    cnt[idx]=1;
    vector<int> vis;
    vis.pb(idx);
    for(int 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;
    return;
}

int main()
{
    d3
    for(int i = 1 ; 25>=i ; i++)
        for(int j = 1 ; 25>=j ; j++)
            gc[i][j]=__gcd(i,j);
    solve(25);
    sort(ans.begin(),ans.end());
    int 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
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 779 ms 147676 KB Output is correct
2 Correct 803 ms 147928 KB Output is correct
3 Correct 771 ms 147420 KB Output is correct
4 Correct 804 ms 148180 KB Output is correct
5 Correct 799 ms 148440 KB Output is correct
6 Correct 841 ms 148440 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 779 ms 147676 KB Output is correct
2 Correct 803 ms 147928 KB Output is correct
3 Correct 771 ms 147420 KB Output is correct
4 Correct 804 ms 148180 KB Output is correct
5 Correct 799 ms 148440 KB Output is correct
6 Correct 841 ms 148440 KB Output is correct
7 Correct 849 ms 148444 KB Output is correct
8 Correct 816 ms 147676 KB Output is correct
9 Correct 798 ms 147552 KB Output is correct
10 Correct 903 ms 147576 KB Output is correct
11 Correct 834 ms 147932 KB Output is correct
12 Correct 789 ms 148700 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 779 ms 147676 KB Output is correct
2 Correct 803 ms 147928 KB Output is correct
3 Correct 771 ms 147420 KB Output is correct
4 Correct 804 ms 148180 KB Output is correct
5 Correct 799 ms 148440 KB Output is correct
6 Correct 841 ms 148440 KB Output is correct
7 Correct 849 ms 148444 KB Output is correct
8 Correct 816 ms 147676 KB Output is correct
9 Correct 798 ms 147552 KB Output is correct
10 Correct 903 ms 147576 KB Output is correct
11 Correct 834 ms 147932 KB Output is correct
12 Correct 789 ms 148700 KB Output is correct
13 Runtime error 1026 ms 299988 KB Execution killed with signal 11
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 779 ms 147676 KB Output is correct
2 Correct 803 ms 147928 KB Output is correct
3 Correct 771 ms 147420 KB Output is correct
4 Correct 804 ms 148180 KB Output is correct
5 Correct 799 ms 148440 KB Output is correct
6 Correct 841 ms 148440 KB Output is correct
7 Correct 849 ms 148444 KB Output is correct
8 Correct 816 ms 147676 KB Output is correct
9 Correct 798 ms 147552 KB Output is correct
10 Correct 903 ms 147576 KB Output is correct
11 Correct 834 ms 147932 KB Output is correct
12 Correct 789 ms 148700 KB Output is correct
13 Runtime error 1026 ms 299988 KB Execution killed with signal 11
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 779 ms 147676 KB Output is correct
2 Correct 803 ms 147928 KB Output is correct
3 Correct 771 ms 147420 KB Output is correct
4 Correct 804 ms 148180 KB Output is correct
5 Correct 799 ms 148440 KB Output is correct
6 Correct 841 ms 148440 KB Output is correct
7 Correct 849 ms 148444 KB Output is correct
8 Correct 816 ms 147676 KB Output is correct
9 Correct 798 ms 147552 KB Output is correct
10 Correct 903 ms 147576 KB Output is correct
11 Correct 834 ms 147932 KB Output is correct
12 Correct 789 ms 148700 KB Output is correct
13 Runtime error 1026 ms 299988 KB Execution killed with signal 11
14 Halted 0 ms 0 KB -