Submission #1360570

#TimeUsernameProblemLanguageResultExecution timeMemory
1360570clue_Make them Meet (EGOI24_makethemmeet)C++20
0 / 100
3 ms344 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)

Main.cpp: In function 'int main()':
Main.cpp:63:25: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   63 |                 freopen ("input.txt", "r", stdin);
      |                 ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:64:25: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   64 |                 freopen ("output.txt", "w", stdout);
      |                 ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...