#include <bits/stdc++.h>
#define int long long
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
using namespace std;
int N,M,Q;
signed main() {
ios_base::sync_with_stdio(false); cin.tie(nullptr);
cin >> N >> M;
vector<pair<int,int>> ed(M);
for (int i = 0; i < M; i++)
{
cin >> ed[i].first >> ed[i].second;
if(ed[i].first>ed[i].second) swap(ed[i].first,ed[i].second);
}
sort(all(ed));
cout << N+(N-2) << "\n";
for (int i = 0; i < N+1; i++) {
if(i<N-1){
for (int j = 0; j < N; j++)
{
if(j==i||j==i+1) cout << 0 << ' ';
else cout << j+1 << ' ';
}
cout << '\n';
}
if(i>1){
for (int j = 0; j < N; j++)
{
if(j==i-1||j==i-2) cout << 0 << ' ';
else cout << j+1 << ' ';
}
if(i<N) cout << '\n';
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
If people start at 0 and 2, then they can avoid each other |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
If people start at 2 and 3, then they can avoid each other |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
If people start at 2 and 3, then they can avoid each other |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
If people start at 0 and 2, then they can avoid each other |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
If people start at 0 and 2, then they can avoid each other |
3 |
Halted |
0 ms |
0 KB |
- |