| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1360570 | clue_ | Make them Meet (EGOI24_makethemmeet) | C++20 | 3 ms | 344 KiB |
// stress max
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pp pair <int, int>
#define fi first
#define se second
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define all(a) (a).begin (), (a).end ()
const int N = 1e6 + 9;
const int mod = 1;
void add (int &a, int b){
a += b; if (a >= mod) a -= mod;
}
void sub (int &a, int b){
a -= b; if (a < 0) a += mod;
}
int n, m;
vector <int> adj[N];
vector <pp> edges;
namespace star {
bool check (){
sort (edges.begin (), edges.end ());
for (int i = 1; i < n; i++) if (edges[i - 1].fi != 0 || edges[i - 1].se != i) return 0;
return 1;
}
void solve (){
cout << (n - 1) * 3 - 2 + 1 << "\n";
for (int j = 1; j < n; j++){
cout << 0 << ' ';
for (int i = 1; i < n; i++){
if (i == j) cout << 0 << ' ';
else cout << i << ' ';
}
cout << '\n';
if (j != 1){
cout << "0 0 ";
for (int i = 2; i < n; i++) cout << i << ' ';
cout << '\n';
cout << "0 0 ";
for (int i = 2; i < n; i++) cout << i << ' ';
cout << '\n';
}
}
cout << "0 0 ";
for (int i = 2; i < n; i++) cout << i << ' ';
}
}
signed main (){
ios_base::sync_with_stdio (false);
cin.tie (NULL);
cout.tie (NULL);
if (fopen ("input.txt", "r")){
freopen ("input.txt", "r", stdin);
freopen ("output.txt", "w", stdout);
}
cin >> n >> m;
for (int i = 1, u, v; i <= m; i++){
cin >> u >> v; adj[u].push_back (v); adj[v].push_back (u); edges.push_back ({u, v});
}
if (star::check ()) star::solve ();
}
// love you, noodles0428 <333
Compilation message (stderr)
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
