이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/*#pragma GCC optimize("O3")
#pragma GCC target ("avx2")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")*/
#include <bits/stdc++.h>
//#define file(data) freopen(data".in", "r", stdin); freopen(data".out", "w", stdout);
#define pb push_back
#define all(data) data.begin(), data.end()
#define endl '\n'
using namespace std;
const int N = 2e4 + 5;
int t, n, m;
main() {
//file("pieaters");
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> t;
while(t--) {
cin >> n >> m;
if(max(n, m) % min(n, m) == 0) {
if(n > m){
cout << n - 1 << endl;
for(int i = 1; i < n; i++) {
cout << 1 << " ";
}
} else {
cout << m - 1 << endl;
for(int i = 1; i < m; i++) {
cout << -1 << " ";
}
}
cout << endl;
} else if(min(n, m) == 2 || 1){
cout << max(n, m) << endl;
vector < int > v;
if(n == 2) {
for(int i = 1; i <= m; i++) {
if(i % 2) cout << m - 1 << " ";
else cout << -m << " ";
}
} else {
for(int i = 1; i <= n; i++) {
if(i % 2 == 0) cout << n + 1 << " ";
else cout << -n << " ";
}
}
cout << endl;
}
}
}
컴파일 시 표준 에러 (stderr) 메시지
sequence.cpp:18:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
18 | main() {
| ^~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |