Submission #1085481

# Submission time Handle Problem Language Result Execution time Memory
1085481 2024-09-08T10:17:45 Z 8pete8 Nice sequence (IZhO18_sequence) C
15 / 100
7 ms 1372 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],val;
    if(n==1)val=0;
    else 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:29:11: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 |     int t;scanf("%lld",&t);
      |           ^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Ok
2 Correct 0 ms 348 KB Ok
3 Correct 0 ms 348 KB Ok
4 Correct 0 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 348 KB Ok
11 Correct 0 ms 396 KB Ok
12 Correct 0 ms 348 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Ok
2 Correct 0 ms 348 KB Ok
3 Correct 0 ms 348 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 6 ms 1372 KB Ok
8 Correct 3 ms 856 KB Ok
9 Correct 7 ms 1372 KB Ok
10 Correct 4 ms 1020 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Ok
2 Correct 0 ms 348 KB Ok
3 Correct 0 ms 348 KB Ok
4 Incorrect 0 ms 348 KB there is incorrect sequence
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Jury has the better answer : jans = 5, pans = 4
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Ok
2 Correct 0 ms 348 KB Ok
3 Correct 0 ms 348 KB Ok
4 Correct 0 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 348 KB Ok
11 Correct 0 ms 396 KB Ok
12 Correct 0 ms 348 KB Ok
13 Correct 0 ms 348 KB Ok
14 Correct 0 ms 348 KB Ok
15 Correct 0 ms 348 KB Ok
16 Incorrect 0 ms 348 KB there is incorrect sequence
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Ok
2 Correct 0 ms 348 KB Ok
3 Correct 0 ms 348 KB Ok
4 Correct 0 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 348 KB Ok
11 Correct 0 ms 396 KB Ok
12 Correct 0 ms 348 KB Ok
13 Correct 0 ms 348 KB Ok
14 Correct 0 ms 348 KB Ok
15 Correct 0 ms 348 KB Ok
16 Correct 0 ms 348 KB Ok
17 Correct 0 ms 348 KB Ok
18 Correct 1 ms 604 KB Ok
19 Correct 6 ms 1372 KB Ok
20 Correct 3 ms 856 KB Ok
21 Correct 7 ms 1372 KB Ok
22 Correct 4 ms 1020 KB Ok
23 Correct 0 ms 348 KB Ok
24 Correct 0 ms 348 KB Ok
25 Correct 0 ms 348 KB Ok
26 Incorrect 0 ms 348 KB there is incorrect sequence
27 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Ok
2 Correct 0 ms 348 KB Ok
3 Correct 0 ms 348 KB Ok
4 Correct 0 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 348 KB Ok
11 Correct 0 ms 396 KB Ok
12 Correct 0 ms 348 KB Ok
13 Correct 0 ms 348 KB Ok
14 Correct 0 ms 348 KB Ok
15 Correct 0 ms 348 KB Ok
16 Correct 0 ms 348 KB Ok
17 Correct 0 ms 348 KB Ok
18 Correct 1 ms 604 KB Ok
19 Correct 6 ms 1372 KB Ok
20 Correct 3 ms 856 KB Ok
21 Correct 7 ms 1372 KB Ok
22 Correct 4 ms 1020 KB Ok
23 Correct 0 ms 348 KB Ok
24 Correct 0 ms 348 KB Ok
25 Correct 0 ms 348 KB Ok
26 Incorrect 0 ms 348 KB there is incorrect sequence
27 Halted 0 ms 0 KB -