Submission #642935

#TimeUsernameProblemLanguageResultExecution timeMemory
642935danikoynovPresent (RMI21_present)C++14
8 / 100
237 ms16204 KiB
/** ____ ____ ____ ____ ____ ____ ||l |||e |||i |||n |||a |||d || ||__|||__|||__|||__|||__|||__|| |/__\|/__\|/__\|/__\|/__\|/__\| **/ #include<bits/stdc++.h> #define endl '\n' using namespace std; typedef long long ll; void speed() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } const int maxn = 1e5 + 10, maxnum = 150; vector < vector < int > > st; int gcd[maxnum][maxnum]; void preprocess() { for (int i = 1; i < maxnum; i ++) for (int j = 1; j < maxnum; j ++) gcd[i][j] = __gcd(i, j); int mask = 0; while(st.size() < maxn) { vector < int > num; for (int bit = 0; (1 << bit) <= mask; bit ++) if ((mask & (1 << bit))) num.push_back(bit + 1); bool tf = true; for (int i = 0; i < num.size() && tf; i ++) for (int j = i + 1; j < num.size(); j ++) { int x = gcd[num[i]][num[j]]; if ((mask & (1 << (x - 1))) == 0) { tf = false; break; } } if (tf) { st.push_back(num); } mask ++; } //cout << "Done " << mask << endl; //exit(0); } void solve() { int n; cin >> n; cout << st[n].size(); for (int v : st[n]) cout << " " << v; cout << endl; } int main() { preprocess(); int t; cin >> t; while(t --) solve(); return 0; }

Compilation message (stderr)

Main.cpp: In function 'void preprocess()':
Main.cpp:39:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |         for (int i = 0; i < num.size() && tf; i ++)
      |                         ~~^~~~~~~~~~~~
Main.cpp:40:35: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |             for (int j = i + 1; j < num.size(); j ++)
      |                                 ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...