# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
643342 | 2022-09-21T18:44:03 Z | Matteo_Verz | Present (RMI21_present) | C++17 | 797 ms | 86236 KB |
#include <bits/stdc++.h> #ifdef BLAT #include "debug/debug.hpp" #else #define debug(x...) #endif using namespace std; void generateNextSet(vector <int> &set) { int lastdeleted = 0; while (true) { if (set.empty() || set.back() > lastdeleted + 1) { set.push_back(lastdeleted + 1); break; } lastdeleted = set.back(); set.pop_back(); } long long gcd = 0; for (int i = 0; i < set.size(); i++) for (int j = i + 1; j < set.size(); j++) gcd |= (1 << (__gcd(set[i], set[j]))); for (int i = set.back() - 1; i >= 1; i--) if (gcd & (1 << i)) set.push_back(i); } void printSet(vector <int> &set, int setidx) { reverse(set.begin(), set.end()); // cout << "S" << setidx << " = {"; cout << set.size() << ' '; for (int i = 0; i < set.size(); i++) cout << set[i] << ' '; cout << '\n'; reverse(set.begin(), set.end()); } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); vector <vector <int>> sets = {{0}}; vector <int> set = {1}; for (int i = 1; i <= 1000000; i++) { sets.push_back(set); generateNextSet(set); } int t; cin >> t; while (t--) { int k; cin >> k; if (k == 0) cout << 0 << '\n'; else printSet(sets[k], k); } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 797 ms | 85960 KB | Output is correct |
2 | Correct | 785 ms | 85992 KB | Output is correct |
3 | Correct | 784 ms | 86016 KB | Output is correct |
4 | Correct | 772 ms | 86236 KB | Output is correct |
5 | Correct | 789 ms | 86000 KB | Output is correct |
6 | Correct | 780 ms | 86016 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 797 ms | 85960 KB | Output is correct |
2 | Correct | 785 ms | 85992 KB | Output is correct |
3 | Correct | 784 ms | 86016 KB | Output is correct |
4 | Correct | 772 ms | 86236 KB | Output is correct |
5 | Correct | 789 ms | 86000 KB | Output is correct |
6 | Correct | 780 ms | 86016 KB | Output is correct |
7 | Incorrect | 780 ms | 85964 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 797 ms | 85960 KB | Output is correct |
2 | Correct | 785 ms | 85992 KB | Output is correct |
3 | Correct | 784 ms | 86016 KB | Output is correct |
4 | Correct | 772 ms | 86236 KB | Output is correct |
5 | Correct | 789 ms | 86000 KB | Output is correct |
6 | Correct | 780 ms | 86016 KB | Output is correct |
7 | Incorrect | 780 ms | 85964 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 797 ms | 85960 KB | Output is correct |
2 | Correct | 785 ms | 85992 KB | Output is correct |
3 | Correct | 784 ms | 86016 KB | Output is correct |
4 | Correct | 772 ms | 86236 KB | Output is correct |
5 | Correct | 789 ms | 86000 KB | Output is correct |
6 | Correct | 780 ms | 86016 KB | Output is correct |
7 | Incorrect | 780 ms | 85964 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 797 ms | 85960 KB | Output is correct |
2 | Correct | 785 ms | 85992 KB | Output is correct |
3 | Correct | 784 ms | 86016 KB | Output is correct |
4 | Correct | 772 ms | 86236 KB | Output is correct |
5 | Correct | 789 ms | 86000 KB | Output is correct |
6 | Correct | 780 ms | 86016 KB | Output is correct |
7 | Incorrect | 780 ms | 85964 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |