| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 794718 | rainboy | Present (RMI21_present) | C11 | 1 ms | 296 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
#define N 1000000
#define A 8
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int good(int s) {
int a, B;
for (a = 1; a <= A; a++)
for (B = a + 1; B <= A; B++)
if ((s & 1 << a) != 0 && (s & 1 << B) != 0 && (s & 1 << gcd(a, B)) == 0)
return 0;
return 1;
}
int main() {
static int ss[N];
int t, s, n;
scanf("%d", &t);
n = 0;
for (s = 0; s < 1 << A + 1 && n <= N; s += 2)
if (good(s))
ss[n++] = s;
while (t--) {
int i, a, cnt;
scanf("%d", &i);
cnt = 0;
for (a = 1; a <= A; a++)
if ((ss[i] & 1 << a) != 0)
cnt++;
printf("%d", cnt);
for (a = 1; a <= A; a++)
if ((ss[i] & 1 << a) != 0)
printf(" %d", a);
printf("\n");
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
