# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
737030 | 2023-05-06T13:34:55 Z | jk410 | Present (RMI21_present) | C++17 | 1 ms | 452 KB |
#include <bits/stdc++.h> using namespace std; int T; const int N = 8; int gcd(int x, int y) { while (y) { int tmp = x % y; x = y; y = tmp; } return x; } bool check(int x) { vector<int> v; for (int i = 0; i < N; i++) { if (x & (1 << i)) v.push_back(i + 1); } int sz = (int)v.size(); for (int i = 0; i < sz; i++) { for (int j = i + 1; j < sz; j++) { if (!(x & (1 << gcd(v[i], v[j]) - 1))) return false; } } return true; } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); vector<int> v; v.push_back(0); for (int i = 1; i < (1 << N); i++) { if (check(i)) v.push_back(i); } cin >> T; while (T--) { int k; cin >> k; k = v[k]; vector<int> ans; for (int i = 0; i < N; i++) { if (k & (1 << i)) ans.push_back(i + 1); } cout << (int)ans.size() << " "; for (int i : ans) cout << i << " "; cout << "\n"; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 320 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 404 KB | Output is correct |
5 | Correct | 1 ms | 320 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 320 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 404 KB | Output is correct |
5 | Correct | 1 ms | 320 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Runtime error | 1 ms | 452 KB | Execution killed with signal 11 |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 320 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 404 KB | Output is correct |
5 | Correct | 1 ms | 320 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Runtime error | 1 ms | 452 KB | Execution killed with signal 11 |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 320 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 404 KB | Output is correct |
5 | Correct | 1 ms | 320 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Runtime error | 1 ms | 452 KB | Execution killed with signal 11 |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 320 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 404 KB | Output is correct |
5 | Correct | 1 ms | 320 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Runtime error | 1 ms | 452 KB | Execution killed with signal 11 |
8 | Halted | 0 ms | 0 KB | - |