#include <stdio.h>
#include <string.h>
#define N 100
#define L 50000
int main() {
static int aa[N], gg[N];
static char ans[N][N + 1];
int n, i, j;
scanf("%d", &n);
for (i = 0; i < n; i++) {
static char s[L + 1];
int l, h, r;
scanf("%s", s), l = strlen(s);
for (h = 0, r = 1; h < l; h++)
if (s[h] == 'A')
aa[i] ^= r, r = r % 3 + 1;
else if (s[h] == 'G')
gg[i] ^= r, r = r % 3 + 1;
else if (s[h] == 'C')
aa[i] ^= r, r = r % 3 + 1, gg[i] ^= r, r = r % 3 + 1;
else
gg[i] ^= r, r = r % 3 + 1, aa[i] ^= r, r = r % 3 + 1;
}
for (i = 0; i < n; i++)
for (j = 0; j < n; j++)
ans[i][j] = aa[i] == aa[j] && gg[i] == gg[j] ? '1' : '0';
for (i = 0; i < n; i++)
printf("%s\n", ans[i]);
return 0;
}
Compilation message
gta.c: In function 'main':
gta.c:12:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
12 | scanf("%d", &n);
| ^~~~~~~~~~~~~~~
gta.c:17:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
17 | scanf("%s", s), l = strlen(s);
| ^~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Incorrect |
0 ms |
276 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
8 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
9 |
Incorrect |
6 ms |
716 KB |
Output isn't correct |
10 |
Incorrect |
58 ms |
5172 KB |
Output isn't correct |