QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#668602 | #7900. Gifts from Knowledge | nageing | WA | 8ms | 3808kb | C++20 | 1.1kb | 2024-10-23 15:09:11 | 2024-10-23 15:09:13 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
const int mod = 1e9 + 7;
bool chmin(int &x, int y) {
if (x > y) {
x = y;
return 1;
}
return 0;
}
bool chmax(int &x, int y) {
if (x < y) {
x = y;
return 1;
}
return 0;
}
void solve() {
int n, m;
cin >> n >> m;
vector<string>g(n);
for (int i = 0; i < n; i ++) {
cin >> g[i];
}
vector<int> cnt(m);
for (int i = 0; i < n; i ++) {
for (int j = 0; j < m; j ++) {
if (g[i][j] == '1') {
cnt[j] ++;
cnt[m - j - 1] ++;
}
}
}
ll ans = 1;
for (int i = 0; i < m; i ++) {
if (cnt[i] > 2) {
cout << 0 << '\n';
return;
}
}
for (int i = 0; i < n; i ++) {
bool ok = 0;
for (int j = 0; j < m; j ++) {
if (g[i][j] == '1') {
if (cnt[j] == 2 || cnt[m - j - 1] == 2) {
ok = 1;
}
cnt[j] --;
cnt[m - j - 1] --;
}
}
if (ok) ans = ans * 2 % mod;
}
cout << ans << '\n';
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr); cout.tie(nullptr);
int t = 1;
cin >> t;
while (t --) {
solve();
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3584kb
input:
3 3 5 01100 10001 00010 2 1 1 1 2 3 001 001
output:
4 0 2
result:
ok 3 number(s): "4 0 2"
Test #2:
score: -100
Wrong Answer
time: 8ms
memory: 3808kb
input:
15613 10 10 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 15 8 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 1 5 00000 5 9 000000000 000000000 0000...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
wrong answer 1st numbers differ - expected: '1024', found: '1'