#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
int t;
main(){
cin >> t;
while (t--){
int n, m;
bool s;
cin >> n >> m;
int x = (max (n, m) / min(n, m)) + 1;
if (n < m)
s = true;
else
s = false;
if (max(n, m) % min(n, m) == 0){
printf("%d\n", max(n, m) - 1);
for (int i = 0; i < max(n, m) - 1; i++){
if (s == true)
printf("-1 ");
else
printf("1 ");
}
}
else {
printf("%d\n", max(n, m));
for (int i = 0; i < max(n, m); i++){
if (i && (i + 1) % min(n, m) == 0){
if (s == true)
printf("%d ", -(x * (min (n, m) - 1) + 1));
else
printf("%d ", x * (min(n, m) - 1) + 1);
}
else {
if (s == true)
printf("%d ", x);
else
printf("%d ", -x);
}
}
}
printf("\n");
}
}
Compilation message
sequence.cpp:8:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
main(){
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Ok |
2 |
Correct |
2 ms |
384 KB |
Ok |
3 |
Correct |
2 ms |
592 KB |
Ok |
4 |
Correct |
2 ms |
632 KB |
Ok |
5 |
Correct |
2 ms |
632 KB |
Ok |
6 |
Correct |
2 ms |
632 KB |
Ok |
7 |
Correct |
2 ms |
632 KB |
Ok |
8 |
Correct |
2 ms |
632 KB |
Ok |
9 |
Correct |
2 ms |
632 KB |
Ok |
10 |
Correct |
2 ms |
632 KB |
Ok |
11 |
Correct |
2 ms |
632 KB |
Ok |
12 |
Correct |
2 ms |
652 KB |
Ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
652 KB |
Ok |
2 |
Correct |
2 ms |
652 KB |
Ok |
3 |
Correct |
2 ms |
652 KB |
Ok |
4 |
Correct |
2 ms |
652 KB |
Ok |
5 |
Correct |
2 ms |
668 KB |
Ok |
6 |
Correct |
3 ms |
688 KB |
Ok |
7 |
Correct |
8 ms |
948 KB |
Ok |
8 |
Correct |
5 ms |
948 KB |
Ok |
9 |
Correct |
9 ms |
1000 KB |
Ok |
10 |
Correct |
6 ms |
1000 KB |
Ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1000 KB |
Ok |
2 |
Correct |
2 ms |
1000 KB |
Ok |
3 |
Correct |
2 ms |
1000 KB |
Ok |
4 |
Incorrect |
2 ms |
1000 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 |
1000 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 |
376 KB |
Ok |
2 |
Correct |
2 ms |
384 KB |
Ok |
3 |
Correct |
2 ms |
592 KB |
Ok |
4 |
Correct |
2 ms |
632 KB |
Ok |
5 |
Correct |
2 ms |
632 KB |
Ok |
6 |
Correct |
2 ms |
632 KB |
Ok |
7 |
Correct |
2 ms |
632 KB |
Ok |
8 |
Correct |
2 ms |
632 KB |
Ok |
9 |
Correct |
2 ms |
632 KB |
Ok |
10 |
Correct |
2 ms |
632 KB |
Ok |
11 |
Correct |
2 ms |
632 KB |
Ok |
12 |
Correct |
2 ms |
652 KB |
Ok |
13 |
Correct |
2 ms |
1000 KB |
Ok |
14 |
Correct |
2 ms |
1000 KB |
Ok |
15 |
Correct |
2 ms |
1000 KB |
Ok |
16 |
Incorrect |
2 ms |
1000 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 |
376 KB |
Ok |
2 |
Correct |
2 ms |
384 KB |
Ok |
3 |
Correct |
2 ms |
592 KB |
Ok |
4 |
Correct |
2 ms |
632 KB |
Ok |
5 |
Correct |
2 ms |
632 KB |
Ok |
6 |
Correct |
2 ms |
632 KB |
Ok |
7 |
Correct |
2 ms |
632 KB |
Ok |
8 |
Correct |
2 ms |
632 KB |
Ok |
9 |
Correct |
2 ms |
632 KB |
Ok |
10 |
Correct |
2 ms |
632 KB |
Ok |
11 |
Correct |
2 ms |
632 KB |
Ok |
12 |
Correct |
2 ms |
652 KB |
Ok |
13 |
Correct |
2 ms |
652 KB |
Ok |
14 |
Correct |
2 ms |
652 KB |
Ok |
15 |
Correct |
2 ms |
652 KB |
Ok |
16 |
Correct |
2 ms |
652 KB |
Ok |
17 |
Correct |
2 ms |
668 KB |
Ok |
18 |
Correct |
3 ms |
688 KB |
Ok |
19 |
Correct |
8 ms |
948 KB |
Ok |
20 |
Correct |
5 ms |
948 KB |
Ok |
21 |
Correct |
9 ms |
1000 KB |
Ok |
22 |
Correct |
6 ms |
1000 KB |
Ok |
23 |
Correct |
2 ms |
1000 KB |
Ok |
24 |
Correct |
2 ms |
1000 KB |
Ok |
25 |
Correct |
2 ms |
1000 KB |
Ok |
26 |
Incorrect |
2 ms |
1000 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 |
376 KB |
Ok |
2 |
Correct |
2 ms |
384 KB |
Ok |
3 |
Correct |
2 ms |
592 KB |
Ok |
4 |
Correct |
2 ms |
632 KB |
Ok |
5 |
Correct |
2 ms |
632 KB |
Ok |
6 |
Correct |
2 ms |
632 KB |
Ok |
7 |
Correct |
2 ms |
632 KB |
Ok |
8 |
Correct |
2 ms |
632 KB |
Ok |
9 |
Correct |
2 ms |
632 KB |
Ok |
10 |
Correct |
2 ms |
632 KB |
Ok |
11 |
Correct |
2 ms |
632 KB |
Ok |
12 |
Correct |
2 ms |
652 KB |
Ok |
13 |
Correct |
2 ms |
652 KB |
Ok |
14 |
Correct |
2 ms |
652 KB |
Ok |
15 |
Correct |
2 ms |
652 KB |
Ok |
16 |
Correct |
2 ms |
652 KB |
Ok |
17 |
Correct |
2 ms |
668 KB |
Ok |
18 |
Correct |
3 ms |
688 KB |
Ok |
19 |
Correct |
8 ms |
948 KB |
Ok |
20 |
Correct |
5 ms |
948 KB |
Ok |
21 |
Correct |
9 ms |
1000 KB |
Ok |
22 |
Correct |
6 ms |
1000 KB |
Ok |
23 |
Correct |
2 ms |
1000 KB |
Ok |
24 |
Correct |
2 ms |
1000 KB |
Ok |
25 |
Correct |
2 ms |
1000 KB |
Ok |
26 |
Incorrect |
2 ms |
1000 KB |
Jury has the better answer : jans = 9, pans = 8 |
27 |
Halted |
0 ms |
0 KB |
- |