답안 #991661

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
991661 2024-06-02T18:21:36 Z Abito Present (RMI21_present) C++17
29 / 100
2701 ms 464724 KB
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define ppb pop_back
#define ep insert
#define endl '\n'
#define elif else if
#define pow pwr
#define sqrt sqrtt
#define int long long
#define y1 YONE
typedef unsigned long long ull;
using namespace std;
vector<vector<int>> S;
int g[30][30];
bool a[30];
bool cmp(vector<int> x,vector<int> y){
    for (int i=1;(int)min(x.size(),y.size())-i>=0;i++){
        if (x[x.size()-i]!=y[y.size()-i]) return x[x.size()-i]<y[y.size()-i];
    }
    return x.size()<y.size();
}
void rec(int i){
    if (i==0){
        vector<int> v;
        for (int i=1;i<=25;i++) if (a[i]) v.pb(i);
        S.pb(v);
        return;
    }
    rec(i-1);
    if (a[i]) return;
    vector<int> v;v.pb(i);
    a[i]=1;
    for (int j=1;j<=25;j++){
        if (a[j] && !a[g[i][j]]){
            v.pb(g[i][j]);
            a[g[i][j]]=1;
        }
    }
    rec(i-1);
    for (auto u:v) a[u]=0;
    return;
}
int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    for (int i=1;i<=25;i++) for (int j=1;j<=25;j++) g[i][j]=__gcd(i,j);
    rec(25);
    sort(S.begin(),S.end(),cmp);
    int t;cin>>t;
    while (t--){
        int k;cin>>k;
        cout<<S[k].size()<<' ';
        for (auto u:S[k]) cout<<u<<' ';cout<<endl;
    }
    return 0;
}

Compilation message

Main.cpp: In function 'int32_t main()':
Main.cpp:54:9: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   54 |         for (auto u:S[k]) cout<<u<<' ';cout<<endl;
      |         ^~~
Main.cpp:54:40: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   54 |         for (auto u:S[k]) cout<<u<<' ';cout<<endl;
      |                                        ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2261 ms 228576 KB Output is correct
2 Correct 2316 ms 230400 KB Output is correct
3 Correct 2255 ms 229336 KB Output is correct
4 Correct 2298 ms 229592 KB Output is correct
5 Correct 2347 ms 230104 KB Output is correct
6 Correct 2217 ms 229848 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2261 ms 228576 KB Output is correct
2 Correct 2316 ms 230400 KB Output is correct
3 Correct 2255 ms 229336 KB Output is correct
4 Correct 2298 ms 229592 KB Output is correct
5 Correct 2347 ms 230104 KB Output is correct
6 Correct 2217 ms 229848 KB Output is correct
7 Correct 2701 ms 229044 KB Output is correct
8 Correct 2367 ms 230212 KB Output is correct
9 Correct 2358 ms 230364 KB Output is correct
10 Correct 2244 ms 229084 KB Output is correct
11 Correct 2300 ms 229596 KB Output is correct
12 Correct 2256 ms 230364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2261 ms 228576 KB Output is correct
2 Correct 2316 ms 230400 KB Output is correct
3 Correct 2255 ms 229336 KB Output is correct
4 Correct 2298 ms 229592 KB Output is correct
5 Correct 2347 ms 230104 KB Output is correct
6 Correct 2217 ms 229848 KB Output is correct
7 Correct 2701 ms 229044 KB Output is correct
8 Correct 2367 ms 230212 KB Output is correct
9 Correct 2358 ms 230364 KB Output is correct
10 Correct 2244 ms 229084 KB Output is correct
11 Correct 2300 ms 229596 KB Output is correct
12 Correct 2256 ms 230364 KB Output is correct
13 Runtime error 2575 ms 464724 KB Execution killed with signal 11
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2261 ms 228576 KB Output is correct
2 Correct 2316 ms 230400 KB Output is correct
3 Correct 2255 ms 229336 KB Output is correct
4 Correct 2298 ms 229592 KB Output is correct
5 Correct 2347 ms 230104 KB Output is correct
6 Correct 2217 ms 229848 KB Output is correct
7 Correct 2701 ms 229044 KB Output is correct
8 Correct 2367 ms 230212 KB Output is correct
9 Correct 2358 ms 230364 KB Output is correct
10 Correct 2244 ms 229084 KB Output is correct
11 Correct 2300 ms 229596 KB Output is correct
12 Correct 2256 ms 230364 KB Output is correct
13 Runtime error 2575 ms 464724 KB Execution killed with signal 11
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2261 ms 228576 KB Output is correct
2 Correct 2316 ms 230400 KB Output is correct
3 Correct 2255 ms 229336 KB Output is correct
4 Correct 2298 ms 229592 KB Output is correct
5 Correct 2347 ms 230104 KB Output is correct
6 Correct 2217 ms 229848 KB Output is correct
7 Correct 2701 ms 229044 KB Output is correct
8 Correct 2367 ms 230212 KB Output is correct
9 Correct 2358 ms 230364 KB Output is correct
10 Correct 2244 ms 229084 KB Output is correct
11 Correct 2300 ms 229596 KB Output is correct
12 Correct 2256 ms 230364 KB Output is correct
13 Runtime error 2575 ms 464724 KB Execution killed with signal 11
14 Halted 0 ms 0 KB -