# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1066833 | 2024-08-20T07:51:40 Z | 김은성(#11121) | Present (RMI21_present) | C++17 | 1112 ms | 596 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int K = 40; const int gap = 250000; int g[45][45]; int gcd(int a, int b){ if(b==0) return a; return gcd(b, a%b); } bool good(ll mask){ int i, j; for(i=2; i<=K; i++){ if(!((mask & (1ll<<(i-1))))) continue; for(j=i+1; j<=K; j++){ if((mask & (1ll<<(j-1))) && !(mask & (1ll<<(g[i][j]-1)))) return false; } } return true; } void printset(ll mask){ vector<int> ans; int i; for(i=1; i<=K; i++){ if((mask & (1ll<<(i-1)))) ans.push_back(i); } printf("%d ", ans.size()); for(int u: ans){ printf("%d ", u); } printf("\n"); } ll crit[150235] = {0, 2929323, 6415551, 10806271, 16875563, }; int main(){ int t; int k; scanf("%d", &t); int i, j; for(i=1; i<=K; i++){ for(j=1; j<=K; j++) g[i][j] = gcd(i, j); } while(t--){ scanf("%d", &k); int cur = k/gap*gap - 1; ll i; for(i = crit[k/gap]; ; i++){ if(good(i)){ cur++; if(cur == k) break; } } printset(i); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 901 ms | 440 KB | Output is correct |
8 | Correct | 763 ms | 436 KB | Output is correct |
9 | Correct | 995 ms | 344 KB | Output is correct |
10 | Correct | 1077 ms | 460 KB | Output is correct |
11 | Correct | 522 ms | 436 KB | Output is correct |
12 | Correct | 1112 ms | 436 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 901 ms | 440 KB | Output is correct |
8 | Correct | 763 ms | 436 KB | Output is correct |
9 | Correct | 995 ms | 344 KB | Output is correct |
10 | Correct | 1077 ms | 460 KB | Output is correct |
11 | Correct | 522 ms | 436 KB | Output is correct |
12 | Correct | 1112 ms | 436 KB | Output is correct |
13 | Incorrect | 445 ms | 596 KB | Output isn't correct |
14 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 901 ms | 440 KB | Output is correct |
8 | Correct | 763 ms | 436 KB | Output is correct |
9 | Correct | 995 ms | 344 KB | Output is correct |
10 | Correct | 1077 ms | 460 KB | Output is correct |
11 | Correct | 522 ms | 436 KB | Output is correct |
12 | Correct | 1112 ms | 436 KB | Output is correct |
13 | Incorrect | 445 ms | 596 KB | Output isn't correct |
14 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 901 ms | 440 KB | Output is correct |
8 | Correct | 763 ms | 436 KB | Output is correct |
9 | Correct | 995 ms | 344 KB | Output is correct |
10 | Correct | 1077 ms | 460 KB | Output is correct |
11 | Correct | 522 ms | 436 KB | Output is correct |
12 | Correct | 1112 ms | 436 KB | Output is correct |
13 | Incorrect | 445 ms | 596 KB | Output isn't correct |
14 | Halted | 0 ms | 0 KB | - |