# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
737139 | 2023-05-06T17:12:48 Z | puppy | Present (RMI21_present) | C++17 | 4000 ms | 292 KB |
#include <iostream> #include <numeric> using namespace std; int g[41][41]; long long get_closed(long long ind) { long long ans = ind; for (int i = 40; i >= 1; i--) { if (ans & 1LL << i-1) { for (int j = i-1; j >= 1; j--) { if (ans & 1LL << j-1) { ans |= 1LL << g[i][j]-1; } } } } return ans; } long long get_next(long long cur) { long long bef = get_closed(cur); for (int i = 1;; i++) { if (!(bef & (1LL << i-1))) { for (int j = 1; j < i; j++) { if (cur & (1LL << j-1)) cur -= 1LL << j-1; } cur += 1LL << i-1; return cur; } } } int popcount(long long id) { int cnt = 0; for (int i = 0; i < 40; i++) { if (id & (1LL << i)) cnt++; } return cnt; } void print_set(long long id) { cout << popcount(id) << ' '; for (int i = 1; i <= 40; i++) { if (id & (1LL << i-1)) cout << i << ' '; } cout << '\n'; } int main() { for (int i = 1; i <= 40; i++) { for (int j = 1; j <= 40; j++) { g[i][j] = gcd(i, j); } } int T; cin >> T; while (T--) { int K; cin >> K; long long cur = 0; for (int i = 1; i <= K; i++) cur = get_next(cur); print_set(get_closed(cur)); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 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 | 0 ms | 292 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 | 0 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 | 0 ms | 292 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 932 ms | 288 KB | Output is correct |
8 | Correct | 1380 ms | 280 KB | Output is correct |
9 | Correct | 1069 ms | 212 KB | Output is correct |
10 | Correct | 1281 ms | 284 KB | Output is correct |
11 | Correct | 604 ms | 212 KB | Output is correct |
12 | Correct | 1190 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 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 | 0 ms | 292 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 932 ms | 288 KB | Output is correct |
8 | Correct | 1380 ms | 280 KB | Output is correct |
9 | Correct | 1069 ms | 212 KB | Output is correct |
10 | Correct | 1281 ms | 284 KB | Output is correct |
11 | Correct | 604 ms | 212 KB | Output is correct |
12 | Correct | 1190 ms | 212 KB | Output is correct |
13 | Execution timed out | 4058 ms | 212 KB | Time limit exceeded |
14 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 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 | 0 ms | 292 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 932 ms | 288 KB | Output is correct |
8 | Correct | 1380 ms | 280 KB | Output is correct |
9 | Correct | 1069 ms | 212 KB | Output is correct |
10 | Correct | 1281 ms | 284 KB | Output is correct |
11 | Correct | 604 ms | 212 KB | Output is correct |
12 | Correct | 1190 ms | 212 KB | Output is correct |
13 | Execution timed out | 4058 ms | 212 KB | Time limit exceeded |
14 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 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 | 0 ms | 292 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 932 ms | 288 KB | Output is correct |
8 | Correct | 1380 ms | 280 KB | Output is correct |
9 | Correct | 1069 ms | 212 KB | Output is correct |
10 | Correct | 1281 ms | 284 KB | Output is correct |
11 | Correct | 604 ms | 212 KB | Output is correct |
12 | Correct | 1190 ms | 212 KB | Output is correct |
13 | Execution timed out | 4058 ms | 212 KB | Time limit exceeded |
14 | Halted | 0 ms | 0 KB | - |