Submission #1151764

#TimeUsernameProblemLanguageResultExecution timeMemory
1151764AbdullahIshfaqMake them Meet (EGOI24_makethemmeet)C++20
34 / 100
1 ms328 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define MOD 998244353 void solve(){ ll n, m, u , v; cin >> n >> m; ll ch = 0; for(int i = 0; i < m; i++){ cin >> u >> v; ch += (u == 0 or v == 0); } if(m == n - 1 and ch == n - 1){ cout << 2 * n - 1 << '\n'; for(int i = 1; i < n ; i++){ for(int j = 0 ; j < n; j ++){ if(i == j){ cout << 0 << " "; } else{ cout << j << " "; } } cout << '\n'; for(int j = 0 ; j < n; j ++){ if(i == j){ cout << 0 << " "; } else{ cout << j << " "; } } cout << '\n'; } for(int i = 0; i < n; i++){ cout << 0 << " "; } } else{ cout << n << '\n'; for (int i = 0; i < n; i++){ for (int j = 0; j < n; j++){ cout << (j + (i % 2)) / 2 << ' '; } cout << '\n'; } } } int main() { ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); int tests = 1; // cin >> tests; for(int i = 1; i <= tests; i ++) solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...