답안 #1066748

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1066748 2024-08-20T06:14:00 Z 정민찬(#11123) Present (RMI21_present) C++17
29 / 100
246 ms 174280 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;

vector<int> v;
int G[101][101];
int chk[101];
int cnt = 0;
const int lim = 1e6 + 10;
vector<vector<int>> save;

void go(int p) {
    if (cnt > lim) return;
    int lo = 0;
    for (int i=p-1; i>=1; i--) {
        if (chk[i]) {
            lo = i;
            break;
        }
    }
    if (!lo) {
        save.push_back(v);
        cnt ++;
    }
    lo = max(1, lo);
    for (int i=lo; i<p; i++) {
        for (auto &j : v) {
            chk[G[i][j]] ++;
        }
        v.push_back(i);
        go(i);
        v.pop_back();
        for (auto &j : v) {
            chk[G[i][j]] --;
        }
    }
}

int main() {
    ios_base :: sync_with_stdio(false); cin.tie(NULL);
    for (int i=1; i<=100; i++) {
        for (int j=1; j<=100; j++) {
            G[i][j] = __gcd(i, j);
        }
    }
    go(101);
    int T;
    cin >> T;
    while (T --) {
        int x;
        cin >> x;
        cout << save[x].size() << ' ';
        if (x) {
            for (int i=save[x].size()-1; i>=0; i--) {
                cout << save[x][i] << ' ';
            }
        }
        cout << '\n';
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 198 ms 86076 KB Output is correct
2 Correct 187 ms 85960 KB Output is correct
3 Correct 193 ms 86228 KB Output is correct
4 Correct 201 ms 86212 KB Output is correct
5 Correct 189 ms 85956 KB Output is correct
6 Correct 192 ms 85960 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 198 ms 86076 KB Output is correct
2 Correct 187 ms 85960 KB Output is correct
3 Correct 193 ms 86228 KB Output is correct
4 Correct 201 ms 86212 KB Output is correct
5 Correct 189 ms 85956 KB Output is correct
6 Correct 192 ms 85960 KB Output is correct
7 Correct 206 ms 85960 KB Output is correct
8 Correct 191 ms 86144 KB Output is correct
9 Correct 214 ms 86212 KB Output is correct
10 Correct 187 ms 86156 KB Output is correct
11 Correct 190 ms 85960 KB Output is correct
12 Correct 190 ms 85956 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 198 ms 86076 KB Output is correct
2 Correct 187 ms 85960 KB Output is correct
3 Correct 193 ms 86228 KB Output is correct
4 Correct 201 ms 86212 KB Output is correct
5 Correct 189 ms 85956 KB Output is correct
6 Correct 192 ms 85960 KB Output is correct
7 Correct 206 ms 85960 KB Output is correct
8 Correct 191 ms 86144 KB Output is correct
9 Correct 214 ms 86212 KB Output is correct
10 Correct 187 ms 86156 KB Output is correct
11 Correct 190 ms 85960 KB Output is correct
12 Correct 190 ms 85956 KB Output is correct
13 Runtime error 246 ms 174280 KB Execution killed with signal 11
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 198 ms 86076 KB Output is correct
2 Correct 187 ms 85960 KB Output is correct
3 Correct 193 ms 86228 KB Output is correct
4 Correct 201 ms 86212 KB Output is correct
5 Correct 189 ms 85956 KB Output is correct
6 Correct 192 ms 85960 KB Output is correct
7 Correct 206 ms 85960 KB Output is correct
8 Correct 191 ms 86144 KB Output is correct
9 Correct 214 ms 86212 KB Output is correct
10 Correct 187 ms 86156 KB Output is correct
11 Correct 190 ms 85960 KB Output is correct
12 Correct 190 ms 85956 KB Output is correct
13 Runtime error 246 ms 174280 KB Execution killed with signal 11
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 198 ms 86076 KB Output is correct
2 Correct 187 ms 85960 KB Output is correct
3 Correct 193 ms 86228 KB Output is correct
4 Correct 201 ms 86212 KB Output is correct
5 Correct 189 ms 85956 KB Output is correct
6 Correct 192 ms 85960 KB Output is correct
7 Correct 206 ms 85960 KB Output is correct
8 Correct 191 ms 86144 KB Output is correct
9 Correct 214 ms 86212 KB Output is correct
10 Correct 187 ms 86156 KB Output is correct
11 Correct 190 ms 85960 KB Output is correct
12 Correct 190 ms 85956 KB Output is correct
13 Runtime error 246 ms 174280 KB Execution killed with signal 11
14 Halted 0 ms 0 KB -