답안 #737129

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
737129 2023-05-06T16:39:09 Z mjhmjh1104 Present (RMI21_present) C++17
29 / 100
3956 ms 14056 KB
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

int gcd(int x, int y) {
    if (!x || !y) return x + y;
    return x % y ? gcd(y, x % y) : y;
}

int g[26][26];

bool validate(const int &v) {
    for (int i = 0; i < 25; i++) if (v & 1 << i) for (int j = i + 1; j < 25; j++) if (v & 1 << j) {
        int k = g[i + 1][j + 1] - 1;
        if (~v & 1 << k) return false;
    }
    return true;
}

int t, k;
vector<int> lt;

int main() {
    for (int i = 0; i < 26; i++) for (int j = 0; j < 26; j++) g[i][j] = gcd(i, j);
    for (int i = 0; i < 1 << 25; i++) {
        if (!validate(i)) continue;
        lt.push_back(i);
    }
    for (scanf("%d", &t); t--; ) {
        scanf("%d", &k);
        int &c = lt[k];
        vector<int> v;
        for (int i = 0; i < 25; i++) if (c & 1 << i) v.push_back(i + 1);
        printf("%d ", (int)v.size());
        for (auto &i: v) printf("%d ", i);
        puts("");
    }
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:30:15: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   30 |     for (scanf("%d", &t); t--; ) {
      |          ~~~~~^~~~~~~~~~
Main.cpp:31:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   31 |         scanf("%d", &k);
      |         ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 3956 ms 8524 KB Output is correct
2 Correct 3858 ms 8824 KB Output is correct
3 Correct 3822 ms 8728 KB Output is correct
4 Correct 3866 ms 8596 KB Output is correct
5 Correct 3935 ms 8764 KB Output is correct
6 Correct 3844 ms 8556 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3956 ms 8524 KB Output is correct
2 Correct 3858 ms 8824 KB Output is correct
3 Correct 3822 ms 8728 KB Output is correct
4 Correct 3866 ms 8596 KB Output is correct
5 Correct 3935 ms 8764 KB Output is correct
6 Correct 3844 ms 8556 KB Output is correct
7 Correct 3784 ms 8736 KB Output is correct
8 Correct 3713 ms 8840 KB Output is correct
9 Correct 3765 ms 8624 KB Output is correct
10 Correct 3677 ms 8768 KB Output is correct
11 Correct 3749 ms 8828 KB Output is correct
12 Correct 3704 ms 8704 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3956 ms 8524 KB Output is correct
2 Correct 3858 ms 8824 KB Output is correct
3 Correct 3822 ms 8728 KB Output is correct
4 Correct 3866 ms 8596 KB Output is correct
5 Correct 3935 ms 8764 KB Output is correct
6 Correct 3844 ms 8556 KB Output is correct
7 Correct 3784 ms 8736 KB Output is correct
8 Correct 3713 ms 8840 KB Output is correct
9 Correct 3765 ms 8624 KB Output is correct
10 Correct 3677 ms 8768 KB Output is correct
11 Correct 3749 ms 8828 KB Output is correct
12 Correct 3704 ms 8704 KB Output is correct
13 Runtime error 3747 ms 14056 KB Execution killed with signal 11
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3956 ms 8524 KB Output is correct
2 Correct 3858 ms 8824 KB Output is correct
3 Correct 3822 ms 8728 KB Output is correct
4 Correct 3866 ms 8596 KB Output is correct
5 Correct 3935 ms 8764 KB Output is correct
6 Correct 3844 ms 8556 KB Output is correct
7 Correct 3784 ms 8736 KB Output is correct
8 Correct 3713 ms 8840 KB Output is correct
9 Correct 3765 ms 8624 KB Output is correct
10 Correct 3677 ms 8768 KB Output is correct
11 Correct 3749 ms 8828 KB Output is correct
12 Correct 3704 ms 8704 KB Output is correct
13 Runtime error 3747 ms 14056 KB Execution killed with signal 11
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3956 ms 8524 KB Output is correct
2 Correct 3858 ms 8824 KB Output is correct
3 Correct 3822 ms 8728 KB Output is correct
4 Correct 3866 ms 8596 KB Output is correct
5 Correct 3935 ms 8764 KB Output is correct
6 Correct 3844 ms 8556 KB Output is correct
7 Correct 3784 ms 8736 KB Output is correct
8 Correct 3713 ms 8840 KB Output is correct
9 Correct 3765 ms 8624 KB Output is correct
10 Correct 3677 ms 8768 KB Output is correct
11 Correct 3749 ms 8828 KB Output is correct
12 Correct 3704 ms 8704 KB Output is correct
13 Runtime error 3747 ms 14056 KB Execution killed with signal 11
14 Halted 0 ms 0 KB -