답안 #944266

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
944266 2024-03-12T13:20:47 Z dilanyan Nice sequence (IZhO18_sequence) C++17
6 / 100
1 ms 600 KB
//-------------dilanyan------------\\ 
 
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
 
//------------------KarginDefines--------------------\\ 
 
#define ll long long
#define pb push_back
#define all(u) (u).begin(), (u).end()
#define pqueue priority_queue
#define upper upper_bound
#define lower lower_bound
#define umap unordered_map
#define uset unordered_set
#define Kargin ios_base::sync_with_stdio(false);cin.tie(NULL);
#define Usaco freopen(".in", "r", stdin); freopen(".out", "w", stdout);
 
 
//-------------------KarginConstants------------------\\ 
 
const ll mod = 1000000007;
const ll inf = 1e18;
 
//-------------------KarginCode------------------------\\ 
 
const int N = 300005;

void KarginSolve() {
    int n, m;
    cin >> n >> m;
    if (max(n, m) % min(n, m) == 0) {
        cout << max(n, m) - 1 << '\n';
        for (int i = 1;i < max(n, m);i++) {
            if (n >= m) cout << i << ' ';
            else cout << -i << ' ';
        }
        cout << '\n';
    }
    else if (min(n, m) == 2) {
        cout << max(n, m) << '\n';
        for (int i = 1;i < max(n, m);i++) {
            if (n == 2) cout << -1 << ' ';
            else cout << 1 << ' ';
        }
        if (n == 2) cout << max(n, m) << '\n';
        else cout << -max(n, m) << '\n';
    }
}
 
int main() {
    //Usaco
    Kargin;
    int test = 1;
    cin >> test;
    while (test--) {
        KarginSolve();
    }
    return 0;
}

Compilation message

sequence.cpp:1:1: warning: multi-line comment [-Wcomment]
    1 | //-------------dilanyan------------\\
      | ^
sequence.cpp:8:1: warning: multi-line comment [-Wcomment]
    8 | //------------------KarginDefines--------------------\\
      | ^
sequence.cpp:22:1: warning: multi-line comment [-Wcomment]
   22 | //-------------------KarginConstants------------------\\
      | ^
sequence.cpp:27:1: warning: multi-line comment [-Wcomment]
   27 | //-------------------KarginCode------------------------\\
      | ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Ok
2 Correct 0 ms 348 KB Ok
3 Correct 1 ms 348 KB Ok
4 Correct 1 ms 348 KB Ok
5 Correct 0 ms 348 KB Ok
6 Correct 0 ms 348 KB Ok
7 Correct 0 ms 348 KB Ok
8 Correct 0 ms 348 KB Ok
9 Correct 0 ms 348 KB Ok
10 Correct 0 ms 344 KB Ok
11 Correct 1 ms 600 KB Ok
12 Correct 0 ms 348 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB there is incorrect sequence
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB there is incorrect sequence
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB there is incorrect sequence
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Ok
2 Correct 0 ms 348 KB Ok
3 Correct 1 ms 348 KB Ok
4 Correct 1 ms 348 KB Ok
5 Correct 0 ms 348 KB Ok
6 Correct 0 ms 348 KB Ok
7 Correct 0 ms 348 KB Ok
8 Correct 0 ms 348 KB Ok
9 Correct 0 ms 348 KB Ok
10 Correct 0 ms 344 KB Ok
11 Correct 1 ms 600 KB Ok
12 Correct 0 ms 348 KB Ok
13 Incorrect 0 ms 348 KB there is incorrect sequence
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Ok
2 Correct 0 ms 348 KB Ok
3 Correct 1 ms 348 KB Ok
4 Correct 1 ms 348 KB Ok
5 Correct 0 ms 348 KB Ok
6 Correct 0 ms 348 KB Ok
7 Correct 0 ms 348 KB Ok
8 Correct 0 ms 348 KB Ok
9 Correct 0 ms 348 KB Ok
10 Correct 0 ms 344 KB Ok
11 Correct 1 ms 600 KB Ok
12 Correct 0 ms 348 KB Ok
13 Incorrect 0 ms 348 KB there is incorrect sequence
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Ok
2 Correct 0 ms 348 KB Ok
3 Correct 1 ms 348 KB Ok
4 Correct 1 ms 348 KB Ok
5 Correct 0 ms 348 KB Ok
6 Correct 0 ms 348 KB Ok
7 Correct 0 ms 348 KB Ok
8 Correct 0 ms 348 KB Ok
9 Correct 0 ms 348 KB Ok
10 Correct 0 ms 344 KB Ok
11 Correct 1 ms 600 KB Ok
12 Correct 0 ms 348 KB Ok
13 Incorrect 0 ms 348 KB there is incorrect sequence
14 Halted 0 ms 0 KB -