Submission #1129332

#TimeUsernameProblemLanguageResultExecution timeMemory
1129332GrayNice sequence (IZhO18_sequence)C++20
6 / 100
0 ms328 KiB
#include <algorithm> #include <bits/stdc++.h> #include <cassert> using namespace std; #define ll long long #define ull unsigned long long #define ld long double #define ff first #define ss second #define ln "\n" #define mp make_pair const ll INF = 2e18; const ll MOD = 1e9+7; void solve(){ ll n, m; cin >> n >> m; ll mn=min(n, m), mx = max(n, m); cout << mx-1 << ln; vector<ll> res; for (ll i=0; i<mx/mn-1; i++){ for (ll j=0; j<mn-1; j++) res.push_back(1); res.push_back(-mn); } for (ll j=0; j<mn-1; j++) res.push_back(1); if (n!=mn){ for (auto &ch:res) ch=-ch; } for (auto ch:res) cout << ch << " "; cout << ln; } int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); auto start = chrono::high_resolution_clock::now(); ll t=1; cin >> t; while (t--) solve(); #ifdef LOCAL auto duration = chrono::duration_cast<chrono::microseconds>(chrono::high_resolution_clock::now() - start); cout << setprecision(0) << fixed << "time: " << (double)duration.count()/1000.0 << " milliseconds" << endl; #endif }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...