prob_desc_description
stringlengths
63
3.8k
prob_desc_output_spec
stringlengths
17
1.47k
lang_cluster
stringclasses
2 values
src_uid
stringlengths
32
32
code_uid
stringlengths
32
32
lang
stringclasses
7 values
prob_desc_output_to
stringclasses
3 values
prob_desc_memory_limit
stringclasses
19 values
file_name
stringclasses
111 values
tags
listlengths
0
11
prob_desc_created_at
stringlengths
10
10
prob_desc_sample_inputs
stringlengths
2
802
prob_desc_notes
stringlengths
4
3k
exec_outcome
stringclasses
1 value
difficulty
int64
-1
3.5k
prob_desc_input_from
stringclasses
3 values
prob_desc_time_limit
stringclasses
27 values
prob_desc_input_spec
stringlengths
28
2.42k
prob_desc_sample_outputs
stringlengths
2
796
source_code
stringlengths
42
65.5k
hidden_unit_tests
stringclasses
1 value
You are given two matrices $$$A$$$ and $$$B$$$. Each matrix contains exactly $$$n$$$ rows and $$$m$$$ columns. Each element of $$$A$$$ is either $$$0$$$ or $$$1$$$; each element of $$$B$$$ is initially $$$0$$$.You may perform some operations with matrix $$$B$$$. During each operation, you choose any submatrix of $$$B$$...
If it is impossible to make $$$B$$$ equal to $$$A$$$, print one integer $$$-1$$$. Otherwise, print any sequence of operations that transforms $$$B$$$ into $$$A$$$ in the following format: the first line should contain one integer $$$k$$$ — the number of operations, and then $$$k$$$ lines should follow, each line contai...
C
ad641a44ecaf78ca253b199f3d40ef96
e30caef57e11693c50187745a42232ce
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "constructive algorithms", "implementation", "greedy" ]
1566484500
["3 3\n1 1 1\n1 1 1\n0 1 1", "3 3\n1 0 1\n1 0 1\n0 0 0", "3 2\n0 0\n0 0\n0 0"]
NoteThe sequence of operations in the first example: $$$\begin{matrix} 0 & 0 & 0 & & 1 & 1 & 0 & & 1 & 1 & 1 & & 1 & 1 & 1 \\ 0 & 0 & 0 & \rightarrow & 1 & 1 & 0 & \rightarrow & 1 & 1 & 1 & \rightarrow & 1 & 1 &a...
PASSED
1,200
standard input
1 second
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 50$$$). Then $$$n$$$ lines follow, each containing $$$m$$$ integers. The $$$j$$$-th integer in the $$$i$$$-th line is $$$A_{i, j}$$$. Each integer is either $$$0$$$ or $$$1$$$.
["3\n1 1\n1 2\n2 2", "-1", "0"]
#include<stdio.h> int main() { int a[100][100], b[100][100], i, j, n, m, c=0, k[100001], l[100001], d=0; scanf("%d %d", &n, &m); for(i=1; i<=n; i++) { for(j=1; j<=m; j++) { scanf("%d", &a[i][j]); } } for(i=1; i<n; i++) { for(j=1; j<m; j++) ...
You are given two matrices $$$A$$$ and $$$B$$$. Each matrix contains exactly $$$n$$$ rows and $$$m$$$ columns. Each element of $$$A$$$ is either $$$0$$$ or $$$1$$$; each element of $$$B$$$ is initially $$$0$$$.You may perform some operations with matrix $$$B$$$. During each operation, you choose any submatrix of $$$B$$...
If it is impossible to make $$$B$$$ equal to $$$A$$$, print one integer $$$-1$$$. Otherwise, print any sequence of operations that transforms $$$B$$$ into $$$A$$$ in the following format: the first line should contain one integer $$$k$$$ — the number of operations, and then $$$k$$$ lines should follow, each line contai...
C
ad641a44ecaf78ca253b199f3d40ef96
b80fa895eff108ad44c71d119cf4acd4
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "constructive algorithms", "implementation", "greedy" ]
1566484500
["3 3\n1 1 1\n1 1 1\n0 1 1", "3 3\n1 0 1\n1 0 1\n0 0 0", "3 2\n0 0\n0 0\n0 0"]
NoteThe sequence of operations in the first example: $$$\begin{matrix} 0 &amp; 0 &amp; 0 &amp; &amp; 1 &amp; 1 &amp; 0 &amp; &amp; 1 &amp; 1 &amp; 1 &amp; &amp; 1 &amp; 1 &amp; 1 \\ 0 &amp; 0 &amp; 0 &amp; \rightarrow &amp; 1 &amp; 1 &amp; 0 &amp; \rightarrow &amp; 1 &amp; 1 &amp; 1 &amp; \rightarrow &amp; 1 &amp; 1 &a...
PASSED
1,200
standard input
1 second
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 50$$$). Then $$$n$$$ lines follow, each containing $$$m$$$ integers. The $$$j$$$-th integer in the $$$i$$$-th line is $$$A_{i, j}$$$. Each integer is either $$$0$$$ or $$$1$$$.
["3\n1 1\n1 2\n2 2", "-1", "0"]
#include<stdio.h> int main() { int a[100][100], b[100][100], i, j, n, m, c=0, k[100001], l[100001], d=0; scanf("%d %d", &n, &m); for(i=0; i<n; i++) { for(j=0; j<m; j++) { scanf("%d", &a[i][j]); } } for(i=0; i<n-1; i++) { for(j=0; j<m-1; j++) ...
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
410d1e49bafbf6064f43d98dbbc8556d
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#include <stdio.h> #include <stdio.h> #define N 300005 int main(int argc, char *argv[]) { char ch[N]; int n,i,a[N]={0},pref[N]={0},sum=0,l,r; scanf("%s",ch); scanf("%d",&n); for(i=0;i<strlen(ch)-1;i++) if(ch[i]==ch[i+1]){ a[i]++; } for(i=1;i<=strlen(ch);i++){ sum+=a[i-1]; pref[i]=sum; // p...
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
842e377179638cef84e32586d9068171
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#include<stdio.h> #include<string.h> int main() { char x[100001]; gets(x); int t,n=strlen(x),a,b,i,y[100001]={},sum=0; for(i=0;i<n-1;i++) { y[i+1]=sum; if(x[i]==x[i+1]) {y[i+1]++; sum=y[i+1]; }} scanf("%d",&t); while(t--) { int c=0; scanf("%d %d",&a...
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
770ec2471d5f9f6e339e4fdb8158be08
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#include<stdio.h> #include<string.h> int main(){ int n,m,i,c=0,ans=0,j,k; char str[100000]; gets(str); scanf("%d", &m); int x[m]; for(i=0;str[i];i++){ if(str[i]==str[i+1]){ c++; x[i]=c; } else x[i]=c; } /*for(i=0;i<strlen(str);i++) printf(...
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
e611684594e4514bb06880a18f2775b3
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#include<stdio.h> #include<string.h> int main() { char ch[100010]; long long int l, r, i, j, N[100011], q, ans, ct=0; scanf("%s", ch); long long int x=strlen(ch); scanf("%lld", &q); N[0]=0; for(i=1; i<x; i++) { if(ch[i]==ch[i-1]) ...
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
b636e885bbbe6fa406b195f3cf59b98e
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#include<stdio.h> #include<string.h> int dp[200000]; int main() { char arr[200001]; int m; int arr1[100001]; int arr2[100001]; scanf("%s",arr); scanf("%d",&m); for(int i=0;i<m;i++) { scanf("%d %d",&arr1[i],&arr2[i]); } int k=strlen(arr); // printf("%d",k); for(int i=0;i<k-1;i++) { if(i==0) { if...
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
8036c0aa57f7f82117d14b9722db2ece
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#include<stdio.h> #include <string.h> #include <math.h> int main(){ char str[100001]; int str2[100001]={0}; scanf("%s",str); int len=strlen(str),l,r; for(int i=0;i<strlen(str)-1;i++) { if(str[i]==str[i+1]) { str2[i+1]++; } } for(int i=1;i<len;i++) { ...
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
50b616225a69becf9603c0cba3d096f5
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#include<stdio.h> #include <string.h> #include <math.h> int main(){ char str[100001]; int str2[100001]={0}; scanf("%s",str); int l,r; for(int i=0;i<100001;i++) { if(str[i+1]=='\0') { break; } if(str[i]==str[i+1]) { str2[i+1]++; ...
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
70598dc37ac729e291aeb415cd4efaf1
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#include<stdio.h> #include <string.h> #include <math.h> int main(){ char str[100001]; int str2[100001]={0}; scanf("%s",str); int len=strlen(str),l,r; for(int i=0;i<strlen(str)-1;i++) { if(str[i]==str[i+1]) { str2[i+1]++; } } for(int i=1;i<len;i++) { ...
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
483cd3292c75ef05dc4cb4280342925c
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#include<string.h> #include<stdio.h> int main(){ int a[100002]={0},n,m,l,r,i,c=0; char s[100002]; gets(s); scanf("%d",&m); n=strlen(s); for(i=0;i<n-1;i++){ if(s[i]==s[i+1]) c++; a[i+1]=c; } for(i=0;i<m;i++){ scanf("%d ...
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
2351e65d0d30e97d50096c36ffeb09cc
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#include<string.h> #include<stdio.h> int main(){ int a[100002]={0},n,m,l,r,i,c=0; char s[100002]; gets(s); scanf("%d",&m); n=strlen(s); for(i=0;i<n-1;i++){ if(s[i]==s[i+1]) c++; a[i+1]=c; } for(i=0;i<m;i++){ scanf("%d%...
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
066dab08888873f654c2a927783cb964
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#include <stdio.h> int main() { char str[100005]; //Input the string with length n scanf("%s", &str); int dp[100005]; //memset(dp, 0, sizeof(int)*100005); dp[0] = 0; int i = 1; while (str[i] != 0) { if (str[i] == str[i-1]) dp[i] = dp[i-1]+1; else dp[i] = dp[i-1]; i++; } int m,l,r; scanf("%d", &m); ...
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
804e65f52085d18bb96b154c8d46ff17
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#include <stdio.h> #include <string.h> #define rep(i,a,b) for (long i=a; i<b; i++) void generate(char *s, int *arr, long length) { rep (i,0,length-1) { if (s[i]==s[i+1]) { arr[i]=1; } else { arr[i]=0; } } arr[length-1]=0; } void accumulate(int *arro, long *arr...
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
1ddb5574f06e94a906fd436e2f27a621
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#include <stdio.h> #include <string.h> int main() { int L, D, i, j, N, dp[100000] = {0}; char arr[100001]; scanf("%s", arr); for (i = 0; i < strlen(arr) - 1; i++){ if (i == 0 && arr[i] == arr[i + 1]) dp[0] = 1; else if (arr[i] == arr[i + 1]) dp[i] = dp[i - 1] + 1; ...
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
61eac8bf815eb29f0961db9684a7e0f8
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#include <stdio.h> #include <string.h> int main() { int L, D, i, j, N, dp[100000] = {0}; char arr[100001]; scanf("%s", arr); for (i = 0; i < strlen(arr) - 1; i++){ if (i == 0 && arr[i] == arr[i + 1]) dp[0] = 1; else if (arr[i] == arr[i + 1]) dp[i] = dp[i - 1] + 1; ...
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
c5f697826abce73720f60ee0f3da3e82
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#include <stdio.h> #include <string.h> int main() { int L, D, i, j, N, dp[100000] = {0}; char arr[100001]; scanf("%s", arr); for (i = 0; i < strlen(arr) - 1; i++){ if (i == 0 && arr[i] == arr[i + 1]) dp[0] = 1; else if (arr[i] == arr[i + 1]) dp[i] = dp[i - 1] + 1; ...
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
91f2ec1339878371635b9a2587f97617
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#include <stdio.h> #include <string.h> typedef long long LL; int main() { char a[100005]; char b[100005]; scanf("%s",a); int len=strlen(a); b[0]=8; for(LL i=0;i<len;i++) { b[i+1]=a[i]; } LL arr[len+1]; arr[1]=0; for(LL i=2;i<=len;i++) { arr[i]=arr[i-1]+(b[i]==b[i-1]); } LL t,left,right; scanf("%...
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
64e8fe35c795c2fc99909ac7f084ff9d
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#include<stdio.h> int main(){ char str[100001]; int DP[100000]; scanf("%s",str); int count=0,m; int a,b; for(int i=1;str[i]!='\0';i++){ if(str[i]==str[i-1]){ count++; } DP[i]=count; } scanf("%d",&m); while(m--){ scanf("%d%d",&a,&b); ...
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
f3859e143877491c2409074f99ecdd99
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#include<stdio.h> int main() { char s[100000]; scanf("%s",s); int k,j,m,a,b,d=0,c[100001]={0},n=0; scanf("%d",&m); while(s[n]!='\0') n++; for(k=0;k<=n;k++) { if(s[k-1]==s[k]) c[k]=++d; else c[k]=d; } for(j=0;j<m;j+...
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
4ba6cc3bdc9a2ce4b9dfea2718e2b0bc
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#include<stdio.h> #include<string.h> int main() { char str[2000001]; scanf("%s",str); int n=strlen(str); int count[100000]={0}; int i; int x=0; for(i=0;i<n-1;i++) { if(str[i]==str[i+1]) { count[i]=x+1; x++; } else { count[i]=x; } } long long int q; scanf("%lld",&q); while(q--) { int...
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
bfd0371a3a22a52e486dd9ccaf31f011
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
/* Bismillahir-Rahmanir-Rahim */ /* Solved By:- MD. Hasibul Hossain Rezvi CSE 14th Batch Comilla University */ #include<stdio.h> #include<math.h> #include<string.h> #define ll long long int #define db double #define py printf("YES\n") #define pn printf("NO\n") #define nl printf("\n"); int main() { in...
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
c38f7037b5e6a674ebb89c39e9013f76
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#include <stdio.h> #include <string.h> int main(){ int length,n,l,r,count=0; char s[100000]; gets(s); length=strlen(s); int arr[length-1]; for(int i=0;i<length-1;++i){ if(s[i]==s[i+1]) count++; arr[i]=count; } scanf("%d",&n); while(n--){ scanf("%d%d",...
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
1649637bad2e5a77db760d869799890a
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#pragma GCC optimize("O2") #include <stdio.h> #include <string.h> char data[100005]; int dp[100005]; int main() { scanf("%s", data+1); data[0] = ' '; int len = strlen(data); dp[0] = 0; int i; for(i = 1; i < len; i++) { if(data[i] == data[i+1]) dp[i] = dp[i-1] + 1; ...
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
689ac76af612b2c16fcbcfe2bed7d3c7
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#include <stdio.h> #include <string.h> char data[100005]; int dp[100005]; int main() { scanf("%s", data+1); data[0] = ' '; int len = strlen(data); dp[0] = 0; for(int i = 1; i < len; i++) { if(data[i] == data[i+1]) dp[i] = dp[i-1] + 1; else dp[i] = dp[i-1];...
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
30564b5144c15fbc2c38a065e2b90766
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#include <stdio.h> char data[100005]; int dp[100005]; int main() { scanf("%s", data+1); data[0] = ' '; // int len = strlen(data); dp[0] = 0; int i; for(i = 1; data[i]; i++) { if(data[i] == data[i+1]) dp[i] = dp[i-1] + 1; else dp[i] = dp[i-1]; } ...
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
ba6513a1fc5f1d9eba4d618dc4958324
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#include <stdio.h> char data[100005]; int dp[100005]; int main() { scanf("%s", data+1); data[0] = ' '; // int len = strlen(data); dp[0] = 0; int i; for(i = 1; data[i]; i++) { dp[i] = (data[i] == data[i+1]) ? dp[i-1]+1 : dp[i-1]; /* if(data[i] == data[i+1]) dp[i] = d...
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
70e02d7ba0660ba7c94c88189db30a12
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#include <stdio.h> char data[100005]; int dp[100005]; int main() { scanf("%s", data+1); data[0] = ' '; // int len = strlen(data); dp[0] = 0; int i; for(i = 1; data[i]; i++) { // dp[i] = (data[i] == data[i+1]) ? dp[i-1]+1 : dp[i-1]; dp[i] = dp[i-1] + (data[i] == data[i+1]); /* ...
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
d44c63d6a4e386ef2bd2a3603bc86aec
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#include <stdio.h> #include <string.h> #define MAX 100000 char string[MAX+1]; int ans[MAX+1]; int main(){ scanf("%s", string); int len = strlen(string); int count = 0; for (int i = 0 ; i < len-1; i++){ //loop: n times if (string[i] == string[i+1]){ count++; } ans[i] = count; //printf("array:%d cou...
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
cdc896f7993474219eb2f50ce8f89a6a
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#include <stdio.h> int main(){ int m,l,r,i=0,sum=0; int a[100001]; char s[100001],c; while((c=getchar())!='\n'){ i++; s[i]=c; if(i>=2) if(s[i]==s[i-1]) sum++; a[i]=sum; } scanf("%d",&m); while(m--){ scanf("%d%d",&l,&r); printf("%d\n",a[r]-a[l]); } }
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
b86abec944ab8ae1f36eeb0a8bef8e1b
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#include<stdio.h> #include<string.h> int main() { int m,i,p,len,sum[100005]={},cum[100005]; char c[100005]; scanf("%s",&c); getchar(); len=strlen(c); for(i=0;i<len-1;i++){ if(c[i]==c[i+1]) sum[i]=1; } cum[0]=sum[0]; for(i=1;i<len;i++){ cum[i]=cum[i-1]+sum[i]; ...
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
70a62b466d04880527aeabe232826ac9
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#include<stdio.h> int main() { int m,l,r,i,j,a2[100000]; char a[1000000]; gets(a); l=0; m=strlen(a); for(i=1; i<m; i++) { if(a[i-1]==a[i]) l=l+1; a2[i]=l; } a2[i]=l; scanf("%d",&m); for(i=0; i<m; i++) { scanf("%d%d",&l,&r); prin...
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
d79e26d3c7364808f8dab877095ad906
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#include<stdio.h> int main() { int c,m,l,r,i,j,a2[100000]; char a[1000000]; gets(a); scanf("%d",&m); c=0; int L=strlen(a); for(i=1;i<L;i++) { if(a[i-1]==a[i]) { c=c+1; a2[i]=c; } else a2[i]=c; } a2[i]=c; for(i=0;i<m;i++) { scanf("%d%d",&l,&r); c=a2[r-1]-a2[l-1]; printf("%d\n",c); } }
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
763ac8a4fee0a7d0b8be63ea11e40578
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#include<stdio.h> int main() { int c,m,l,r,i,j,a2[100000]; char a[1000000]; gets(a); scanf("%d",&m); c=0; int L=strlen(a); for(i=1;i<L;i++) { if(a[i-1]==a[i]) { c=c+1; a2[i]=c; } else a2[i]=c; } a2[i]=c; //for(i=1;i<L;i++) // printf("%d\n",a2[i]); for(i=0;i<m;i++) { scanf("%d%d",&l,&r); c=a2[r-1]-a2[l-1]; if...
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
5612b68610e2be22e86dac3d642b295d
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#include "stdio.h" #include "string.h" int main() { char str[100005]; scanf("%s",str); int len=strlen(str); int val[len-1]; for(int i=0;i<len-1;i++){ if(i==0){ val[i]=(int)(str[i]==str[i+1]); } else{ val[i]=val[i-1]+(int)(str[i]==str[i+1]); } } int n; scanf("%d",&n); for...
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
9903bb5902546cbbda43515166c0f2fb
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#include<stdio.h> #include<string.h> int main () { int m,n,l,r,i,count=0; char s[100000]; scanf("%s",s); int a[100000]={0}; //n is the length of the array of string n=strlen(s); scanf("%d",&m); for(i=0;i<n-1;i++) { if(s[i]==s[i+1]) count++; a[i+1]=count; //why i+1 } int res=0; for(i=1;i<=m;i++) { ...
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
59c91d299fadb27f97adaa0cf121c30b
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#include<stdio.h> #include<string.h> int main(){ int arr[100005]={0},a,b,i,n,m,sum; char str[100005]; scanf("%s",str); n=strlen(str); for(i=1;i<n;i++){ if(str[i-1]==str[i]){ arr[i]=arr[i-1]+1; }else{ arr[i]=arr[i-1]; } } scanf("%d",&m); ...
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
e586249d1bb7db7cb7c48dc3124b0af3
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#include<stdio.h> #include<string.h> int main() { char a[100005]; long len,l,r,i,m,b[100005],cnt=0; scanf("%s",a); scanf("%ld",&m); len=strlen(a); for(i=0;i<(len-1);i++) { if(a[i]==a[i+1]) cnt++; b[i+1]=cnt; } while(m--) { scanf("%ld%ld",&l,&r); printf("%ld\n",b[r-1]-b[l-1]); } return 0; }
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
3d33462e66a69ce13af6c5b9d7648327
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#include <stdio.h> #include <string.h> #define MX 100005 int main() { char s[MX]; scanf("%s", s); int n = strlen(s), ps[MX] = {0}, j = 2, q; for (int i = 0; i < n; ++i, ++j) { ps[j] = ps[j-1]; if (s[i] == s[i+1]) ps[j]++; } scanf("%d", &q); for (int i = 0; i < q; ++i) { int a, b; scanf("%d%d", &a, &b); ...
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
316b6fdcb70b5c8a8ffe1ff91d682893
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#include <stdio.h> #include <string.h> #define MX 100005 int main() { char s[MX]; gets(s); int n = strlen(s), ps[MX] = {0}, j = 2, q; for (int i = 0; i < n; ++i, ++j) { ps[j] = ps[j-1]; if (s[i] == s[i+1]) ps[j]++; } scanf("%d", &q); for (int i = 0; i < q; ++i) { int a, b; scanf("%d%d", &a, &b); printf...
Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string s = s1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li, ri (1 ≤ li &lt; ri ≤ n...
Print m integers — the answers to the queries in the order in which they are given in the input.
C
b30e09449309b999473e4be6643d68cd
6c8908ad5af69b37210efd99c10856e0
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1369927800
["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"]
null
PASSED
1,100
standard input
2 seconds
The first line contains string s of length n (2 ≤ n ≤ 105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1 ≤ m ≤ 105) — the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer...
["1\n1\n5\n4", "1\n1\n2\n2\n0"]
#include <stdio.h> #include <string.h> int main(void){ char s[100001]; int pos1,pos2, queries; int answers=0; int ans[100001]; scanf("%s", s); scanf("%d", &queries); int length = strlen(s); for(int j=0;j<length-1;j++){ if(s[j]==s[j+1]){ answers+=1; } ans[j+1]=answers; } for(i...
For the multiset of positive integers $$$s=\{s_1,s_2,\dots,s_k\}$$$, define the Greatest Common Divisor (GCD) and Least Common Multiple (LCM) of $$$s$$$ as follow: $$$\gcd(s)$$$ is the maximum positive integer $$$x$$$, such that all integers in $$$s$$$ are divisible on $$$x$$$. $$$\textrm{lcm}(s)$$$ is the minimum posi...
Print one integer: $$$\gcd(\{\textrm{lcm}(\{a_i,a_j\})\ |\ i&lt;j\})$$$.
C
3634a3367a1f05d1b3e8e4369e8427fb
80717517c41326818f3b1f3bd1fa5b06
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "math" ]
1589286900
["2\n1 1", "4\n10 24 40 80", "10\n540 648 810 648 720 540 594 864 972 648"]
NoteFor the first example, $$$t=\{\textrm{lcm}(\{1,1\})\}=\{1\}$$$, so $$$\gcd(t)=1$$$.For the second example, $$$t=\{120,40,80,120,240,80\}$$$, and it's not hard to see that $$$\gcd(t)=40$$$.
PASSED
1,600
standard input
3 seconds
The first line contains one integer $$$n\ (2\le n\le 100\,000)$$$. The second line contains $$$n$$$ integers, $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 200\,000$$$).
["1", "40", "54"]
#include<stdio.h> long long int prime(long long int n) { if (n < 2) return 0; long long int i; for (i = 2; i * i <= n; i++) if (n % i == 0) return i; return n; } int main() { int n; scanf("%d", &n); int i; long long int a[100005]; for (i = 0; i < n; i++) scanf("%lld", &a[i]); long long int ans = 1; ...
For the multiset of positive integers $$$s=\{s_1,s_2,\dots,s_k\}$$$, define the Greatest Common Divisor (GCD) and Least Common Multiple (LCM) of $$$s$$$ as follow: $$$\gcd(s)$$$ is the maximum positive integer $$$x$$$, such that all integers in $$$s$$$ are divisible on $$$x$$$. $$$\textrm{lcm}(s)$$$ is the minimum posi...
Print one integer: $$$\gcd(\{\textrm{lcm}(\{a_i,a_j\})\ |\ i&lt;j\})$$$.
C
3634a3367a1f05d1b3e8e4369e8427fb
7d0b021a3fc8050de228c0e1d5238a94
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "math" ]
1589286900
["2\n1 1", "4\n10 24 40 80", "10\n540 648 810 648 720 540 594 864 972 648"]
NoteFor the first example, $$$t=\{\textrm{lcm}(\{1,1\})\}=\{1\}$$$, so $$$\gcd(t)=1$$$.For the second example, $$$t=\{120,40,80,120,240,80\}$$$, and it's not hard to see that $$$\gcd(t)=40$$$.
PASSED
1,600
standard input
3 seconds
The first line contains one integer $$$n\ (2\le n\le 100\,000)$$$. The second line contains $$$n$$$ integers, $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 200\,000$$$).
["1", "40", "54"]
#include <stdio.h> #include <stdlib.h> long long int gcd(long long int a, long long int b) { if (b == 0) return a; return gcd(b, a % b); } int main() { long long int n; scanf("%lld", &n); long long int a[n]; long long int i; for ( i = 0; i < n; ++i ) { scanf("%lld", &a[i]); } long long i...
For the multiset of positive integers $$$s=\{s_1,s_2,\dots,s_k\}$$$, define the Greatest Common Divisor (GCD) and Least Common Multiple (LCM) of $$$s$$$ as follow: $$$\gcd(s)$$$ is the maximum positive integer $$$x$$$, such that all integers in $$$s$$$ are divisible on $$$x$$$. $$$\textrm{lcm}(s)$$$ is the minimum posi...
Print one integer: $$$\gcd(\{\textrm{lcm}(\{a_i,a_j\})\ |\ i&lt;j\})$$$.
C
3634a3367a1f05d1b3e8e4369e8427fb
52aa8be6ed1780eb90e81480b7cb686b
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "math" ]
1589286900
["2\n1 1", "4\n10 24 40 80", "10\n540 648 810 648 720 540 594 864 972 648"]
NoteFor the first example, $$$t=\{\textrm{lcm}(\{1,1\})\}=\{1\}$$$, so $$$\gcd(t)=1$$$.For the second example, $$$t=\{120,40,80,120,240,80\}$$$, and it's not hard to see that $$$\gcd(t)=40$$$.
PASSED
1,600
standard input
3 seconds
The first line contains one integer $$$n\ (2\le n\le 100\,000)$$$. The second line contains $$$n$$$ integers, $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 200\,000$$$).
["1", "40", "54"]
#include <stdio.h> typedef long long int ll; ll gcd(ll a,ll b){ return b==0?a:gcd(b,a%b); } ll lcm(ll a,ll b){ ll t=gcd(a,b); return ((a*b)/t); } int main() { ll n,count[200001],net,i; scanf("%lld",&n); ll a[n],hcf=1; for(int i=0;i<n;i++) scanf("%lld",&a[i]); for(int i=1;i<200001;i++...
For the multiset of positive integers $$$s=\{s_1,s_2,\dots,s_k\}$$$, define the Greatest Common Divisor (GCD) and Least Common Multiple (LCM) of $$$s$$$ as follow: $$$\gcd(s)$$$ is the maximum positive integer $$$x$$$, such that all integers in $$$s$$$ are divisible on $$$x$$$. $$$\textrm{lcm}(s)$$$ is the minimum posi...
Print one integer: $$$\gcd(\{\textrm{lcm}(\{a_i,a_j\})\ |\ i&lt;j\})$$$.
C
3634a3367a1f05d1b3e8e4369e8427fb
9462af841c938c97f657ed4201bb396d
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "math" ]
1589286900
["2\n1 1", "4\n10 24 40 80", "10\n540 648 810 648 720 540 594 864 972 648"]
NoteFor the first example, $$$t=\{\textrm{lcm}(\{1,1\})\}=\{1\}$$$, so $$$\gcd(t)=1$$$.For the second example, $$$t=\{120,40,80,120,240,80\}$$$, and it's not hard to see that $$$\gcd(t)=40$$$.
PASSED
1,600
standard input
3 seconds
The first line contains one integer $$$n\ (2\le n\le 100\,000)$$$. The second line contains $$$n$$$ integers, $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 200\,000$$$).
["1", "40", "54"]
#include <stdio.h> long long A[100001]; int C[200001]; long long LCM(long long a, long long b) { long long c; long long r = a * b; while (b) { c = a % b; a = b; b = c; } r /= a; return r; } int main() { int i; long long a; int t; int temp; int n; long long R; scanf("%d", &n); for (i = 1; i <= n; i+...
For the multiset of positive integers $$$s=\{s_1,s_2,\dots,s_k\}$$$, define the Greatest Common Divisor (GCD) and Least Common Multiple (LCM) of $$$s$$$ as follow: $$$\gcd(s)$$$ is the maximum positive integer $$$x$$$, such that all integers in $$$s$$$ are divisible on $$$x$$$. $$$\textrm{lcm}(s)$$$ is the minimum posi...
Print one integer: $$$\gcd(\{\textrm{lcm}(\{a_i,a_j\})\ |\ i&lt;j\})$$$.
C
3634a3367a1f05d1b3e8e4369e8427fb
8d1e3bd05ea6b64f35a39cc7aa8ac442
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "math" ]
1589286900
["2\n1 1", "4\n10 24 40 80", "10\n540 648 810 648 720 540 594 864 972 648"]
NoteFor the first example, $$$t=\{\textrm{lcm}(\{1,1\})\}=\{1\}$$$, so $$$\gcd(t)=1$$$.For the second example, $$$t=\{120,40,80,120,240,80\}$$$, and it's not hard to see that $$$\gcd(t)=40$$$.
PASSED
1,600
standard input
3 seconds
The first line contains one integer $$$n\ (2\le n\le 100\,000)$$$. The second line contains $$$n$$$ integers, $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 200\,000$$$).
["1", "40", "54"]
#include<stdio.h> #include<stdlib.h> #include<math.h> #include<string.h> #include<stdbool.h> #include<assert.h> typedef long long ll; typedef long double ld; #define rep(i,l,r)for(ll i=(l);i<(r);i++) #define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k)) #define rrep(i,l,r)for(ll i=(l);i>=(r);i--) #define INF (1LL<<60) #d...
For the multiset of positive integers $$$s=\{s_1,s_2,\dots,s_k\}$$$, define the Greatest Common Divisor (GCD) and Least Common Multiple (LCM) of $$$s$$$ as follow: $$$\gcd(s)$$$ is the maximum positive integer $$$x$$$, such that all integers in $$$s$$$ are divisible on $$$x$$$. $$$\textrm{lcm}(s)$$$ is the minimum posi...
Print one integer: $$$\gcd(\{\textrm{lcm}(\{a_i,a_j\})\ |\ i&lt;j\})$$$.
C
3634a3367a1f05d1b3e8e4369e8427fb
27d34659472e8fff7a0bb49b41b5ba5c
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "math" ]
1589286900
["2\n1 1", "4\n10 24 40 80", "10\n540 648 810 648 720 540 594 864 972 648"]
NoteFor the first example, $$$t=\{\textrm{lcm}(\{1,1\})\}=\{1\}$$$, so $$$\gcd(t)=1$$$.For the second example, $$$t=\{120,40,80,120,240,80\}$$$, and it's not hard to see that $$$\gcd(t)=40$$$.
PASSED
1,600
standard input
3 seconds
The first line contains one integer $$$n\ (2\le n\le 100\,000)$$$. The second line contains $$$n$$$ integers, $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 200\,000$$$).
["1", "40", "54"]
#include<stdio.h> long long gcd(long long x, long long y){ if(y==0) return x; else return gcd(y,x%y); } main(){ int n; scanf("%d",&n); int arr[n]; for(int i=0;i<n;i++) scanf("%d",&arr[i]); int pre[n]; int pos[n]; pre[0]=arr[0]; pos[n-1]=arr[n-1]; for(int i=1;i<n;i++){ pre[i]=gcd(arr[i],pre[i-1]); }...
For the multiset of positive integers $$$s=\{s_1,s_2,\dots,s_k\}$$$, define the Greatest Common Divisor (GCD) and Least Common Multiple (LCM) of $$$s$$$ as follow: $$$\gcd(s)$$$ is the maximum positive integer $$$x$$$, such that all integers in $$$s$$$ are divisible on $$$x$$$. $$$\textrm{lcm}(s)$$$ is the minimum posi...
Print one integer: $$$\gcd(\{\textrm{lcm}(\{a_i,a_j\})\ |\ i&lt;j\})$$$.
C
3634a3367a1f05d1b3e8e4369e8427fb
1fde001ae46a3dc183331520872d28a5
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "math" ]
1589286900
["2\n1 1", "4\n10 24 40 80", "10\n540 648 810 648 720 540 594 864 972 648"]
NoteFor the first example, $$$t=\{\textrm{lcm}(\{1,1\})\}=\{1\}$$$, so $$$\gcd(t)=1$$$.For the second example, $$$t=\{120,40,80,120,240,80\}$$$, and it's not hard to see that $$$\gcd(t)=40$$$.
PASSED
1,600
standard input
3 seconds
The first line contains one integer $$$n\ (2\le n\le 100\,000)$$$. The second line contains $$$n$$$ integers, $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 200\,000$$$).
["1", "40", "54"]
#include<stdio.h> long long gcd(long long a,long long b) { return b==0?a:gcd(b,a%b); } int main() { long long b[100010]; long long n,lcm=0,gcd1=0; long long a[100010]; scanf("%lld",&n); for(int i=0;i<n;i++) { scanf("%lld",&a[i]); } for(long long j=n-1;j>=0;j--) b[j]=g...
For the multiset of positive integers $$$s=\{s_1,s_2,\dots,s_k\}$$$, define the Greatest Common Divisor (GCD) and Least Common Multiple (LCM) of $$$s$$$ as follow: $$$\gcd(s)$$$ is the maximum positive integer $$$x$$$, such that all integers in $$$s$$$ are divisible on $$$x$$$. $$$\textrm{lcm}(s)$$$ is the minimum posi...
Print one integer: $$$\gcd(\{\textrm{lcm}(\{a_i,a_j\})\ |\ i&lt;j\})$$$.
C
3634a3367a1f05d1b3e8e4369e8427fb
1ab8973d495a7548d2f80ee71a52432c
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "math" ]
1589286900
["2\n1 1", "4\n10 24 40 80", "10\n540 648 810 648 720 540 594 864 972 648"]
NoteFor the first example, $$$t=\{\textrm{lcm}(\{1,1\})\}=\{1\}$$$, so $$$\gcd(t)=1$$$.For the second example, $$$t=\{120,40,80,120,240,80\}$$$, and it's not hard to see that $$$\gcd(t)=40$$$.
PASSED
1,600
standard input
3 seconds
The first line contains one integer $$$n\ (2\le n\le 100\,000)$$$. The second line contains $$$n$$$ integers, $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 200\,000$$$).
["1", "40", "54"]
#include <stdio.h> #include <stdbool.h> typedef long long int ll; int main() { int n; scanf("%d",&n); int arr[n+10]; int freq[200010]; for(int i = 1; i<=200000; i++) { freq[i] = 0; } for(int i = 1; i<=n; i++) { scanf("%d",&arr[i]); freq[arr[i]]++; } bool b[...
Anya and Kirill are doing a physics laboratory work. In one of the tasks they have to measure some value n times, and then compute the average value to lower the error.Kirill has already made his measurements, and has got the following integer values: x1, x2, ..., xn. It is important that the values are close to each o...
In the first line print the minimum possible number of equal measurements. In the second line print n integers y1, y2, ..., yn — the values Anya should write. You can print the integers in arbitrary order. Keep in mind that the minimum value among Anya's values should be not less that the minimum among Kirill's values,...
C
dbbea6784cafdd4244f56729996e9187
4041f3f8ad05563a4b75a5bb6057c762
GNU C
standard output
256 megabytes
train_000.jsonl
[ "implementation", "math" ]
1520177700
["6\n-1 1 1 0 0 -1", "3\n100 100 101", "7\n-10 -9 -10 -8 -10 -9 -9"]
NoteIn the first example Anya can write zeros as here measurements results. The average value is then equal to the average value of Kirill's values, and there are only two equal measurements.In the second example Anya should write two values 100 and one value 101 (in any order), because it is the only possibility to ma...
PASSED
1,700
standard input
1 second
The first line contains a single integer n (1 ≤ n ≤ 100 000) — the numeber of measurements made by Kirill. The second line contains a sequence of integers x1, x2, ..., xn ( - 100 000 ≤ xi ≤ 100 000) — the measurements made by Kirill. It is guaranteed that the difference between the maximum and minimum values among valu...
["2\n0 0 0 0 0 0", "3\n101 100 100", "5\n-10 -10 -9 -9 -9 -9 -9"]
#include <stdio.h> #define SIZE 100000 static int x[SIZE]; static inline int min(int a, int b) { if (a < b) return a; return b; } static inline int max(int a, int b) { if (a > b) return a; return b; } static inline int abs(int a) { if (a < 0) return -a; return a; } ...
Anya and Kirill are doing a physics laboratory work. In one of the tasks they have to measure some value n times, and then compute the average value to lower the error.Kirill has already made his measurements, and has got the following integer values: x1, x2, ..., xn. It is important that the values are close to each o...
In the first line print the minimum possible number of equal measurements. In the second line print n integers y1, y2, ..., yn — the values Anya should write. You can print the integers in arbitrary order. Keep in mind that the minimum value among Anya's values should be not less that the minimum among Kirill's values,...
C
dbbea6784cafdd4244f56729996e9187
9475fa31dcb2f3a03b102b317a15d999
GNU C
standard output
256 megabytes
train_000.jsonl
[ "implementation", "math" ]
1520177700
["6\n-1 1 1 0 0 -1", "3\n100 100 101", "7\n-10 -9 -10 -8 -10 -9 -9"]
NoteIn the first example Anya can write zeros as here measurements results. The average value is then equal to the average value of Kirill's values, and there are only two equal measurements.In the second example Anya should write two values 100 and one value 101 (in any order), because it is the only possibility to ma...
PASSED
1,700
standard input
1 second
The first line contains a single integer n (1 ≤ n ≤ 100 000) — the numeber of measurements made by Kirill. The second line contains a sequence of integers x1, x2, ..., xn ( - 100 000 ≤ xi ≤ 100 000) — the measurements made by Kirill. It is guaranteed that the difference between the maximum and minimum values among valu...
["2\n0 0 0 0 0 0", "3\n101 100 100", "5\n-10 -10 -9 -9 -9 -9 -9"]
#include <stdio.h> #include <stdlib.h> int main() { int n; int *x; int min,mid,max; int nummin,nummid,nummax; int i; min = 200000; max = -200000; scanf("%d",&n); x = (int *)malloc(sizeof(int)*n); for (i=0;i<n;i++) scanf("%d",x+i); for (i=0;i<n;i++) { if (x[i]>max) max = x[i]; if (x[i]<min) min = x...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
b308b4053f209eff9e2fd4210297fa01
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> int isprime(long long p) { int i; double max=sqrt(p); for(i=2;i<=max;i++) if(p%i==0)break; if(i>max && p!=1)return 1; return 0; } long long gcd(long long a,long long b) { long long i; for(i=a<b?a:b;i>0;i--) if((a%i==0...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
ca22805e338553ffd26e60ca8c0a2d59
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include <stdio.h> #include <limits.h> int min(int a,int b) { if(a<=b) return a; else return b; } int main(void) { int t,sum; scanf("%d",&t); while(t--) { int n,x,y; scanf("%d %d %d",&n,&x,&y); if(n==2) { printf("%d %d\n"...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
638e6c660e3dcca80e920849f50cc185
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include <stdio.h> #include <stdlib.h> #include <limits.h> int main(){ int t; scanf("%d",&t); for(int i = 0;i < t;i++){ int n,x,y; scanf("%d %d %d",&n,&x,&y); int *ans = (int *)malloc(sizeof(int)*n); ans[n-1] = 2000000000; for(int i = 0;i < n;i++){ for(in...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
02714c3a4c6f6e1aacfbe82a5c9b8ddb
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include <stdlib.h> #include <stdio.h> #include <math.h> int main(){ int cases; scanf("%d", &cases); for(int i = 0; i < cases; i++){ int length, one, two; scanf("%d %d %d\n", &length, &one, &two); int temp = two; int gap = two - one; int distance = (int) ceil((double...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
f2d7577f6316e8fb0cdaab08e1c8ed92
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include <stdio.h> int main() { int t,i; scanf("%d",&t); for(i=0;i<t;i++) { int n,x,y,j,k,l,d,o,u; scanf("%d %d %d",&n,&x,&y); for(j=n-1;j>0;j--) { if((y-x)%j==0) break; } u=y; d=(y-x)/j; for(k=0;k<n;k++,y=y-d) { if(y>0) printf("%d ",y); ...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
b69640332ba43c7349beec1c3a71df01
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include <stdio.h> int main(int argc, char *argv[]) { int tc; scanf("%d",&tc); while(tc--){ int n,x,y; scanf("%d%d%d",&n,&x,&y); int a[3000]={0},c=0; int d,i,j,ans,st; d=y-x; for(i=1;i<=d;i++){ if(d%i==0){ ans=(d/i)-1; if(ans>(n-2)) continue; else break; } } st=y-(n-1)*i; w...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
025166ec531a08802e98096edb8245ee
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include<stdio.h> int main() { long long int N,T,U,M,i,j,V,k,x,m,y,n; scanf("%lld", &T); for(i=1; i<=T; i++) { scanf("%lld %lld %lld", &N, &U, &V); long long int A[N]; x=V-U; if(x%(N-1)==0) { y=x/(N-1); for(j=0; j<N; j++) {...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
6bac318f610837adedf971341990f047
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#pragma region kyopuro_templates #pragma GCC optimize("Ofast") #include<stdio.h> #include<stdlib.h> #include<math.h> #include<string.h> #include<stdbool.h> #include<assert.h> #include<time.h> #include<ctype.h> typedef long long ll; typedef long double ld; #define rep(i,l,r)for(ll i=(l);i<(r);i++) #define repp(i,l,r,k)f...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
23737a71305ea57d6ecdc82e2c41cafb
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include<stdio.h> int main() { long long int N,T,U,M,i,j,V,k,x,m,y,n; scanf("%lld", &T); for(i=1; i<=T; i++) { scanf("%lld %lld %lld", &N, &U, &V); long long int A[N]; x=V-U; if(x%(N-1)==0) { y=x/(N-1); for(j=0; j<N; j++) {...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
bd03bb760887e6d041b51f8f66ec69b7
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
//set many funcs template //Ver.20190820 #include<stdio.h> #include<string.h> #include<stdlib.h> #include<stdbool.h> #include<time.h> #include<assert.h> #define inf 1072114514 #define llinf 4154118101919364364 #define mod 1000000007 #define pi 3.1415926535897932384 int max(int a,int b){if(a>b){return a;}return b;} int...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
bec9e5330baaa3a2388394fab30f7f6a
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include<stdio.h> int t,n,x,y,ar[55]; int main() { scanf("%d",&t); while(t--) { int m=0,d; scanf("%d%d%d",&n,&x,&y); m=n; if(n==2) printf("%d %d\n",x,y); else { int i; for( i=m-1;i>=2;i--) if((y-x)%i==0) { d=(y-x)/i; break; } if(i<2) d=y-x;//等差数列公差 int k=y/d; ...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
993dfd60ad3a966eeb055af4aa76ac46
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
/****************************************************************************** Welcome to GDB Online. GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl, C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog. Code, Compile, Run and Debu...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
b086f811845d4fb3a4be34ce0bf124c2
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
j;main(n,x,y,d,i){for(scanf("%*d");~scanf("%d%d%d",&n,&x,&y);j=0){d=y-x; for(i=d/n;d%++i;);x%=i;x=x?x:i;y-=n*i-i;for(;j<n;j++)printf("%d ",(x>y?x:y)+i*j);}}
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
e1f9d715119be901164ee9e632c27491
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include <stdio.h> int a[55]; int main(){ int t,n,x,y,d,m,i,start,b,cnt,z; scanf("%d",&t); while(t--){ scanf("%d%d%d",&n,&x,&y); d=y-x; for(i=1;i<=d;i++)//寻找排序后,相邻两元素间距 if(d%i==0&&d/i-1+2<=n)break;//详见样例模拟 cnt=0; z=y; a[++cnt]=z; while(cnt<n){//向下拓展,比y小 if(z-i<=0)break; z-=i; a[++cnt]=z; ...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
de4ba60bbed9444e4ad13833d97ed276
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<math.h> void solve(int N, int X, int Y, int* s, int* d) { int dist = Y - X; int tmp_s; int tmp_d; int min = 2147483647; int i; for(i=1;i<=N-1;i++) { if( dist % i == 0 ) { tmp_d = dist / i; tmp_s = Y - (tmp_d*(N-1)); while(...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
f5ada7c4cbe3aa98138fd2dafc5876e1
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include<stdio.h> int main() { // freopen("/home/shadhin/Desktop/code/IO/input.txt", "r", stdin); // freopen("/home/shadhin/Desktop/code/IO/output.txt", "w", stdout); int x, y, n, i, j, dif, value, res[55], output[55], difout, xin, t; scanf("%d", &t); while(t--) { scanf("%d %d %d", &n, &x, &y); for(i=0;i<...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
8971171a0cefb92e75f1666336428077
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include <stdio.h> int main() { int t; scanf("%d", &t); for(int k=0; k<t; ++k) { int x, y, n; scanf("%d %d %d", &n, &x, &y); int ans[n]; if(n==2) { ans[0]=x; ans[1]=y; } else { int temp, temp2; ...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
feb04a6a5fa9617b722c759d6bddc771
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include <stdio.h> int main() { int t,i; scanf("%d",&t); for(i=0;i<t;i++) { int n,x,y,j,k,l,d,o,u; scanf("%d %d %d",&n,&x,&y); for(j=n-1;j>0;j--) { if((y-x)%j==0) break; } u=y; d=(y-x)/j; for(k=0;k<n;k++,y=y-d) { if(y>0) printf("%d ",y); ...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
4f18511b138909865f4204082e7252b3
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include <stdio.h> int main(void){ int T; long long i, j, n, x, y, tmp, cnt, flag; scanf("%d", &T); while(T--){ scanf("%lld %lld %lld", &n, &x, &y); if(n==2){ printf("%lld %lld\n", x, y); } else{ flag=0; for(i=1; i<=50; ++i){ if(x%i==y%i){ tmp=i; for(j=1; j<n; ++j){ ...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
1613ce6f8bf07b5c8e491c58d0accb84
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include<stdio.h> #include<stdlib.h> #include<math.h> int main() { int x,y,a,b,i,j,m,n,t,ans,det,det2; scanf("%d", &t); while(t--){ scanf("%d%d%d", &n,&x,&y); m=n; int sub,cnt=0; det2=x; det=y-x; n--; while(n>=1){ if(det%n==0){ ...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
f8cd9c30fbf4dd614997c997f70c6680
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<math.h> #include<limits.h> int Func(int j,int n) { int i; for(i=1;i<=50;i++) { if(j%i==0) { if(j/i<=n-1) { return i; } } } } int Func2(int y,int i,int n) { if(y/i>=n-1) { if(y-(n-1)*i==0) { return i; } return y-(n-1)*i;...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
49c0899ce2588eba385115dccc1fd81f
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include <stdio.h> int main() { int t; scanf("%d", &t); while(t--) { int n, x, y, temp; scanf("%d %d %d", &n, &x, &y); if(n == 2) { printf("%d %d\n", x, y); } else { int r = y - x; int temp = 0, id, j; for(int i = 2; i <= n - 1; i++)...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
0852b105882588c87ec76725e178ad40
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include<stdio.h> void main() { int t; scanf("%i",&t); while(t--) { int n,x,y; scanf("%i %i %i",&n,&x,&y); if(n==2) printf("%i %i\n",x,y); else { int index=0; long long int a[n]; int cn=n-1,cx=x,cy=y; while(cn>1) { if((y-x)%cn==0) break; cn--; } ...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
b7b0aff35f4e00f5fff14246d5419a73
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include <stdio.h> int main(int argc, char *argv[]) { int tc; scanf("%d",&tc); while(tc--){ int n,x,y; scanf("%d%d%d",&n,&x,&y); int a[3000]={0},c=0; int d,i,j,ans,st; d=y-x; for(i=1;i<=d;i++){ if(d%i==0){ ans=(d/i)-1; if(ans>(n-2)) continue; else break; } } st=y-(n-1)*i; wh...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
6e7f684e16edb74f796aaa043b6f5690
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include<stdio.h> int main(){ int t; scanf("%d",&t); while(t--){ int i,n,x,y; scanf("%d%d%d",&n,&x,&y); int m,cha,z=1,a[51]; for(i=0;i<51;i++)a[i]=0; m=y; cha=y-x; for(i=1;i<=cha;i++){ if(cha%i==0&&cha/i+1<=n)break; } a[1]=y; while(z+1<=n){ m-=i; if(m<=0)break; a[++z]=m; } m=y; ...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
dc942ffa7e6bd62bd0118ad989f73e00
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include <stdio.h> typedef long long ll; void swap(ll *a, ll *b) { ll temp = *a; *a = *b; *b = temp; } /*void quicksort(int arr[], int l, int r) { if (l >= r) { return; } int pivot = arr[r]; int cnt = l; for (int i = l; i <= r; i++) { if (arr[i] <= pivot) ...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
c464e2389ecdc386736f7af5fde15c48
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include<stdio.h> int main(){long int t,i,n,x,y,j,c,k,h,y1; scanf("%ld",&t); for(i=0;i<t;i++) { scanf("%ld%ld%ld",&n,&x,&y); c=0; for(j=n-1;j>=1;j--) { if((y-x)%j==0) { c++; break; } } if(c==0...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
e8cef4b21fbdecf50023babe3b650967
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <limits.h> int main() { int t; scanf("%d", &t); for (int tt = 0; tt < t; ++tt) { int n, x, y; scanf("%d %d %d", &n, &x, &y); int sorozat[50] = {0}; int legnagyobb = INT_MAX; for (int elso_szam = 1; ...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
ccb6af4c72ed60ddac10db84ff4523e2
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include<stdio.h> #include<stdlib.h> #include<math.h> #define min(a,b) a>b?:b,a int main(){ int t; scanf("%d",&t); int a[50]; while(t--){ int x,y,n,o,a,d; scanf("%d %d %d",&n,&x,&y); for(int i=n-2;i>=0;i--){ int o=y-x; if(o==o/(i+1)*(i+1)){ d=o/(i+1); for(int j=n-2-i;j>=0;j--) if(x-j*d>0){ ...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
e114bcbff2379dd46adcbbc24a209e85
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include<stdio.h> main() { int t; scanf("%d",&t); while(t--) { int a,b,c,d,e,n,x,y; scanf("%d%d%d",&n,&x,&y); for(b=1 ; ; b++) for (a= 1; a<n ; a++) { if((y-x)==(a*b)) goto ok; } ok:for(c=0 ; c<n ; c++) { printf("%d ",b*c+x)...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
55e1693a26825b13c5e7b0b3378d2d11
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include<stdio.h> int main(){ int t,x,y,n,a[50],check,i,i2,i3,i4; scanf("%d",&t); for (i=0;i<t;i++){ check=0; scanf("%d %d %d",&n,&x,&y); a[0]=y; for (i2=1;i2<=(y-x);i2++){ for (i3=1;i3<n;i3++){ a[i3]=y-i3*i2; if (a[i3]==x) check=1; if (a[i3]<=0) break; ...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
0292446813d93d75fe45949b67a96956
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include <stdio.h> int main() { long long int t, n, x, y, ans; scanf("%lld", &t); while (t--) { scanf("%lld %lld %lld", &n, &x, &y); int d = y - x; int diff; for (int i = 1; i <= d; i++) { if (d%i == 0) { diff = i; if (y - (n - 1)*i <= x) { break; } } } int start = y ...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
1fe20382dfa7c022268f550ca2289433
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include <stdio.h> void makemas(int n, int x, int y) { int i; int diff; int mn; i = 1; diff = y - x; mn = (diff > n - 1) ? n - 1 : diff; while (diff % mn != 0) mn--; mn = diff / mn; while (y - mn > 0 && i++ < n) y -= mn; while (n > 0) { printf("%d...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
4df0cf0664bf7f4150658bedfa116f0f
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include<stdio.h> #include<math.h> #include<stdlib.h> int main(void) { int t; scanf("%d",&t); for(int i=0;i<t;i++) { int n,x,y,d,sf,p,cv,c,sv,s; scanf("%d%d%d",&n,&x,&y); d=y-x; int a[n]; if(n==2) { a[0]=x; a[1]=y; } else{ for(int j=1;j<=d;j++) ...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
bd86340a3556d091fdd95d5f6a647c96
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include<stdio.h> int main(){ int t; scanf("%d",&t); while(t--){ int n,x,y,diff,i,k,minimum_index; scanf("%d %d %d",&n,&x,&y); diff=y-x; for( i=n-1 ; diff%i ; i--) ; if(y-(n-1)*(diff/i)>0) { for(int j=0;j<n;j++){ printf("%d",y-j*(diff/i)); if(j==n-1...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
716a12a57062e40b3faab7ac2a356fd8
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include <stdio.h> int main() { int t = 0; scanf("%d", &t); while (t-->0) { int n, x, y = 0; scanf("%d %d %d", &n, &x, &y); int d = 0; int k = n - 1; while (1) { if (y - x < k) --k; else if ((y - x) % k != 0) ...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
bdfc1fd36d0b4b1cc64e0e8203c35695
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include<stdio.h> #include<math.h> #include<string.h> int main() { long long int t,n,cnt=0,i,x,y,ts,df,j,m,k,r; scanf("%lld",&t); for(ts=0;ts<t;ts++) { scanf("%lld %lld %lld",&n,&x,&y); df=y-x; m=x; r=y; for(i=1;i<n;i++) { if(df%(n-i)==0) ...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
c0370a859fc7d15edf1384b2b7eb37c9
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include <stdio.h> int main() { int t, n, x, y; scanf("%d", &t); for(int j=0;j<t;j++) { scanf("%d %d %d", &n, &x, &y); int d = y - x; int diff; for (int i = 1; i <= d; i++) { if (d%i == 0) { diff = i; if (y - (n - 1)*i <= x) break; } } int start = y - (n - 1)*diff; while (start <=...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
b2d4ac43650ac64a6b48063d98d504cb
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include<stdio.h> int main() { int t; scanf("%d",&t); while(t--) { int n,x,y,f=0,g=0,cnt=0,a,b; scanf("%d%d%d",&n,&x,&y); for(int i=1;i<=y&&g==0;i++) { f=0; g=0; for(int j=1;j<=x&&g==0;j++) { f=0; g=0; cnt=n; int sum=j; while(cnt--) { if(sum==...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
6d7c2a26294b640756373e43cd91a456
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include <stdio.h> int main() { int t,n,x,y,i,g,left,noe,j; scanf("%d",&t); while(t) { scanf("%d %d %d",&n,&x,&y); g=y-x; noe=0; for(i=1;i<=g;i++) { if(g%i==0) { noe=g/i-1; if(noe+2<=n) break;...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
47d12c103fbad2d21521a3ecbaffb6e0
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include <stdio.h> #include <stdlib.h> typedef long long ll; #define rep(i,n) for(int i=0;i<(int)(n);i++) #define min(l,r) ((l)<(r)?l:r) #define max(l,r) ((l)>(r)?l:r) #define swap(l,r) {ll tp=l;l=r;r=tp;} int upcmpll(const void *a, const void *b){return(*(ll*)a==*(ll*)b?0:(*(ll*)a>*(ll*)b?1:-1));} void sort_u(ll*a, l...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
103f3cf471228d62047ee677b4ea93ef
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include <stdio.h> #define ll long long int main() { int t; scanf("%d", &t); while (t--) { int n, x, y; scanf("%d%d%d", &n, &x, &y); int jiange = 1; int zhongjiangeshu = y - x - 1; while (1) { if ((zhongjiangeshu + 1) % jiange == 0) ...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
107f9081dcf5a74931b68866d408975e
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include<stdio.h> #include<math.h> #include<string.h> int main() { long long int t,n,cnt=0,i,x,y,ts,df,j,m,k,r; scanf("%lld",&t); for(ts=0;ts<t;ts++) { scanf("%lld %lld %lld",&n,&x,&y); df=y-x; m=x; r=y; for(i=1;i<n;i++) { if(df%(n-i)==0) ...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
ff2d12891fd12d39a1d811cc65f55411
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include <stdio.h> int main(int argc, char const *argv[]) { int test; scanf("%d", &test); for (int i = 0; i < test; i++) { int n, x, y, d; scanf("%d %d %d", &n, &x, &y); int ans = (y - x); for (int i = (n - 1); i >= 1; i--) { if (!(ans % i)) ...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
e283d74d41a72876922bc44fe3317c6b
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include<stdio.h> int main(){ int t; scanf("%d",&t); while(t--){ int n,x,y; scanf("%d %d %d",&n,&x,&y); int dif=y-x; int k=n-1; while(dif%k!=0){ k--; } int d=dif/k; int l=dif/d+1,min=x,max=y; while(l<n){ if(min-d>0){min=min-d; l++;} else{max=max+d; l++;} } for(int i=0;i<n;i++){printf("%d ",min+d*i);} printf("\n"); } }
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
7ffb13432c008ef8837ccfe6703f3076
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include<stdio.h> int main() {int t; scanf("%d\n",&t); while(t--){ int n,x,y,d,i=1,r,diff,max=3000; int x1,y1,main_diff; scanf("%d%d%d\n",&n,&x,&y); d=y-x;x1=x;y1=y; while(n>=i+1) { if((d/i)*i==d) { x=x1;y=y1;diff=d/i; r=n-2-(i-1); while(x-diff>0&&r>0) {x=x-diff;r--;} i...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
3096599b0e56e5e47ba1d70c02e52d45
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include <stdio.h> int step(int n, int delta){ if( n == 2 ){ return delta; } int i, m = 0; for( i = 1; i <= 50; i++ ){ if( delta%i == 0 ){ m = i; if( delta/i <= n-1 ){ break;...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
04366d929bbe629b895ba5e4d285032c
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include<stdio.h> int main(){long int t,i,n,x,y,j,c,k,h,y1; scanf("%ld",&t); for(i=0;i<t;i++) { scanf("%ld%ld%ld",&n,&x,&y); c=0; for(j=n-1;j>=1;j--) { if((y-x)%j==0) { c++; break; } } if(c==0...
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x &lt; y$$$....
For each test case, print the answer: $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter). It can be proven that such an array al...
C
ca9d97e731e86cf8223520f39ef5d945
fda7a64e50d79d6d5c95b750998c2991
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "number theory", "brute force", "math" ]
1599230100
["5\n2 1 49\n5 20 50\n6 20 50\n5 3 8\n9 13 22"]
null
PASSED
1,200
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$2 \le n \le 50$$$; $$$1 \le x &lt; y \le 50$$$) — the length of the array and two elements ...
["1 49 \n20 40 30 50 10\n26 32 20 38 44 50 \n8 23 18 13 3 \n1 10 13 4 19 22 25 16 7"]
#include <stdio.h> int main() { //int a;scanf("%d",&a);printf("%d\n",a); //printf("1\n");return(0); int t,i;scanf("%d",&t); for(i=0;i<t;i++) { int n,x,y,j,d,k=1;scanf("%d %d %d",&n,&x,&y);//printf("%d %d %d\n",n,x,y); for(j=y;j<=3000;j++) { int u=0;d=1; ...