Submission #1228909

#TimeUsernameProblemLanguageResultExecution timeMemory
1228909NomioMake them Meet (EGOI24_makethemmeet)C++20
34 / 100
2 ms328 KiB
#include<bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, m; cin >> n >> m; int A = 0; for(int i = 0; i < m; i++) { int a, b; cin >> a >> b; A += min(a, b); } if(A == 0) { cout << (n - 1) * 4 << '\n'; for(int k = 0; k < 2; k++) { for(int i = 1; i < n; i++) { cout << 0 << ' '; for(int j = 1; j < n; j++) { if(i == j) cout << 0 << ' '; else cout << 1 << ' '; } cout << '\n'; for(int j = 0; j < n; j++) { cout << 0 << ' '; } cout << '\n'; } } return 0; } cout << n * 2 << '\n'; for(int i = 1; i <= n * 2; i++) { if(i % 2 == 1) { cout << 0 << ' '; int color = 0; int j = 1; while(j + 2 <= n) { j += 2; color++; cout << color << ' ' << color << ' '; } if(n % 2 == 0) cout << color + 1; } else { int color = 0; int j = 0; while(j + 2 <= n) { j += 2; color++; cout << color << ' ' << color << ' '; } if(n % 2 == 1) cout << color + 1; } cout << '\n'; } return 0; }
#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...