# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
760568 | NK_ | Nice sequence (IZhO18_sequence) | C++17 | 6 ms | 980 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// Success consists of going from failure to failure without loss of enthusiasm
#include <bits/stdc++.h>
using namespace std;
#define nl '\n'
#define pb push_back
using ll = long long;
template<class T> using V = vector<T>;
const int MAX = 1e9;
void solve() {
int N, M; cin >> N >> M;
bool SWAP = 0; if (N < M) { swap(N, M); SWAP = 1; }
// WLOG N > M
V<int> A;
if (N % M == 0) {
int ans = N - 1;
A = V<int>(ans); for(auto& x : A) x = 1;
} else {
int ans = N; A = V<int>(ans);
int X = -(MAX - 1) / (M - 1);
int REM = (MAX - 1) % (M - 1);
// cout << REM << nl;
// cout << X << nl;
for(int i = 0; i < ans; i++) {
if (i % M == M - 1) A[i] = MAX;
else {
// cout << i % M << " " << REM << endl;
A[i] = ((i % M) < REM ? X - 1 : X);
}
}
}
// cout << SWAP << nl;
if (SWAP) for(auto& x : A) x = -x;
cout << size(A) << nl;
for(auto& x : A) cout << x << " ";
cout << nl;
ll SUM = accumulate(begin(A), end(A), 0LL);
// cout << SUM << nl;
}
int main() {
cin.tie(0)->sync_with_stdio(0);
int T; cin >> T;
while(T--) {
solve();
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |