/*
Uruchamiamy samolot zwiadowczy ( + 500% do wzlamaniej )
/▄/ /█/ /◐/ /▐/ /▌/ /▀/ /░/ /🔥/ choose own style!
***IT'S OUR LONG WAY TO THE OIILLLL***
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░████████░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█████████░░░░░░░░░░░░░░░░░▌░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░◐◐◐█████████▀▀▀▀▀▀🔥░░░░░░░░███░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█████████░░░░░░░░░░░░░░░░░░░░▌░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█████████░░░░░░░░░░░░░░░░░░░░█▌░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▄▄▀██████████████████████████████████████████████████
░░░░░░░░░░░░░░░░░░░░░░░░░░▄▄▄████▄████████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ █████
░░░░░░░░░░░░░░░░░░░░░░░░░░░▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█████████▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█████████░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░◐◐◐█████████▀▀▀▀▀▀🔥░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█████████░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█████████░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░████████░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░███████░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██████░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█████░░░░░░░░░░░░░░░
*/
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
//#pragma comment(linker, "/stack:200000000")
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define ld long double
#define fi first
#define se second
#define eb emplace_back
#define pii pair < int , int >
#define pipii pair< int, pair < int , int > >
#define TIME clock() * 1.0 / CLOCKS_PER_SEC
mt19937 gen(chrono::high_resolution_clock::now().time_since_epoch().count());
#include <ext/pb_ds/detail/standard_policies.hpp>'
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;template <typename T> using ordered_set = tree <T, null_type, less< T >, rb_tree_tag,tree_order_statistics_node_update>;
namespace fastio {template <class T> ostream &operator<<(ostream &os, const vector<T> &container){for (auto &u : container)os << u << " ";return os;}template<class T1, class T2> ostream& operator << (ostream& os, const pair<T1, T2>& p) { return os << p.first << " " << p.second; }template <class T> ostream &operator<<(ostream &os, set<T> const& con) { for (auto &u : con) os << u << " "; return os; }void pr() {}template <typename T, typename... args> void pr(T x, args... tail) { cout << x << " "; pr(tail...);}}using namespace fastio;
const int N = 4e5 + 5;
const int MA = 1e6 + 1;
const int X[4] = {0, 0, 1, -1};
const int Y[4] = {-1, 1, 0, 0};
int main()
{
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#ifdef Estb_probitie
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
int t;
cin >> t;
while(t--)
{
int n, m;
cin >> n >> m;
if (n == m)
{
cout << n - 1 << '\n';
for (int i = 1; i < n; ++i)
cout<<"69 ";
cout<<'\n';
continue;
}
if (n == 1)
{
cout << m - 1 << '\n';
for (int i = 1; i < m; ++i)
cout << -1 << ' ';
cout << '\n';
continue;
}
if (m == 1)
{
cout << n - 1 << '\n';
for (int i = 1; i < n; ++i)
cout << 1 << ' ';
cout << '\n';
continue;
}
int err = 1;
if (n > m)
err = -1, swap(n, m);
vector < int > ans;
if (m % n == 0) --m;
int f = 1e8;
int s = -(f / (n - 1) + 1);
int now = 0;
while(ans.size() < m)
{
if (!now && n > 1)
ans.pb(f); else
ans.pb(s);
now++;
now %= n;
}
cout << ans.size() << '\n';
for (int i : ans)
cout << err * i << " ";
cout << '\n';
}
}
Compilation message
sequence.cpp:47:50: warning: missing terminating ' character
#include <ext/pb_ds/detail/standard_policies.hpp>'
^
sequence.cpp:47:50: warning: extra tokens at end of #include directive
sequence.cpp: In function 'int main()':
sequence.cpp:109:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
while(ans.size() < m)
~~~~~~~~~~~^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
504 KB |
Ok |
2 |
Correct |
3 ms |
348 KB |
Ok |
3 |
Correct |
5 ms |
376 KB |
Ok |
4 |
Correct |
2 ms |
376 KB |
Ok |
5 |
Correct |
2 ms |
376 KB |
Ok |
6 |
Correct |
2 ms |
376 KB |
Ok |
7 |
Correct |
2 ms |
376 KB |
Ok |
8 |
Correct |
2 ms |
376 KB |
Ok |
9 |
Correct |
3 ms |
376 KB |
Ok |
10 |
Correct |
2 ms |
376 KB |
Ok |
11 |
Correct |
2 ms |
376 KB |
Ok |
12 |
Correct |
2 ms |
376 KB |
Ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Ok |
2 |
Correct |
2 ms |
376 KB |
Ok |
3 |
Correct |
2 ms |
376 KB |
Ok |
4 |
Correct |
3 ms |
376 KB |
Ok |
5 |
Correct |
0 ms |
376 KB |
Ok |
6 |
Correct |
4 ms |
504 KB |
Ok |
7 |
Correct |
11 ms |
1272 KB |
Ok |
8 |
Correct |
7 ms |
760 KB |
Ok |
9 |
Correct |
13 ms |
1528 KB |
Ok |
10 |
Correct |
9 ms |
1016 KB |
Ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Ok |
2 |
Correct |
2 ms |
376 KB |
Ok |
3 |
Correct |
2 ms |
376 KB |
Ok |
4 |
Incorrect |
2 ms |
376 KB |
Jury has the better answer : jans = 9, pans = 8 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
456 KB |
Jury has the better answer : jans = 5, pans = 4 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
504 KB |
Ok |
2 |
Correct |
3 ms |
348 KB |
Ok |
3 |
Correct |
5 ms |
376 KB |
Ok |
4 |
Correct |
2 ms |
376 KB |
Ok |
5 |
Correct |
2 ms |
376 KB |
Ok |
6 |
Correct |
2 ms |
376 KB |
Ok |
7 |
Correct |
2 ms |
376 KB |
Ok |
8 |
Correct |
2 ms |
376 KB |
Ok |
9 |
Correct |
3 ms |
376 KB |
Ok |
10 |
Correct |
2 ms |
376 KB |
Ok |
11 |
Correct |
2 ms |
376 KB |
Ok |
12 |
Correct |
2 ms |
376 KB |
Ok |
13 |
Correct |
3 ms |
376 KB |
Ok |
14 |
Correct |
2 ms |
376 KB |
Ok |
15 |
Correct |
2 ms |
376 KB |
Ok |
16 |
Incorrect |
2 ms |
376 KB |
Jury has the better answer : jans = 9, pans = 8 |
17 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
504 KB |
Ok |
2 |
Correct |
3 ms |
348 KB |
Ok |
3 |
Correct |
5 ms |
376 KB |
Ok |
4 |
Correct |
2 ms |
376 KB |
Ok |
5 |
Correct |
2 ms |
376 KB |
Ok |
6 |
Correct |
2 ms |
376 KB |
Ok |
7 |
Correct |
2 ms |
376 KB |
Ok |
8 |
Correct |
2 ms |
376 KB |
Ok |
9 |
Correct |
3 ms |
376 KB |
Ok |
10 |
Correct |
2 ms |
376 KB |
Ok |
11 |
Correct |
2 ms |
376 KB |
Ok |
12 |
Correct |
2 ms |
376 KB |
Ok |
13 |
Correct |
2 ms |
376 KB |
Ok |
14 |
Correct |
2 ms |
376 KB |
Ok |
15 |
Correct |
2 ms |
376 KB |
Ok |
16 |
Correct |
3 ms |
376 KB |
Ok |
17 |
Correct |
0 ms |
376 KB |
Ok |
18 |
Correct |
4 ms |
504 KB |
Ok |
19 |
Correct |
11 ms |
1272 KB |
Ok |
20 |
Correct |
7 ms |
760 KB |
Ok |
21 |
Correct |
13 ms |
1528 KB |
Ok |
22 |
Correct |
9 ms |
1016 KB |
Ok |
23 |
Correct |
3 ms |
376 KB |
Ok |
24 |
Correct |
2 ms |
376 KB |
Ok |
25 |
Correct |
2 ms |
376 KB |
Ok |
26 |
Incorrect |
2 ms |
376 KB |
Jury has the better answer : jans = 9, pans = 8 |
27 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
504 KB |
Ok |
2 |
Correct |
3 ms |
348 KB |
Ok |
3 |
Correct |
5 ms |
376 KB |
Ok |
4 |
Correct |
2 ms |
376 KB |
Ok |
5 |
Correct |
2 ms |
376 KB |
Ok |
6 |
Correct |
2 ms |
376 KB |
Ok |
7 |
Correct |
2 ms |
376 KB |
Ok |
8 |
Correct |
2 ms |
376 KB |
Ok |
9 |
Correct |
3 ms |
376 KB |
Ok |
10 |
Correct |
2 ms |
376 KB |
Ok |
11 |
Correct |
2 ms |
376 KB |
Ok |
12 |
Correct |
2 ms |
376 KB |
Ok |
13 |
Correct |
2 ms |
376 KB |
Ok |
14 |
Correct |
2 ms |
376 KB |
Ok |
15 |
Correct |
2 ms |
376 KB |
Ok |
16 |
Correct |
3 ms |
376 KB |
Ok |
17 |
Correct |
0 ms |
376 KB |
Ok |
18 |
Correct |
4 ms |
504 KB |
Ok |
19 |
Correct |
11 ms |
1272 KB |
Ok |
20 |
Correct |
7 ms |
760 KB |
Ok |
21 |
Correct |
13 ms |
1528 KB |
Ok |
22 |
Correct |
9 ms |
1016 KB |
Ok |
23 |
Correct |
3 ms |
376 KB |
Ok |
24 |
Correct |
2 ms |
376 KB |
Ok |
25 |
Correct |
2 ms |
376 KB |
Ok |
26 |
Incorrect |
2 ms |
376 KB |
Jury has the better answer : jans = 9, pans = 8 |
27 |
Halted |
0 ms |
0 KB |
- |