답안 #378953

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
378953 2021-03-17T07:55:33 Z daniel920712 Nice sequence (IZhO18_sequence) C++14
15 / 100
15 ms 992 KB
#include <iostream>
#include <stdio.h>
#include <stdlib.h>

using namespace std;
int big=1e9;
int main()
{
    int T,N,M,i;
    scanf("%d",&T);
    while(T--)
    {
        scanf("%d %d",&N,&M);
        if(max(N,M)%min(N,M)==0)
        {
            if(N>M)
            {
                printf("%d\n",N-1);
                for(i=0;i<N-1;i++) printf("1 ");
                printf("\n");
            }
            else
            {
                printf("%d\n",M-1);
                for(i=0;i<M-1;i++) printf("-1 ");
                printf("\n");
            }
        }
        else if(N==2)
        {
            if(M%2==0) M--;
            printf("%d\n",M);
            for(i=0;i<M;i++)
            {
                if(i%2==0) printf("%d ",big-1);
                else printf("%d ",0-big);
            }
            printf("\n");
        }
        else if(M==2)
        {
            if(N%2==0) N--;
            printf("%d\n",N);
            for(i=0;i<N;i++)
            {
                if(i%2==0) printf("%d ",0-big+1);
                else printf("%d ",big);
            }
            printf("\n");
        }

    }

    return 0;
}

Compilation message

sequence.cpp: In function 'int main()':
sequence.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   10 |     scanf("%d",&T);
      |     ~~~~~^~~~~~~~~
sequence.cpp:13:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   13 |         scanf("%d %d",&N,&M);
      |         ~~~~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Ok
2 Correct 1 ms 364 KB Ok
3 Correct 1 ms 364 KB Ok
4 Correct 1 ms 364 KB Ok
5 Correct 1 ms 364 KB Ok
6 Correct 1 ms 364 KB Ok
7 Correct 1 ms 364 KB Ok
8 Correct 1 ms 364 KB Ok
9 Correct 1 ms 364 KB Ok
10 Correct 1 ms 364 KB Ok
11 Correct 1 ms 364 KB Ok
12 Correct 1 ms 364 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 492 KB Ok
2 Correct 1 ms 492 KB Ok
3 Correct 1 ms 364 KB Ok
4 Correct 1 ms 364 KB Ok
5 Correct 1 ms 364 KB Ok
6 Correct 2 ms 492 KB Ok
7 Correct 9 ms 876 KB Ok
8 Correct 4 ms 628 KB Ok
9 Correct 15 ms 992 KB Ok
10 Correct 7 ms 876 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Ok
2 Correct 1 ms 364 KB Ok
3 Correct 1 ms 364 KB Ok
4 Incorrect 1 ms 364 KB Jury has the better answer : jans = 9, pans = 2
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Ok
2 Correct 1 ms 364 KB Ok
3 Correct 1 ms 364 KB Ok
4 Correct 1 ms 364 KB Ok
5 Correct 1 ms 364 KB Ok
6 Correct 1 ms 364 KB Ok
7 Correct 1 ms 364 KB Ok
8 Correct 1 ms 364 KB Ok
9 Correct 1 ms 364 KB Ok
10 Correct 1 ms 364 KB Ok
11 Correct 1 ms 364 KB Ok
12 Correct 1 ms 364 KB Ok
13 Correct 1 ms 364 KB Ok
14 Correct 1 ms 364 KB Ok
15 Correct 1 ms 364 KB Ok
16 Incorrect 1 ms 364 KB Jury has the better answer : jans = 9, pans = 2
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Ok
2 Correct 1 ms 364 KB Ok
3 Correct 1 ms 364 KB Ok
4 Correct 1 ms 364 KB Ok
5 Correct 1 ms 364 KB Ok
6 Correct 1 ms 364 KB Ok
7 Correct 1 ms 364 KB Ok
8 Correct 1 ms 364 KB Ok
9 Correct 1 ms 364 KB Ok
10 Correct 1 ms 364 KB Ok
11 Correct 1 ms 364 KB Ok
12 Correct 1 ms 364 KB Ok
13 Correct 1 ms 492 KB Ok
14 Correct 1 ms 492 KB Ok
15 Correct 1 ms 364 KB Ok
16 Correct 1 ms 364 KB Ok
17 Correct 1 ms 364 KB Ok
18 Correct 2 ms 492 KB Ok
19 Correct 9 ms 876 KB Ok
20 Correct 4 ms 628 KB Ok
21 Correct 15 ms 992 KB Ok
22 Correct 7 ms 876 KB Ok
23 Correct 1 ms 364 KB Ok
24 Correct 1 ms 364 KB Ok
25 Correct 1 ms 364 KB Ok
26 Incorrect 1 ms 364 KB Jury has the better answer : jans = 9, pans = 2
27 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Ok
2 Correct 1 ms 364 KB Ok
3 Correct 1 ms 364 KB Ok
4 Correct 1 ms 364 KB Ok
5 Correct 1 ms 364 KB Ok
6 Correct 1 ms 364 KB Ok
7 Correct 1 ms 364 KB Ok
8 Correct 1 ms 364 KB Ok
9 Correct 1 ms 364 KB Ok
10 Correct 1 ms 364 KB Ok
11 Correct 1 ms 364 KB Ok
12 Correct 1 ms 364 KB Ok
13 Correct 1 ms 492 KB Ok
14 Correct 1 ms 492 KB Ok
15 Correct 1 ms 364 KB Ok
16 Correct 1 ms 364 KB Ok
17 Correct 1 ms 364 KB Ok
18 Correct 2 ms 492 KB Ok
19 Correct 9 ms 876 KB Ok
20 Correct 4 ms 628 KB Ok
21 Correct 15 ms 992 KB Ok
22 Correct 7 ms 876 KB Ok
23 Correct 1 ms 364 KB Ok
24 Correct 1 ms 364 KB Ok
25 Correct 1 ms 364 KB Ok
26 Incorrect 1 ms 364 KB Jury has the better answer : jans = 9, pans = 2
27 Halted 0 ms 0 KB -