제출 #478300

#제출 시각아이디문제언어결과실행 시간메모리
478300rainboyPraktični (COCI18_prakticni)C11
0 / 130
113 ms3532 KiB
#include <stdio.h> #include <string.h> #define N 100000 #define M 100000 #define L 30 int ds[N], xx[N]; int find(int i) { int p, r; if (ds[i] < 0) return i; p = ds[i], r = find(p); xx[i] ^= xx[p]; ds[i] = p; return r; } int join(int i, int j, int x) { int ri = find(i), rj = find(j); x ^= xx[i] ^ xx[j], i = ri, j = rj; if (i == j) return x; if (ds[i] > ds[j]) ds[i] = j, xx[i] = x; else { if (ds[i] == ds[j]) ds[i]--; ds[j] = i, xx[j] = x; } return 0; } int bb[L]; int get(int x) { int l, y; y = 0; for (l = 0; l < L; l++) if ((x & 1 << l) != 0) { y |= 1 << l; if ((bb[l] & 1 << l) != 0) x ^= bb[l]; else { bb[l] = x; return -y; } } return y; } int main() { static int yy[M]; int n, m, h, i, j, k, l; scanf("%d%d", &n, &m); memset(ds, -1, n * sizeof *ds); k = 0; for (h = 0; h < m; h++) { int x; scanf("%d%d%d", &i, &j, &x), i--, j--; if ((yy[h] = get(join(i, j, x))) < 0) yy[h] = -yy[h], k++; } printf("%d\n", k); for (l = 0; l < L; l++) if (bb[l]) { k = 0; for (h = 0; h < m; h++) if ((yy[h] & 1 << l) != 0) k++; printf("%d %d", bb[l], k); for (h = 0; h < m; h++) if ((yy[h] & 1 << l) != 0) printf(" %d", h + 1); printf("\n"); } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

parkticni.c: In function 'main':
parkticni.c:60:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   60 |  scanf("%d%d", &n, &m);
      |  ^~~~~~~~~~~~~~~~~~~~~
parkticni.c:66:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   66 |   scanf("%d%d%d", &i, &j, &x), i--, j--;
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...