Submission #1113452

#TimeUsernameProblemLanguageResultExecution timeMemory
1113452NonozeMake them Meet (EGOI24_makethemmeet)C++17
24 / 100
2 ms336 KiB
#include <bits/stdc++.h> using namespace std; #define sz(x) (int)x.size() #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define cmin(a, b) a=min(a, b) #define cmax(a, b) a=max(a, b) #define fi first #define se second #define pb push_back #define mp make_pair #define int long long void solve(); signed main() { ios::sync_with_stdio(0); cin.tie(0); solve(); return 0; } vector<vector<int>> vec; void print() { cout << sz(vec) << endl; for (auto &a: vec) { for (auto &u: a) cout << u << ' '; cout << endl; } cout << endl; } void add(vector<int> &a) { vec.pb(a); } int n, m; vector<int> a; void solve() { cin >> n >> m; a.clear(), a.resize(n, -1); for (int t=0; t<1; t++) { int cnt=0; for (int i=0; i+1<n; i+=2) { a[i]=a[i+1]=cnt++; } if (n%2) a[n-1]=cnt++; for (int i=0; i<n; i++) { add(a); int bk=a.back(); a.pop_back(); if (n%2==0) { if (a.back()==bk) bk=cnt; if (a[1]!=a[0]) a[0]=bk; } else { if (a[1]!=a[0]) bk=a[0]; } a.insert(a.begin(), bk); } } print(); }
#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...