結果
| 問題 |
No.2255 Determinant Sum
|
| コンテスト | |
| ユーザー |
chro_96
|
| 提出日時 | 2023-03-26 01:38:13 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,430 bytes |
| コンパイル時間 | 182 ms |
| コンパイル使用メモリ | 31,616 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-19 05:31:07 |
| 合計ジャッジ時間 | 1,810 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 WA * 16 |
ソースコード
#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++;
}
if (a[k][j] < 0) {
cnt++;
}
a[i][k] = 0;
a[k][j] = 0;
}
if (cnt == 2) {
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[i])) {
v = (v^b[i]);
}
}
if (v > 0) {
b[bcnt] = v;
bcnt++;
}
}
if (bcnt == n) {
printf("1\n");
} else {
printf("0\n");
}
}
t--;
}
return 0;
}
chro_96