# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
737034 | 2023-05-06T13:41:24 Z | mjhmjh1104 | Present (RMI21_present) | C++17 | 1 ms | 340 KB |
#include <cstdio> #include <vector> #include <algorithm> using namespace std; int gcd(int x, int y) { return x % y ? gcd(y, x % y) : y; } bool validate(const vector<int> &v) { for (auto &i: v) for (auto &j: v) { int k = gcd(i, j); if (find(v.begin(), v.end(), k) == v.end()) return false; } return true; } int t, k; vector<vector<int>> lt; int main() { for (int i = 0; i < 1 << 8; i++) { vector<int> curr; for (int j = 7; j >= 0; j--) if (i & 1 << j) curr.push_back(j + 1); if (!validate(curr)) continue; lt.push_back(curr); } sort(lt.begin(), lt.end()); for (scanf("%d", &t); t--; ) { scanf("%d", &k); auto &c = lt[k]; printf("%d ", (int)c.size()); for (int i = (int)c.size() - 1; i >= 0; i--) printf("%d ", c[i]); puts(""); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Runtime error | 1 ms | 340 KB | Execution killed with signal 11 |
8 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Runtime error | 1 ms | 340 KB | Execution killed with signal 11 |
8 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Runtime error | 1 ms | 340 KB | Execution killed with signal 11 |
8 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Runtime error | 1 ms | 340 KB | Execution killed with signal 11 |
8 | Halted | 0 ms | 0 KB | - |