답안 #1085476

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1085476 2024-09-08T10:08:11 Z 8pete8 Nice sequence (IZhO18_sequence) C
9 / 100
7 ms 1440 KB
#include<stdio.h>
#include <stdlib.h>
#define int long long
int compare(const void* a, const void* b){
   return (*(int*)a - *(int*)b);
}
const int mx=1e9;
void solve(){
    int n,m;scanf("%lld %lld",&n,&m);
    int mul=1;
    if(n>m){
        n^=m;
        m^=n;
        n^=m;
        mul=-1;
    }
    int k=m+(m%n)-1;
    int ans[k];
    int val=(mx-1)/(n-1);
    printf("%lld\n",k);
    for(int i=0;i<k;i++){
        if((i%n)==(n-1))ans[i]=-mx;
        else ans[i]=val;
    }
    for(int i=0;i<k;i++)printf("%lld ",mul*ans[i]);
    printf("\n");
    
}
int32_t main(){
    int t;scanf("%lld",&t);
    while(t--)solve();
}
/*

+++-

3
3 1
2 3 
1 1

*/

Compilation message

sequence.c: In function 'solve':
sequence.c:9:13: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     int n,m;scanf("%lld %lld",&n,&m);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~
sequence.c: In function 'main':
sequence.c:30:11: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   30 |     int t;scanf("%lld",&t);
      |           ^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 8
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Ok
2 Correct 0 ms 348 KB Ok
3 Correct 1 ms 348 KB Ok
4 Correct 0 ms 420 KB Ok
5 Correct 0 ms 348 KB Ok
6 Correct 1 ms 604 KB Ok
7 Correct 6 ms 1292 KB Ok
8 Correct 3 ms 860 KB Ok
9 Correct 7 ms 1440 KB Ok
10 Correct 4 ms 860 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 8
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 424 KB Jury has the better answer : jans = 5, pans = 4
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 8
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 8
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 8
2 Halted 0 ms 0 KB -