社区讨论
全WA,但已过样例
B3643图的存储参与者 2已保存回复 9
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 9 条
- 当前快照
- 1 份
- 快照标识符
- @lo1en09s
- 此快照首次捕获于
- 2023/10/22 19:47 2 年前
- 此快照最后确认于
- 2023/11/02 20:44 2 年前
CPP
#include <iostream>
using namespace std;
int map[1001][1001], a[1001];
int main()
{
int n, m;
cin >> n >> m;
for (int i = 1;i <= n;i++)
{
int x, y;
cin >> x >> y;
map[x][y] = 1;
map[y][x] = 1;
}
for (int i = 1;i <= n;i++)
{
for (int j = 1;j <= n;j++)
{
cout << map[i][j] << " ";
if (map[i][j])
{
a[i]++;
}
}
cout << endl;
}
for (int i = 1;i <= n;i++)
{
cout << a[i] << " ";
for (int j = 1;j <= n;j++)
{
if (map[i][j])
{
cout << j;
}
if (j == n)
{
cout << endl;
}
else
{
cout << " ";
}
}
cout << endl;
}
return 0;
}
回复
共 9 条回复,欢迎继续交流。
正在加载回复...