This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
#define N 3000
int main() {
static int kk[N][N], cc[N], ii[N];
int n, n_, h, i, j, s, c;
scanf("%d%d", &s, &n);
if (s != 1)
return 0;
for (i = 0; i < n; i++)
for (j = 0; j < n; j++)
scanf("%d", &kk[i][j]);
n_ = 0;
for (i = 0, c = 1; i < n; i++) {
if (cc[i])
continue;
cc[i] = c, ii[n_++] = i;
for (j = i + 1; j < n; j++)
if (kk[i][j] == 1)
cc[j] = c, ii[n_++] = j;
c ^= 3;
}
for (i = 0; i < n; i++)
printf("%d ", cc[i]);
printf("\n");
for (h = 0; h < n - 1; h++)
printf("%d %d\n", ii[h] + 1, ii[h + 1] + 1);
return 0;
}
Compilation message (stderr)
izlet.c: In function 'main':
izlet.c:9:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
9 | scanf("%d%d", &s, &n);
| ^~~~~~~~~~~~~~~~~~~~~
izlet.c:14:4: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
14 | scanf("%d", &kk[i][j]);
| ^~~~~~~~~~~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |