답안 #736919

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
736919 2023-05-06T10:42:13 Z puppy Present (RMI21_present) C++17
8 / 100
3 ms 340 KB
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
bool valid(int k) //1부터 12까지
{
    vector<int> s;
    for (int i = 0; i < 12; i++) {
        if (k & (1 << i)) s.push_back(i + 1);
    }
    for (int i: s) {
        for (int j: s) {
            if ((1 << (__gcd(i, j) - 1)) & k) continue;
            else return false;
        }
    }
    return true;
}
void print_set(int k)
{
    cout << __builtin_popcount(k) << ' ';
    for (int i = 0; i < 12; i++) {
        if (k & (1 << i))cout << i + 1 << ' ';
    }
    cout << '\n';
}
int main()
{
    vector<int> v;
    v.push_back(0);
    for (int i = 1; i < (1 << 12); i++) {
        if (valid(i)) v.push_back(i);
    }
    int T; cin >> T;
    while (T--) {
        int K; cin >> K;
        print_set(v[K]);
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 212 KB Output is correct
2 Correct 2 ms 212 KB Output is correct
3 Correct 2 ms 316 KB Output is correct
4 Correct 2 ms 212 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 2 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 212 KB Output is correct
2 Correct 2 ms 212 KB Output is correct
3 Correct 2 ms 316 KB Output is correct
4 Correct 2 ms 212 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 2 ms 212 KB Output is correct
7 Runtime error 3 ms 340 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 212 KB Output is correct
2 Correct 2 ms 212 KB Output is correct
3 Correct 2 ms 316 KB Output is correct
4 Correct 2 ms 212 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 2 ms 212 KB Output is correct
7 Runtime error 3 ms 340 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 212 KB Output is correct
2 Correct 2 ms 212 KB Output is correct
3 Correct 2 ms 316 KB Output is correct
4 Correct 2 ms 212 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 2 ms 212 KB Output is correct
7 Runtime error 3 ms 340 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 212 KB Output is correct
2 Correct 2 ms 212 KB Output is correct
3 Correct 2 ms 316 KB Output is correct
4 Correct 2 ms 212 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 2 ms 212 KB Output is correct
7 Runtime error 3 ms 340 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -