QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#391383 | #6432. Puzzle in Inazuma | DYSisNoob | WA | 0ms | 3756kb | C++14 | 2.3kb | 2024-04-16 15:59:47 | 2024-04-16 15:59:48 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, sum = 0;
cin >> n;
vector<vector<int>> x(n + 1, vector<int>(n + 1)), ans;
for (int i = 1; i <= n; i++)
{
for (int j = i + 1; j <= n; j++)
{
cin >> x[i][j];
}
}
for (int i = 1; i <= n; i++)
{
for (int j = i + 1; j <= n; j++)
{
int tmp;
cin >> tmp;
x[i][j] -= tmp;
sum += x[i][j];
}
}
if (sum != 0)
{
cout << -1 << '\n';
return 0;
}
if (n >= 6)
{
auto ins = [&](int a, int b, int c, int d, int x) -> void
{
ans.push_back(vector<int>(5));
ans.end()[-1][0] = a, ans.end()[-1][1] = b, ans.end()[-1][2] = c, ans.end()[-1][3] = d, ans.end()[-1][4] = x;
};
for (int i = 2; i <= n; i++)
{
for (int j = i + 1; j <= n; j++)
{
if (x[i][j] == 0) continue;
int tmp[7] = {i, 0, 0, j, 0, 1, x[i][j]};
for (int k = 1, cur = 1; k <= 6; k++)
{
if (cur > 4) break;
if (k != i && k != j) tmp[cur] = k, cur >>= 1;
}
ins(tmp[3], tmp[0], tmp[1], tmp[4], -tmp[6]);
ins(tmp[3], tmp[0], tmp[1], tmp[2], tmp[6]);
ins(tmp[4], tmp[0], tmp[2], tmp[3], tmp[6]);
ins(tmp[4], tmp[0], tmp[1], tmp[2], -tmp[6]);
ins(tmp[5], tmp[0], tmp[1], tmp[4], tmp[6]);
ins(tmp[5], tmp[0], tmp[1], tmp[2], -tmp[6]);
ins(tmp[4], tmp[0], tmp[2], tmp[5], -tmp[6]);
ins(tmp[4], tmp[0], tmp[1], tmp[2], tmp[6]);
}
}
for (int i = 3; i <= n; i++)
{
if (x[1][i] == 0) continue;
int tmp[7] = {1, 0, 0, i, 0, 2, x[1][i]};
for (int j = 3, cur = 1; j <= 6; j++)
{
if (cur > 4) break;
if (j != i) tmp[cur] = j, cur >>= 1;
}
ins(tmp[3], tmp[0], tmp[1], tmp[4], -tmp[6]);
ins(tmp[3], tmp[0], tmp[1], tmp[2], tmp[6]);
ins(tmp[4], tmp[0], tmp[2], tmp[3], tmp[6]);
ins(tmp[4], tmp[0], tmp[1], tmp[2], -tmp[6]);
ins(tmp[5], tmp[0], tmp[1], tmp[4], tmp[6]);
ins(tmp[5], tmp[0], tmp[1], tmp[2], -tmp[6]);
ins(tmp[4], tmp[0], tmp[2], tmp[5], -tmp[6]);
ins(tmp[4], tmp[0], tmp[1], tmp[2], tmp[6]);
}
cout << ans.size() << '\n';
for (int i = 0; i < ans.size(); i++)
{
for (int j = 0; j <= 4; j++)
{
cout << ans[i][j] << " ";
}
cout << '\n';
}
}
else if (n == 5)
{
}
else
{
}
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3756kb
input:
4 0 1 1 0 0 1 1 0 0 1 1 0
output:
result:
wrong output format Unexpected end of file - int32 expected