# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
737129 | mjhmjh1104 | Present (RMI21_present) | C++17 | 3956 ms | 14056 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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("");
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |