結果
問題 | No.2255 Determinant Sum |
ユーザー |
![]() |
提出日時 | 2023-03-26 01:41:13 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 30 ms / 2,000 ms |
コード長 | 1,331 bytes |
コンパイル時間 | 1,043 ms |
コンパイル使用メモリ | 30,720 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-19 05:34:54 |
合計ジャッジ時間 | 1,284 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
#include <stdio.h> int main () { int t = 0; int n = 0; int p = 0; int a[50][50] = {}; int res = 0; long long b[50] = {}; res = scanf("%d", &t); while (t > 0) { res = scanf("%d", &n); res = scanf("%d", &p); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { res = scanf("%d", a[i]+j); } } if (p > 2) { printf("0\n"); } else { int bcnt = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (a[i][j] < 0) { int cnt = 0; for (int k = 0; k < n; k++) { if (a[i][k] < 0) { cnt++; } a[i][k] = 0; } if (cnt == 1) { a[i][j] = 1; } } } } for (int i = 0; i < n; i++) { long long v = 0LL; for (int j = 0; j < n; j++) { if (a[i][j] > 0) { v |= (1LL<<((long long)j)); } } for (int j = 0; j < bcnt; j++) { if (v > (v^b[j])) { v = (v^b[j]); } } if (v > 0) { b[bcnt] = v; bcnt++; } } if (bcnt == n) { printf("1\n"); } else { printf("0\n"); } } t--; } return 0; }