답안 #1085474

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1085474 2024-09-08T10:05:57 Z 8pete8 Nice sequence (IZhO18_sequence) C
9 / 100
7 ms 1372 KB
#include<stdio.h>
#include <stdlib.h>
int v[1001];
int compare(const void* a, const void* b){
   return (*(int*)a - *(int*)b);
}
const int mx=1e9;
void solve(){
    int n,m;scanf("%d %d",&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("%d\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("%d ",mul*ans[i]);
    printf("\n");
    
}
int main(){
    int t;scanf("%d",&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("%d %d",&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("%d",&t);
      |           ^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 348 KB Execution killed with signal 8
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Ok
2 Correct 0 ms 344 KB Ok
3 Correct 0 ms 344 KB Ok
4 Correct 0 ms 348 KB Ok
5 Correct 0 ms 348 KB Ok
6 Correct 1 ms 604 KB Ok
7 Correct 7 ms 1368 KB Ok
8 Correct 3 ms 860 KB Ok
9 Correct 6 ms 1372 KB Ok
10 Correct 4 ms 920 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 512 KB Execution killed with signal 8
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Jury has the better answer : jans = 5, pans = 4
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 348 KB Execution killed with signal 8
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 348 KB Execution killed with signal 8
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 348 KB Execution killed with signal 8
2 Halted 0 ms 0 KB -