#include <bits/stdc++.h>
#define sz(x) ((int)x.size())
#define PB push_back
using namespace std;
const int N = 200100;
const int PW = 20;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
int qq; cin >> qq;
for (; qq; qq--){
int n, m;
cin >> n >> m;
assert((max(n, m) % min(n, m)) == 0);
if (n == m){
cout << n - 1 << '\n';
for (int i = 1; i < n; i++)
cout << "1 ";
cout << '\n';
continue;
}
if (n > m){
cout << n - 1 << '\n';
for (int i = 0; i < n - 1; i++)
if (i % m == 0)
cout << -int(1e8) << " " ;
else cout << "1 ";
cout << '\n';
} else {
cout << m - 1 << '\n';
for (int i = 0; i < m - 1; i++)
if (i % n == 0)
cout << +int(1e8) << " " ;
else cout << "-1 ";
cout << '\n';
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
252 KB |
there is incorrect sequence |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
3 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
3 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
252 KB |
there is incorrect sequence |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
252 KB |
there is incorrect sequence |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
252 KB |
there is incorrect sequence |
2 |
Halted |
0 ms |
0 KB |
- |