QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#197408 | #6380. LaLa and Divination Magic | isaunoya | WA | 1ms | 3456kb | C++23 | 1.3kb | 2023-10-02 15:36:46 | 2023-10-02 15:36:46 |
Judging History
answer
#include <bitset>
#include <cstdio>
#include <iostream>
#include <tuple>
#include <vector>
using namespace std;
const int N = 2005;
int n, m;
int s[N][N];
bitset<N> a[N], b[N];
vector<tuple<int, int, int>> ans;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr), cout.tie(nullptr);
cin >> n >> m;
for (int i = 1; i <= n; i++) {
string str;
cin >> str;
for (int j = 1; j <= m; j++)
s[i][j] = str[j - 1] - '0';
for (int j = 1; j <= m; j++)
a[j][i] = s[i][j], b[j][i] = s[i][j] ^ 1;
}
for (int i = 1; i <= m; i++) {
if (a[i].count() == n) {
ans.emplace_back(i, i, 4);
}
if (b[i].count() == n) {
ans.emplace_back(i, i, 1);
}
}
for (int i = 1; i <= m; i++)
for (int j = i + 1; j <= m; j++) {
if ((a[i] | a[j]).count() == n) {
ans.emplace_back(i, j, 4);
}
if ((b[i] | b[j]).count() == n) {
ans.emplace_back(i, j, 1);
}
if ((a[i] | b[j]).count() == n) {
ans.emplace_back(i, j, 2);
}
if ((b[i] | a[j]).count() == n) {
ans.emplace_back(i, j, 3);
}
}
int k = ans.size();
if (k < 1ll * m * (m + 1) / 2) {
cout << -1 << "\n";
}
cout << k << "\n";
for (auto [i, j, t] : ans)
cout << i - 1 << " " << j - 1 << " " << t << "\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3456kb
input:
2 1 1 0
output:
-1 0
result:
wrong answer Jury has a solution while the participant doesn't, Kans = 0