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
Fedya studies in a gymnasium. Fedya's maths hometask is to calculate the following expression:(1n + 2n + 3n + 4n) mod 5for given value of n. Fedya managed to complete the task. Can you? Note that given number n can be extremely large (e.g. it can exceed any integer type of your programming language).
Print the value of the expression without leading zeros.
C
74cbcbafbffc363137a02697952a8539
0b1c50a14c309dc851d64d40ead4f4c0
GNU C
standard output
256 megabytes
train_003.jsonl
[ "number theory", "math" ]
1407511800
["4", "124356983594583453458888889"]
NoteOperation x mod y means taking remainder after division x by y.Note to the first sample:
PASSED
1,200
standard input
1 second
The single line contains a single integer n (0 ≤ n ≤ 10105). The number doesn't contain any leading zeroes.
["4", "0"]
#include<stdio.h> #define h 1000000000 int main(){ long long int i,p=1; char c[100001]; scanf("%s",c); i=strlen(c); if(c[i-1]%2==1) p+=4; if(c[i-1]%2==0) p+=6; if((c[i-1]+c[i-2]*10)%4==1) p+=3+2;; if((c[i-1]+c[i-2]*10)%4==2) p+=9+4; if((c[i-1]+c[i-2]*10)%4==3) p+=7+8; if((c[i-1]+c[i-2]*10)%4==0) ...
Fedya studies in a gymnasium. Fedya's maths hometask is to calculate the following expression:(1n + 2n + 3n + 4n) mod 5for given value of n. Fedya managed to complete the task. Can you? Note that given number n can be extremely large (e.g. it can exceed any integer type of your programming language).
Print the value of the expression without leading zeros.
C
74cbcbafbffc363137a02697952a8539
90e67ea50de1c338f24c3daee8c20236
GNU C
standard output
256 megabytes
train_003.jsonl
[ "number theory", "math" ]
1407511800
["4", "124356983594583453458888889"]
NoteOperation x mod y means taking remainder after division x by y.Note to the first sample:
PASSED
1,200
standard input
1 second
The single line contains a single integer n (0 ≤ n ≤ 10105). The number doesn't contain any leading zeroes.
["4", "0"]
#include<stdio.h> #include<math.h> main() { int n; scanf("%d",&n); if(n%4==0) printf("4\n"); else printf("0\n"); // printf("%d",n%4); // int d; //d=n%5; // printf("%d ",d); //int f=(1+pow(2,d)+pow(3,d)+pow(4,d)); // printf("%d ",f); //printf("%d",f%5); }
Fedya studies in a gymnasium. Fedya's maths hometask is to calculate the following expression:(1n + 2n + 3n + 4n) mod 5for given value of n. Fedya managed to complete the task. Can you? Note that given number n can be extremely large (e.g. it can exceed any integer type of your programming language).
Print the value of the expression without leading zeros.
C
74cbcbafbffc363137a02697952a8539
ca1f1f98821ceb1c004f5c8b923308b1
GNU C
standard output
256 megabytes
train_003.jsonl
[ "number theory", "math" ]
1407511800
["4", "124356983594583453458888889"]
NoteOperation x mod y means taking remainder after division x by y.Note to the first sample:
PASSED
1,200
standard input
1 second
The single line contains a single integer n (0 ≤ n ≤ 10105). The number doesn't contain any leading zeroes.
["4", "0"]
#include<stdio.h> int main() { int n; //printf("enter the value of n for which expression has to be evaluated"); scanf("%d",&n); if(n%4==0) printf("4"); else printf("0"); return(0); }
Fedya studies in a gymnasium. Fedya's maths hometask is to calculate the following expression:(1n + 2n + 3n + 4n) mod 5for given value of n. Fedya managed to complete the task. Can you? Note that given number n can be extremely large (e.g. it can exceed any integer type of your programming language).
Print the value of the expression without leading zeros.
C
74cbcbafbffc363137a02697952a8539
03a5a04e24277b05caf2136c8bbe71ea
GNU C
standard output
256 megabytes
train_003.jsonl
[ "number theory", "math" ]
1407511800
["4", "124356983594583453458888889"]
NoteOperation x mod y means taking remainder after division x by y.Note to the first sample:
PASSED
1,200
standard input
1 second
The single line contains a single integer n (0 ≤ n ≤ 10105). The number doesn't contain any leading zeroes.
["4", "0"]
#include <stdio.h> int main(void){ int n,a,b,c,i; i = 0; c = 0; a = 0; b = 0; c = getchar(); while ((0 <= (c - '0')) && ((c - '0') <= 9)){ if ((i % 2) == 0) a = c; else b = c; ++i; c = getchar(); } if (i == 1) n = a -'0'; else if (i % 2 == 0) n = (a - '0') * 10 + (b - '0'); else if (i % 2 == 1)...
Fedya studies in a gymnasium. Fedya's maths hometask is to calculate the following expression:(1n + 2n + 3n + 4n) mod 5for given value of n. Fedya managed to complete the task. Can you? Note that given number n can be extremely large (e.g. it can exceed any integer type of your programming language).
Print the value of the expression without leading zeros.
C
74cbcbafbffc363137a02697952a8539
0f4bb189ada3f472ff43b462ae8dbf49
GNU C
standard output
256 megabytes
train_003.jsonl
[ "number theory", "math" ]
1407511800
["4", "124356983594583453458888889"]
NoteOperation x mod y means taking remainder after division x by y.Note to the first sample:
PASSED
1,200
standard input
1 second
The single line contains a single integer n (0 ≤ n ≤ 10105). The number doesn't contain any leading zeroes.
["4", "0"]
#include<stdio.h> main(){int n;scanf("%d",&n);printf(n%4?"0":"4");}
Fedya studies in a gymnasium. Fedya's maths hometask is to calculate the following expression:(1n + 2n + 3n + 4n) mod 5for given value of n. Fedya managed to complete the task. Can you? Note that given number n can be extremely large (e.g. it can exceed any integer type of your programming language).
Print the value of the expression without leading zeros.
C
74cbcbafbffc363137a02697952a8539
2111d49ef60ff0a0791b9d345fc46b26
GNU C
standard output
256 megabytes
train_003.jsonl
[ "number theory", "math" ]
1407511800
["4", "124356983594583453458888889"]
NoteOperation x mod y means taking remainder after division x by y.Note to the first sample:
PASSED
1,200
standard input
1 second
The single line contains a single integer n (0 ≤ n ≤ 10105). The number doesn't contain any leading zeroes.
["4", "0"]
main(){int n;scanf("%d",&n);puts(n%4?"0":"4");}
Fedya studies in a gymnasium. Fedya's maths hometask is to calculate the following expression:(1n + 2n + 3n + 4n) mod 5for given value of n. Fedya managed to complete the task. Can you? Note that given number n can be extremely large (e.g. it can exceed any integer type of your programming language).
Print the value of the expression without leading zeros.
C
74cbcbafbffc363137a02697952a8539
b3129fbace1d59b0cf187718a29f19cb
GNU C
standard output
256 megabytes
train_003.jsonl
[ "number theory", "math" ]
1407511800
["4", "124356983594583453458888889"]
NoteOperation x mod y means taking remainder after division x by y.Note to the first sample:
PASSED
1,200
standard input
1 second
The single line contains a single integer n (0 ≤ n ≤ 10105). The number doesn't contain any leading zeroes.
["4", "0"]
main(n){scanf("%d",&n);puts(n%4?"0":"4");}
Fedya studies in a gymnasium. Fedya's maths hometask is to calculate the following expression:(1n + 2n + 3n + 4n) mod 5for given value of n. Fedya managed to complete the task. Can you? Note that given number n can be extremely large (e.g. it can exceed any integer type of your programming language).
Print the value of the expression without leading zeros.
C
74cbcbafbffc363137a02697952a8539
017198406350c48e146ae5b864d564ec
GNU C
standard output
256 megabytes
train_003.jsonl
[ "number theory", "math" ]
1407511800
["4", "124356983594583453458888889"]
NoteOperation x mod y means taking remainder after division x by y.Note to the first sample:
PASSED
1,200
standard input
1 second
The single line contains a single integer n (0 ≤ n ≤ 10105). The number doesn't contain any leading zeroes.
["4", "0"]
#include <stdio.h> #include <string.h> char a[1000065]; int main() { int t; long long i; gets(a); i=0; while(1) { if(a[i]=='\0') { break; } i++; } t=a[i-1]+10*(a[i-2]-'0')-'0'; if(t%4==0) printf("4"); else printf("0"); retur...
Fedya studies in a gymnasium. Fedya's maths hometask is to calculate the following expression:(1n + 2n + 3n + 4n) mod 5for given value of n. Fedya managed to complete the task. Can you? Note that given number n can be extremely large (e.g. it can exceed any integer type of your programming language).
Print the value of the expression without leading zeros.
C
74cbcbafbffc363137a02697952a8539
8f45728c8570d0e42d2a4a7bf5bb26f4
GNU C
standard output
256 megabytes
train_003.jsonl
[ "number theory", "math" ]
1407511800
["4", "124356983594583453458888889"]
NoteOperation x mod y means taking remainder after division x by y.Note to the first sample:
PASSED
1,200
standard input
1 second
The single line contains a single integer n (0 ≤ n ≤ 10105). The number doesn't contain any leading zeroes.
["4", "0"]
main(n){scanf("%d",&n);puts(n%4?"0":"4");}
Fedya studies in a gymnasium. Fedya's maths hometask is to calculate the following expression:(1n + 2n + 3n + 4n) mod 5for given value of n. Fedya managed to complete the task. Can you? Note that given number n can be extremely large (e.g. it can exceed any integer type of your programming language).
Print the value of the expression without leading zeros.
C
74cbcbafbffc363137a02697952a8539
150868cfd3f2a4c999362e99083137d1
GNU C
standard output
256 megabytes
train_003.jsonl
[ "number theory", "math" ]
1407511800
["4", "124356983594583453458888889"]
NoteOperation x mod y means taking remainder after division x by y.Note to the first sample:
PASSED
1,200
standard input
1 second
The single line contains a single integer n (0 ≤ n ≤ 10105). The number doesn't contain any leading zeroes.
["4", "0"]
#include<stdio.h> #include<math.h> #include<string.h> int main() { int p,m,a2[8],a3[8],a4[8]; a2[1]=2,a2[2]=4,a2[3]=3,a2[0]=1; a3[1]=3,a3[2]=4,a3[3]=2,a3[0]=1; a4[1]=4,a4[0]=1; char st[100000]; scanf("%s",st); if(strlen(st)>=2) p=(st[(strlen(st)-2)]-'0')*10+(st[(strlen(st)-1)]-'0'); else p...
Fedya studies in a gymnasium. Fedya's maths hometask is to calculate the following expression:(1n + 2n + 3n + 4n) mod 5for given value of n. Fedya managed to complete the task. Can you? Note that given number n can be extremely large (e.g. it can exceed any integer type of your programming language).
Print the value of the expression without leading zeros.
C
74cbcbafbffc363137a02697952a8539
e0be4cc9dbec03edf0dea4718e83bf11
GNU C
standard output
256 megabytes
train_003.jsonl
[ "number theory", "math" ]
1407511800
["4", "124356983594583453458888889"]
NoteOperation x mod y means taking remainder after division x by y.Note to the first sample:
PASSED
1,200
standard input
1 second
The single line contains a single integer n (0 ≤ n ≤ 10105). The number doesn't contain any leading zeroes.
["4", "0"]
#include<stdio.h> int p(int a,int b) { if(b==0) return 1; else return a*p(a,b-1); } int main() { unsigned long long int n; scanf("%llu",&n); int i,j=1; for(i=2;i<5;i++) if(i!=4) j+=p(i,n%4); else j+=p(i,n%2); printf("%d\n",j%5); return 0; }
Fedya studies in a gymnasium. Fedya's maths hometask is to calculate the following expression:(1n + 2n + 3n + 4n) mod 5for given value of n. Fedya managed to complete the task. Can you? Note that given number n can be extremely large (e.g. it can exceed any integer type of your programming language).
Print the value of the expression without leading zeros.
C
74cbcbafbffc363137a02697952a8539
3eb29c836fbfd11f8e92d1e3a14b937c
GNU C
standard output
256 megabytes
train_003.jsonl
[ "number theory", "math" ]
1407511800
["4", "124356983594583453458888889"]
NoteOperation x mod y means taking remainder after division x by y.Note to the first sample:
PASSED
1,200
standard input
1 second
The single line contains a single integer n (0 ≤ n ≤ 10105). The number doesn't contain any leading zeroes.
["4", "0"]
#include <stdio.h> int main() { int n; scanf ("%d", &n); if (n%4 == 0) { printf ("4\n"); } else { printf ("0\n"); } return 0; }
Fedya studies in a gymnasium. Fedya's maths hometask is to calculate the following expression:(1n + 2n + 3n + 4n) mod 5for given value of n. Fedya managed to complete the task. Can you? Note that given number n can be extremely large (e.g. it can exceed any integer type of your programming language).
Print the value of the expression without leading zeros.
C
74cbcbafbffc363137a02697952a8539
3c2bd5e866b58be42d2ee8e84512ec9b
GNU C
standard output
256 megabytes
train_003.jsonl
[ "number theory", "math" ]
1407511800
["4", "124356983594583453458888889"]
NoteOperation x mod y means taking remainder after division x by y.Note to the first sample:
PASSED
1,200
standard input
1 second
The single line contains a single integer n (0 ≤ n ≤ 10105). The number doesn't contain any leading zeroes.
["4", "0"]
#include<stdio.h> int main() { char c,temp,g; int x; scanf("%c",&temp);; scanf("%c",&g); if(g!='\n') { //printf("hello\n"); while(1) { // printf("hii\n"); // c=getchar(); scanf("%c",&c); if(c=='\n') break; temp=g; g=c; } x...
Fedya studies in a gymnasium. Fedya's maths hometask is to calculate the following expression:(1n + 2n + 3n + 4n) mod 5for given value of n. Fedya managed to complete the task. Can you? Note that given number n can be extremely large (e.g. it can exceed any integer type of your programming language).
Print the value of the expression without leading zeros.
C
74cbcbafbffc363137a02697952a8539
cbf3b4af28ff9ff2f3c57964d04dd830
GNU C
standard output
256 megabytes
train_003.jsonl
[ "number theory", "math" ]
1407511800
["4", "124356983594583453458888889"]
NoteOperation x mod y means taking remainder after division x by y.Note to the first sample:
PASSED
1,200
standard input
1 second
The single line contains a single integer n (0 ≤ n ≤ 10105). The number doesn't contain any leading zeroes.
["4", "0"]
#include<stdio.h> #include<math.h> int main() { unsigned long long int n,sum; int a,b,temp,res; // 1....1.......1........1.........1..............1..................1 // 2....4.......8.......16.......32..........64.............128 // 3....9.......27.....81.......243.......729........2187 // 4....16....64....256....1...
You are given some Tetris field consisting of $$$n$$$ columns. The initial height of the $$$i$$$-th column of the field is $$$a_i$$$ blocks. On top of these columns you can place only figures of size $$$2 \times 1$$$ (i.e. the height of this figure is $$$2$$$ blocks and the width of this figure is $$$1$$$ block). Note ...
For each test case, print the answer — "YES" (without quotes) if you can clear the whole Tetris field and "NO" otherwise.
C
53a3313f5d6ce19413d72473717054fc
3b82d2ed50555cffae032c5147cfafb8
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "implementation", "number theory" ]
1584018300
["4\n3\n1 1 3\n4\n1 1 2 1\n2\n11 11\n1\n100"]
NoteThe first test case of the example field is shown below:Gray lines are bounds of the Tetris field. Note that the field has no upper bound.One of the correct answers is to first place the figure in the first column. Then after the second step of the process, the field becomes $$$[2, 0, 2]$$$. Then place the figure i...
PASSED
900
standard input
2 seconds
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of columns in the Tetris field. The second line of the test case con...
["YES\nNO\nYES\nYES"]
#include<stdio.h> int main() { int t,n,i,j,q,a[100]; scanf("%d",&t); while(t!=0) { scanf("%d",&n); for(i=0; i<n; i++) scanf("%d",&a[i]); if(n==1) printf("YES\n"); else{ q=0; for(i=0; i<n-1; i++) { for(j=i+1; j<n; j++) { if((a[i]-a[j])%2!=0) q++; } } if(q==0) printf("YES\n"); else printf("NO\...
You are given some Tetris field consisting of $$$n$$$ columns. The initial height of the $$$i$$$-th column of the field is $$$a_i$$$ blocks. On top of these columns you can place only figures of size $$$2 \times 1$$$ (i.e. the height of this figure is $$$2$$$ blocks and the width of this figure is $$$1$$$ block). Note ...
For each test case, print the answer — "YES" (without quotes) if you can clear the whole Tetris field and "NO" otherwise.
C
53a3313f5d6ce19413d72473717054fc
0a3c80886ab6948892ba0cb979fb261f
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "implementation", "number theory" ]
1584018300
["4\n3\n1 1 3\n4\n1 1 2 1\n2\n11 11\n1\n100"]
NoteThe first test case of the example field is shown below:Gray lines are bounds of the Tetris field. Note that the field has no upper bound.One of the correct answers is to first place the figure in the first column. Then after the second step of the process, the field becomes $$$[2, 0, 2]$$$. Then place the figure i...
PASSED
900
standard input
2 seconds
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of columns in the Tetris field. The second line of the test case con...
["YES\nNO\nYES\nYES"]
void main(){ int T; scanf("%d",&T); while(T--){ int n; scanf("%d",&n); int a[n],i,j,count=1; for(i=0;i<n;i++){ scanf("%d",&a[i]); } for(i=0;i<n-1;i++){ for(j=i+1;j<n;j++){ if(abs(a[i]-a[j])%2!=0) count=0; } } if(count==1) printf("YES\n"); ...
You are given some Tetris field consisting of $$$n$$$ columns. The initial height of the $$$i$$$-th column of the field is $$$a_i$$$ blocks. On top of these columns you can place only figures of size $$$2 \times 1$$$ (i.e. the height of this figure is $$$2$$$ blocks and the width of this figure is $$$1$$$ block). Note ...
For each test case, print the answer — "YES" (without quotes) if you can clear the whole Tetris field and "NO" otherwise.
C
53a3313f5d6ce19413d72473717054fc
4795012412d38c2af286d46fbd6daad2
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "implementation", "number theory" ]
1584018300
["4\n3\n1 1 3\n4\n1 1 2 1\n2\n11 11\n1\n100"]
NoteThe first test case of the example field is shown below:Gray lines are bounds of the Tetris field. Note that the field has no upper bound.One of the correct answers is to first place the figure in the first column. Then after the second step of the process, the field becomes $$$[2, 0, 2]$$$. Then place the figure i...
PASSED
900
standard input
2 seconds
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of columns in the Tetris field. The second line of the test case con...
["YES\nNO\nYES\nYES"]
#include<stdio.h> int main() { int a,b,c,d,i,n,t; scanf("%d",&t); while(t--) { b=0; c=0; scanf("%d",&n); while(n--) { scanf("%d",&a); if(a%2==0) { b++; } else ...
You are given some Tetris field consisting of $$$n$$$ columns. The initial height of the $$$i$$$-th column of the field is $$$a_i$$$ blocks. On top of these columns you can place only figures of size $$$2 \times 1$$$ (i.e. the height of this figure is $$$2$$$ blocks and the width of this figure is $$$1$$$ block). Note ...
For each test case, print the answer — "YES" (without quotes) if you can clear the whole Tetris field and "NO" otherwise.
C
53a3313f5d6ce19413d72473717054fc
63cc0a9722d0d14bd465f43148ad9272
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "implementation", "number theory" ]
1584018300
["4\n3\n1 1 3\n4\n1 1 2 1\n2\n11 11\n1\n100"]
NoteThe first test case of the example field is shown below:Gray lines are bounds of the Tetris field. Note that the field has no upper bound.One of the correct answers is to first place the figure in the first column. Then after the second step of the process, the field becomes $$$[2, 0, 2]$$$. Then place the figure i...
PASSED
900
standard input
2 seconds
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of columns in the Tetris field. The second line of the test case con...
["YES\nNO\nYES\nYES"]
#include<stdio.h> int main() { int l,k,i,j,n,x,omg=0,y; scanf("%d",&l); for(k=0;k<l;k++) { omg=0; scanf("%d",&n); int a[n]; for(i=0;i<n;i++) { scanf("%d",&a[i]); } for(i=0;i<n-1;i++) { for(j=i+1;j<n;j++) { if(a[i]>a[j]) ...
You are given some Tetris field consisting of $$$n$$$ columns. The initial height of the $$$i$$$-th column of the field is $$$a_i$$$ blocks. On top of these columns you can place only figures of size $$$2 \times 1$$$ (i.e. the height of this figure is $$$2$$$ blocks and the width of this figure is $$$1$$$ block). Note ...
For each test case, print the answer — "YES" (without quotes) if you can clear the whole Tetris field and "NO" otherwise.
C
53a3313f5d6ce19413d72473717054fc
271d46650461a8d937cb6017de27b1ea
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "implementation", "number theory" ]
1584018300
["4\n3\n1 1 3\n4\n1 1 2 1\n2\n11 11\n1\n100"]
NoteThe first test case of the example field is shown below:Gray lines are bounds of the Tetris field. Note that the field has no upper bound.One of the correct answers is to first place the figure in the first column. Then after the second step of the process, the field becomes $$$[2, 0, 2]$$$. Then place the figure i...
PASSED
900
standard input
2 seconds
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of columns in the Tetris field. The second line of the test case con...
["YES\nNO\nYES\nYES"]
#include<stdio.h> int main() { int n; scanf("%d",&n); while(n--) { int t,y=0,k=0; int flag=0; int a[1000]; scanf("%d",&t); for(int i=0;i<t;i++) scanf("%d",&a[i]); if(t==1) { printf("YES\n"); continue; } for(int i=0;i<t-1;i++) { y=a[i]%2; k=a[i+1]%2; if(y!=k) ...
You are given some Tetris field consisting of $$$n$$$ columns. The initial height of the $$$i$$$-th column of the field is $$$a_i$$$ blocks. On top of these columns you can place only figures of size $$$2 \times 1$$$ (i.e. the height of this figure is $$$2$$$ blocks and the width of this figure is $$$1$$$ block). Note ...
For each test case, print the answer — "YES" (without quotes) if you can clear the whole Tetris field and "NO" otherwise.
C
53a3313f5d6ce19413d72473717054fc
34288b9f119c89e116711fe74fc49a7b
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "implementation", "number theory" ]
1584018300
["4\n3\n1 1 3\n4\n1 1 2 1\n2\n11 11\n1\n100"]
NoteThe first test case of the example field is shown below:Gray lines are bounds of the Tetris field. Note that the field has no upper bound.One of the correct answers is to first place the figure in the first column. Then after the second step of the process, the field becomes $$$[2, 0, 2]$$$. Then place the figure i...
PASSED
900
standard input
2 seconds
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of columns in the Tetris field. The second line of the test case con...
["YES\nNO\nYES\nYES"]
#include <stdio.h> #include <string.h> #define sd(val) scanf("%d",&val) #define ss(val) scanf("%s",&val) #define sld(val) scanf("%ld",&val) #define debug(val) printf("check%d\n",val) #define clr(val) memset(val,0,sizeof(val)) #define FOR(count,val) for(count = 0; count < val; count++) #define MAX(a,b) ((a<b)?b:a) int ...
You are given some Tetris field consisting of $$$n$$$ columns. The initial height of the $$$i$$$-th column of the field is $$$a_i$$$ blocks. On top of these columns you can place only figures of size $$$2 \times 1$$$ (i.e. the height of this figure is $$$2$$$ blocks and the width of this figure is $$$1$$$ block). Note ...
For each test case, print the answer — "YES" (without quotes) if you can clear the whole Tetris field and "NO" otherwise.
C
53a3313f5d6ce19413d72473717054fc
d982c6925e7c3db11f02b1f40f43e03f
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "implementation", "number theory" ]
1584018300
["4\n3\n1 1 3\n4\n1 1 2 1\n2\n11 11\n1\n100"]
NoteThe first test case of the example field is shown below:Gray lines are bounds of the Tetris field. Note that the field has no upper bound.One of the correct answers is to first place the figure in the first column. Then after the second step of the process, the field becomes $$$[2, 0, 2]$$$. Then place the figure i...
PASSED
900
standard input
2 seconds
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of columns in the Tetris field. The second line of the test case con...
["YES\nNO\nYES\nYES"]
#include <stdio.h> #include <stdlib.h> #include <string.h> #define sd(val) scanf("%d",&val) #define ss(val) scanf("%s",&val) #define sld(val) scanf("%ld",&val) #define debug(val) printf("check%d\n",val) #define clr(val) memset(val,0,sizeof(val)) #define FOR(count,val) for(count = 0; count < val; count++) #define MAX(a,...
You are given some Tetris field consisting of $$$n$$$ columns. The initial height of the $$$i$$$-th column of the field is $$$a_i$$$ blocks. On top of these columns you can place only figures of size $$$2 \times 1$$$ (i.e. the height of this figure is $$$2$$$ blocks and the width of this figure is $$$1$$$ block). Note ...
For each test case, print the answer — "YES" (without quotes) if you can clear the whole Tetris field and "NO" otherwise.
C
53a3313f5d6ce19413d72473717054fc
a71718dd3827ed22108da46b0e59c901
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "implementation", "number theory" ]
1584018300
["4\n3\n1 1 3\n4\n1 1 2 1\n2\n11 11\n1\n100"]
NoteThe first test case of the example field is shown below:Gray lines are bounds of the Tetris field. Note that the field has no upper bound.One of the correct answers is to first place the figure in the first column. Then after the second step of the process, the field becomes $$$[2, 0, 2]$$$. Then place the figure i...
PASSED
900
standard input
2 seconds
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of columns in the Tetris field. The second line of the test case con...
["YES\nNO\nYES\nYES"]
#include<stdio.h> int main(){ int T; scanf("%d",&T); int n,i; while(T--){ scanf("%d",&n); int c[n]; scanf("%d",&c[0]); int max =c[0]; for(i=1;i<n;i++){ scanf("%d",&c[i]); if(c[i]>max){ max = c[i]; } } ...
You are given some Tetris field consisting of $$$n$$$ columns. The initial height of the $$$i$$$-th column of the field is $$$a_i$$$ blocks. On top of these columns you can place only figures of size $$$2 \times 1$$$ (i.e. the height of this figure is $$$2$$$ blocks and the width of this figure is $$$1$$$ block). Note ...
For each test case, print the answer — "YES" (without quotes) if you can clear the whole Tetris field and "NO" otherwise.
C
53a3313f5d6ce19413d72473717054fc
7b40366701b38ab98140f152d186bdc7
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "implementation", "number theory" ]
1584018300
["4\n3\n1 1 3\n4\n1 1 2 1\n2\n11 11\n1\n100"]
NoteThe first test case of the example field is shown below:Gray lines are bounds of the Tetris field. Note that the field has no upper bound.One of the correct answers is to first place the figure in the first column. Then after the second step of the process, the field becomes $$$[2, 0, 2]$$$. Then place the figure i...
PASSED
900
standard input
2 seconds
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of columns in the Tetris field. The second line of the test case con...
["YES\nNO\nYES\nYES"]
#include <stdio.h> int main(){ int t; scanf("%d",&t); while(t--){ int n,i; scanf("%d",&n); int c[n]; scanf("%d",&c[0]); int max=c[0]; for(int i=1;i<n;i++){ scanf("%d",&c[i]); if(c[i]>max){ max=c[i]; } ...
You are given some Tetris field consisting of $$$n$$$ columns. The initial height of the $$$i$$$-th column of the field is $$$a_i$$$ blocks. On top of these columns you can place only figures of size $$$2 \times 1$$$ (i.e. the height of this figure is $$$2$$$ blocks and the width of this figure is $$$1$$$ block). Note ...
For each test case, print the answer — "YES" (without quotes) if you can clear the whole Tetris field and "NO" otherwise.
C
53a3313f5d6ce19413d72473717054fc
f912d5b674063c976406a6bf76f67471
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "implementation", "number theory" ]
1584018300
["4\n3\n1 1 3\n4\n1 1 2 1\n2\n11 11\n1\n100"]
NoteThe first test case of the example field is shown below:Gray lines are bounds of the Tetris field. Note that the field has no upper bound.One of the correct answers is to first place the figure in the first column. Then after the second step of the process, the field becomes $$$[2, 0, 2]$$$. Then place the figure i...
PASSED
900
standard input
2 seconds
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of columns in the Tetris field. The second line of the test case con...
["YES\nNO\nYES\nYES"]
#include<stdio.h> #include<math.h> int main() { int t,n,a; scanf("%d",&t); int k=3; for(int i=0;i<t;i++) { scanf("%d",&n); int count=0; for(int i=0;i<n;i++) { scanf("%d",&a); if(a%2==0) { count++; } }if(count==0 ||...
You are given some Tetris field consisting of $$$n$$$ columns. The initial height of the $$$i$$$-th column of the field is $$$a_i$$$ blocks. On top of these columns you can place only figures of size $$$2 \times 1$$$ (i.e. the height of this figure is $$$2$$$ blocks and the width of this figure is $$$1$$$ block). Note ...
For each test case, print the answer — "YES" (without quotes) if you can clear the whole Tetris field and "NO" otherwise.
C
53a3313f5d6ce19413d72473717054fc
41296ba27b03f68453a65e3e85cd2d5c
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "implementation", "number theory" ]
1584018300
["4\n3\n1 1 3\n4\n1 1 2 1\n2\n11 11\n1\n100"]
NoteThe first test case of the example field is shown below:Gray lines are bounds of the Tetris field. Note that the field has no upper bound.One of the correct answers is to first place the figure in the first column. Then after the second step of the process, the field becomes $$$[2, 0, 2]$$$. Then place the figure i...
PASSED
900
standard input
2 seconds
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of columns in the Tetris field. The second line of the test case con...
["YES\nNO\nYES\nYES"]
#include<stdio.h> int main(){ int t; scanf("%d",&t); while(t--){ int n,i; scanf("%d",&n); int c[n]; scanf("%d",&c[0]); int max = c[0]; for(int i = 1;i < n;i++){ scanf("%d",&c[i]); if(c[i] > max){ max = c[i]; ...
You are given some Tetris field consisting of $$$n$$$ columns. The initial height of the $$$i$$$-th column of the field is $$$a_i$$$ blocks. On top of these columns you can place only figures of size $$$2 \times 1$$$ (i.e. the height of this figure is $$$2$$$ blocks and the width of this figure is $$$1$$$ block). Note ...
For each test case, print the answer — "YES" (without quotes) if you can clear the whole Tetris field and "NO" otherwise.
C
53a3313f5d6ce19413d72473717054fc
d9f33425d1dac567eff012c5d8c7929e
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "implementation", "number theory" ]
1584018300
["4\n3\n1 1 3\n4\n1 1 2 1\n2\n11 11\n1\n100"]
NoteThe first test case of the example field is shown below:Gray lines are bounds of the Tetris field. Note that the field has no upper bound.One of the correct answers is to first place the figure in the first column. Then after the second step of the process, the field becomes $$$[2, 0, 2]$$$. Then place the figure i...
PASSED
900
standard input
2 seconds
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of columns in the Tetris field. The second line of the test case con...
["YES\nNO\nYES\nYES"]
#include<stdio.h> int main(void) { int i,j,n,a,odd,even,t; scanf("%d",&t); int answer[t]; for(i=0;i<t;i++) { scanf("%d",&n); for(j=0,even=0,odd=0;j<n;j++) { scanf("%d",&a); if(a%2==0) even++; else odd++; ...
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≤ i &lt; j ≤ n,...
Print the single number — the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
C
a37df9b239a40473516d1525d56a0da7
12a320001c948d9c39cccd5b01b205d3
GNU C
standard output
256 megabytes
train_003.jsonl
[ "combinatorics" ]
1329750000
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
PASSED
1,400
standard input
2 seconds
The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
["4", "216"]
#include <stdio.h> #include <stdlib.h> int main(void) { char buf = '\0'; unsigned long long int result = 0; unsigned long long int variants = 0; int symbols[100][26] = {{0}}; // FILE *f = 0; int N = 0,M = 0,n=0,m=0,i=0; // f = fopen("input.txt","rt"); scanf("%d %d\n",&N,&M); for (n...
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≤ i &lt; j ≤ n,...
Print the single number — the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
C
a37df9b239a40473516d1525d56a0da7
574f3efcd93e9d895ec9f34267c5bad2
GNU C
standard output
256 megabytes
train_003.jsonl
[ "combinatorics" ]
1329750000
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
PASSED
1,400
standard input
2 seconds
The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
["4", "216"]
#include<stdio.h> #include<string.h> #include<stdlib.h> #define mod 1000000007 typedef long long int li; int hash[128]; char strings[101][101]; int main() { //freopen("program.txt","r",stdin); int n,m; scanf("%d %d",&n,&m); int i,j,k; for(i=0;i<n;i++) { scanf("%s",strings[i]); //printf("%s\n",strings[i]); } ...
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≤ i &lt; j ≤ n,...
Print the single number — the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
C
a37df9b239a40473516d1525d56a0da7
2a71d3477a3d11fc6d159d6443272296
GNU C
standard output
256 megabytes
train_003.jsonl
[ "combinatorics" ]
1329750000
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
PASSED
1,400
standard input
2 seconds
The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
["4", "216"]
#include<stdio.h> #include<memory.h> #define N 110 #define M 1000000007 char na[N][N]; int st[26]; int main() { int n,m; int i,j,k; __int64 ans,cnt; while(scanf("%d%d",&n,&m)!=EOF) { ans=1; for(i=0;i<n;i++){ getchar(); for(j=0;j<m;j++) scanf("%c"...
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≤ i &lt; j ≤ n,...
Print the single number — the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
C
a37df9b239a40473516d1525d56a0da7
ebbd5a666034c34e016ef5056c56cd75
GNU C
standard output
256 megabytes
train_003.jsonl
[ "combinatorics" ]
1329750000
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
PASSED
1,400
standard input
2 seconds
The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
["4", "216"]
#include<stdio.h> int n,m,f[205][205],ct[205]={0},i,j; char c[105][105]; long long int ans=1; int main() { for(i=0;i<205;i++) for(j=0;j<205;j++) f[i][j]=0; scanf("%d%d",&n,&m); for(i=0;i<n;i++) scanf("%s",c[i]); for(j=0;j<m;j++) for(i=0;i<n;i++) { if(f[j][c...
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≤ i &lt; j ≤ n,...
Print the single number — the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
C
a37df9b239a40473516d1525d56a0da7
be42f64b12dc3e81d9f010f61f1638d6
GNU C
standard output
256 megabytes
train_003.jsonl
[ "combinatorics" ]
1329750000
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
PASSED
1,400
standard input
2 seconds
The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
["4", "216"]
#include <stdio.h> #include <string.h> long long int a[27], c[105]; int main() { char s[105][105]; long long int n, i, j, k, m, ans=1, mod=1000000007; scanf("%lld %lld", &n, &m); for(i=0; i<n; i++) scanf("%s", s[i]); for(i=0; i<m; i++) { c[i]=0; for(j=0; j<2...
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≤ i &lt; j ≤ n,...
Print the single number — the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
C
a37df9b239a40473516d1525d56a0da7
31186de36fcff6653aa5259b4d74f491
GNU C
standard output
256 megabytes
train_003.jsonl
[ "combinatorics" ]
1329750000
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
PASSED
1,400
standard input
2 seconds
The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
["4", "216"]
#include<stdio.h> #define max 1000000007 int main() { char arr[101][101]; long long int c,t,num[26],i,j,n,m,ans=1; scanf("%lld %lld", &n, &m); for(i=0; i<n; i++) { scanf("%s", arr[i]); } for(i=0; i<m; i++) { c=0; for(j=0; j<26; j++) { num[j] = 0; } for(j=0; j<n; j++) { t = arr[j][i] - 'A'; ...
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≤ i &lt; j ≤ n,...
Print the single number — the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
C
a37df9b239a40473516d1525d56a0da7
0cba788644ed61c880503bf6368e47c2
GNU C
standard output
256 megabytes
train_003.jsonl
[ "combinatorics" ]
1329750000
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
PASSED
1,400
standard input
2 seconds
The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
["4", "216"]
#include <stdio.h> #include <stdlib.h> #include <string.h> char STR[105][105]; long long sum; int main() { int n,m,i,j,num[105],str[26]; scanf("%d%d",&n,&m); getchar(); for(i=0;i<n;i++) gets(STR[i]); memset(num,0,sizeof(num)); for(j=0;j<m;j++) { memset(str,0,sizeof(str)); ...
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≤ i &lt; j ≤ n,...
Print the single number — the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
C
a37df9b239a40473516d1525d56a0da7
467cb7518fd412fcfc54b22efea8f2f9
GNU C
standard output
256 megabytes
train_003.jsonl
[ "combinatorics" ]
1329750000
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
PASSED
1,400
standard input
2 seconds
The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
["4", "216"]
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int i,j,m,n,p,t[50]; long long sum; char s[200][200]; while(scanf("%d%d",&m,&n)!=EOF) { for(i=0;i<m;i++) { getchar(); for(j=0;j<n;j++) { scanf("%c",&s[i][j]); ...
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≤ i &lt; j ≤ n,...
Print the single number — the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
C
a37df9b239a40473516d1525d56a0da7
1439501049d9dfbd6a9a86537deea28c
GNU C
standard output
256 megabytes
train_003.jsonl
[ "combinatorics" ]
1329750000
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
PASSED
1,400
standard input
2 seconds
The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
["4", "216"]
#include<stdio.h> #include<stdlib.h> #include<string.h> long long arr[1000001]; char str[200][200]; int func(const void *a, const void *b) { return (*(int*)a-*(int*)b); } long long max(long long a, long long b) { return (a>b)?a:b; } long long min(long long a, long long b) { return (a>b)?b:a; } int main() { long lon...
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≤ i &lt; j ≤ n,...
Print the single number — the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
C
a37df9b239a40473516d1525d56a0da7
1bdeb6a92cb5ef4b344ff9db293f3af8
GNU C
standard output
256 megabytes
train_003.jsonl
[ "combinatorics" ]
1329750000
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
PASSED
1,400
standard input
2 seconds
The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
["4", "216"]
#include <stdio.h> int main (void) { int n, m; scanf ("%d%d", &n, &m); char used [110] [30]; unsigned ans [110]; int i, j; for (i = 0; i < 110; i++) for (j = 0; j < 30; j++) used [i] [j] = 0; for (i = 0; i < 110; i++) ans [i] = 0; for (i = 0; i < n; i++) ...
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≤ i &lt; j ≤ n,...
Print the single number — the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
C
a37df9b239a40473516d1525d56a0da7
2ba2e6528a19ad439078f32b395358b9
GNU C
standard output
256 megabytes
train_003.jsonl
[ "combinatorics" ]
1329750000
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
PASSED
1,400
standard input
2 seconds
The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
["4", "216"]
#include <stdio.h> #define maxn 100 int main() { int n,m,i,j; char temp; char b[27][maxn]={0}; long long sum,mul=1000000007; //freopen("1.txt","r",stdin); scanf("%d%d",&n,&m); for(i=0;i<n;i++){ for(j=0;j<m;j++) { scanf(" %c",&temp); temp=temp-'A'+1...
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≤ i &lt; j ≤ n,...
Print the single number — the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
C
a37df9b239a40473516d1525d56a0da7
13aa9665bc267be7107cc3c2229b0a8c
GNU C
standard output
256 megabytes
train_003.jsonl
[ "combinatorics" ]
1329750000
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
PASSED
1,400
standard input
2 seconds
The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
["4", "216"]
#include<stdio.h> #include<string.h> #include<stdlib.h> #define MOD 1000000007 int main() { int i,j,k,n,m,count,ans,flag[150]; char str[200][200]; scanf("%d %d",&n,&m); ans=1; for(i=0;i<n;i++) { scanf("%s",str[i]); } for(i=0;i<m;i++) { memset(flag,0,sizeof(flag)); for(j=0;j<n;j++) { flag[str[j][i]]...
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≤ i &lt; j ≤ n,...
Print the single number — the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
C
a37df9b239a40473516d1525d56a0da7
7861d00fa8aab5fc12d3cd7a8deb4591
GNU C
standard output
256 megabytes
train_003.jsonl
[ "combinatorics" ]
1329750000
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
PASSED
1,400
standard input
2 seconds
The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
["4", "216"]
#include <stdio.h> int main() { int n, m, mod = 1000000007, i, j; long long sum = 1; int a[100][26] = {0}; scanf("%d %d", &n, &m); for (i = 0; i < n; i++) { char s[101]; scanf("%s", s); for (j = 0; j < m; j++) a[j][s[j] - 'A'] = 1; } for (i = 0; i < m; i++) { int c =...
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≤ i &lt; j ≤ n,...
Print the single number — the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
C
a37df9b239a40473516d1525d56a0da7
5eda2e6e34ec6300d0188af90ba658ff
GNU C
standard output
256 megabytes
train_003.jsonl
[ "combinatorics" ]
1329750000
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
PASSED
1,400
standard input
2 seconds
The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
["4", "216"]
#include <stdio.h> int main() { int i, j; long long int ans; char c['Z'-'A'+1]; int k[100]; int n, m; char name[100][101]; const long long int base = 1000000007; scanf("%d%d", &n, &m); for (i = 0; i < n; i++) scanf("%s", name[i]); for (j = 0; j < m; j++) { k[j] = 0; for (i = 0; i < 'Z'-...
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≤ i &lt; j ≤ n,...
Print the single number — the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
C
a37df9b239a40473516d1525d56a0da7
2e0cf06e552581ac9a5eae9d1e4737ed
GNU C
standard output
256 megabytes
train_003.jsonl
[ "combinatorics" ]
1329750000
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
PASSED
1,400
standard input
2 seconds
The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
["4", "216"]
#include <stdio.h> #define MOD 1000000007 int n,m; char s[110][110]; long long ans = 1; short vis[110][30]; int main() { int i,j,x; scanf("%d%d",&n,&m); for(i=1;i<=n;i++) scanf("%s",s[i]+1); for(i=1;i<=m;i++,ans=(ans*x)%MOD) for(j=1,x=0;j<=n;j++) { if(!vis[i][s[j][i]-'A']) x++; vis[i][s[j][i]-'A'] = 1; } pri...
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≤ i &lt; j ≤ n,...
Print the single number — the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
C
a37df9b239a40473516d1525d56a0da7
271fce325dcb5d56e34963a4474a3013
GNU C
standard output
256 megabytes
train_003.jsonl
[ "combinatorics" ]
1329750000
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
PASSED
1,400
standard input
2 seconds
The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
["4", "216"]
// Pocket Book.c // // Copyright 2012 Administrator <cpy@ubuntu> // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or //...
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≤ i &lt; j ≤ n,...
Print the single number — the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
C
a37df9b239a40473516d1525d56a0da7
c3d3f22c5649135336631e0f06e0327f
GNU C
standard output
256 megabytes
train_003.jsonl
[ "combinatorics" ]
1329750000
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
PASSED
1,400
standard input
2 seconds
The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
["4", "216"]
#include <stdio.h> #include <stdlib.h> #include <string.h> int compare (const void * a, const void * b) { return ( *(char*)a - *(char*)b ); } int main() { int n, m, i, j, k, t, r; long long int sum = 1; char s[101][101]; char a[101][101]; int b[101]; for (i = 0;i < 101;i++) b[i] = 0; scanf("%d%d",&n,&m); ...
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≤ i &lt; j ≤ n,...
Print the single number — the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
C
a37df9b239a40473516d1525d56a0da7
1cf1c03e68366d4fb0a6aaf191333bae
GNU C
standard output
256 megabytes
train_003.jsonl
[ "combinatorics" ]
1329750000
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
PASSED
1,400
standard input
2 seconds
The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
["4", "216"]
#include <stdio.h> #include <string.h> #define M 1000000007 int main() { int i, j, n, m; int sum; static char s[100][101]; static int a[26]; scanf("%d%d", &n, &m); for (i = 0; i < n; i++) scanf("%s", s[i]); sum = 1; for (i = 0; i < m; i++) { int cnt; memset(a, 0, sizeof(a)); for (j = 0; j < n; j++) ...
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≤ i &lt; j ≤ n,...
Print the single number — the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
C
a37df9b239a40473516d1525d56a0da7
129cc087ce2637de7b1ccd58922a019f
GNU C
standard output
256 megabytes
train_003.jsonl
[ "combinatorics" ]
1329750000
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
PASSED
1,400
standard input
2 seconds
The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
["4", "216"]
#include <stdio.h> #define BASE 1000000007 int main(void) { int n, m; scanf("%d %d\n", &n, &m); int count[m][26]; char str[m+2]; int i, j; for (i = 0; i < m; i++) { for (j = 0; j < 26; j++) count[i][j] = 0; } for (i = 0; i < n; i++) { gets(str); for (j = 0; j < m; j++) count[j][str[j] - 'A']++; ...
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≤ i &lt; j ≤ n,...
Print the single number — the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
C
a37df9b239a40473516d1525d56a0da7
8f2304395ae61ff8412eabce2f2d7ee7
GNU C
standard output
256 megabytes
train_003.jsonl
[ "combinatorics" ]
1329750000
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
PASSED
1,400
standard input
2 seconds
The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
["4", "216"]
#include <stdio.h> char Flag[100][26]; int main() { int N, M, i, j, Ans = 1; char Str[101]; scanf("%d %d", &N, &M); for(i = 0; i < N; ++i) { scanf("%s", Str); for(j = 0; Str[j]; ++j) { Flag[j][Str[j] - 'A'] = 1; } } for(i = 0; i < M; ++i) { int cur =...
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≤ i &lt; j ≤ n,...
Print the single number — the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
C
a37df9b239a40473516d1525d56a0da7
ac36f5c7442e71839a11a92c2522f578
GNU C
standard output
256 megabytes
train_003.jsonl
[ "combinatorics" ]
1329750000
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
PASSED
1,400
standard input
2 seconds
The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
["4", "216"]
#include<stdio.h> #include<string.h> #define MAX 110 #define MODBY 1000000007 int count[MAX][150]; int main() { int n,m; int i,j; long long int ans=1; int lans; char name[MAX]; scanf("%d%d",&n,&m); for(i=0;i<n;i++){ scanf("%s",name); for(j=0;name[j];j++) count[j][name[j]]++; } for(i=0;i<m;i++){//index ...
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≤ i &lt; j ≤ n,...
Print the single number — the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
C
a37df9b239a40473516d1525d56a0da7
0f10c9856baf210dc2d974ab5ca7d927
GNU C
standard output
256 megabytes
train_003.jsonl
[ "combinatorics" ]
1329750000
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
PASSED
1,400
standard input
2 seconds
The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
["4", "216"]
#include<stdio.h> #include<string.h> int vis[26]; char word[105][105]; int main () { int n,m,i,j,k; __int64 ans; while (scanf("%d%d",&n,&m)!=EOF) { for (i=1;i<=n;i++) scanf("%s",word[i]); ans = 1; for (i=0;i<m;i++) { memset(vis,0,sizeof(vis)); k = 0; ...
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≤ i &lt; j ≤ n,...
Print the single number — the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
C
a37df9b239a40473516d1525d56a0da7
e24d8e5bbb07cd4713c81c7cddfb8019
GNU C
standard output
256 megabytes
train_003.jsonl
[ "combinatorics" ]
1329750000
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
PASSED
1,400
standard input
2 seconds
The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
["4", "216"]
#include <limits.h> #include <stdio.h> #include <stdlib.h> #define M 100 #define MOD 1000000007 int n, m, has[M][UCHAR_MAX], count[M]; int main (void) { int i, j; long long ans = 1; scanf ("%d %d", &n, &m); for (i = 0; getchar (), i < n; ++i) for (j = 0; j < m; ++j) has[j][getchar ()] = 1; for (i...
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≤ i &lt; j ≤ n,...
Print the single number — the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
C
a37df9b239a40473516d1525d56a0da7
74aefc129add20ed940b71d9945a0a56
GNU C
standard output
256 megabytes
train_003.jsonl
[ "combinatorics" ]
1329750000
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
PASSED
1,400
standard input
2 seconds
The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
["4", "216"]
#include <stdio.h> #define LEN 128 #define MAX 32 #define MOD 1000000007 char t[LEN][MAX]; int main ( ) { int i, j, k; int n, m; long long r; for ( i = 0, scanf ( "%d%d\n", &n, &m ); i < n; ++i ) { for ( j = 0; j < m; ++j ) { k = getchar ( ) & ...
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≤ i &lt; j ≤ n,...
Print the single number — the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
C
a37df9b239a40473516d1525d56a0da7
d276ca2f148ccae99b8b758098e7885a
GNU C
standard output
256 megabytes
train_003.jsonl
[ "combinatorics" ]
1329750000
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
PASSED
1,400
standard input
2 seconds
The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
["4", "216"]
#include<stdio.h> long long int n,i,j,m,s,t,c=1,d,h[1000]; char a[102][102]; void aaa() { int i;for(i=0;i<1000;i++)h[i]=0; } int main() { scanf("%lld %lld",&n,&m); for(i=0;i<n;i++) scanf("%s",a[i]); for(j=0;j<m;j++) { t=0; for(i=0;i<n;i++) h[a[i][j]]=1; for(i=0;i<1000;i++)if(h[i])t++; c*=t; aaa(); ...
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≤ i &lt; j ≤ n,...
Print the single number — the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
C
a37df9b239a40473516d1525d56a0da7
d845085aeff308fffb491c6b1895e5ba
GNU C
standard output
256 megabytes
train_003.jsonl
[ "combinatorics" ]
1329750000
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
PASSED
1,400
standard input
2 seconds
The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
["4", "216"]
#include <stdio.h> #include <string.h> const int mod = 1000000007; int main() { int n, m; scanf("%d%d", &n, &m); char s[100][101]; int i; for (i = 0; i < n; i++) scanf("%s", s[i]); long long r = 1; for (i = 0; i < m; i++) { char b[100]; memset(b, 0, sizeof(b)); int j; int c = 0; for (j = 0; j < ...
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≤ i &lt; j ≤ n,...
Print the single number — the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
C
a37df9b239a40473516d1525d56a0da7
32d01f0dbb03d3809ac71ea225c7ae62
GNU C
standard output
256 megabytes
train_003.jsonl
[ "combinatorics" ]
1329750000
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
PASSED
1,400
standard input
2 seconds
The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
["4", "216"]
#include <stdio.h> #include <math.h> #include <stdlib.h> #include <string.h> int n,m; char f[111][111]; int ans; int k[100]; int al[33]; int modmul(int x,int y){ int M=1e9+7; long long temp=x; temp*=y; temp%=M; return (int)temp; } int i,j; main(){ scanf("%d%d\n",&n,&m); for(i=0;i<n;i++) f...
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≤ i &lt; j ≤ n,...
Print the single number — the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
C
a37df9b239a40473516d1525d56a0da7
40fb0db56400e66b399c4ba074fe744d
GNU C
standard output
256 megabytes
train_003.jsonl
[ "combinatorics" ]
1329750000
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
PASSED
1,400
standard input
2 seconds
The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
["4", "216"]
#include<stdio.h> main() { int i,j,k,n,m; scanf("%d%d\n",&n,&m); char ch[105][105]; for(i=1;i<=n;i++) scanf("%s",ch[i]); int arr[26]; long long int sum=1; for(k=0;k<26;k++) arr[k]=0; //printf("%s %s\n",ch[1],ch[2]); for(j=0;j<m;j++) { for(k=0;k<26;k++) arr[k]=0; for(i=1;i<=n;i++) { arr[ch[i][j]-'A']++; } int x=0; for(...
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≤ i &lt; j ≤ n,...
Print the single number — the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
C
a37df9b239a40473516d1525d56a0da7
10bbaa073b0de16b823526b518601811
GNU C
standard output
256 megabytes
train_003.jsonl
[ "combinatorics" ]
1329750000
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
PASSED
1,400
standard input
2 seconds
The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
["4", "216"]
#include<stdio.h> int main(){ int n, m, c[100] = {}, sum, i; char ch[100][26] = {}, s[101]; scanf("%d%d%*c", &n, &m); while (n--){ gets(s); for (i = 0 ; i < m ; ++i) if (!ch[i][s[i] - 'A']){ ++ch[i][s[i] - 'A']; ++c[i]; }...
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≤ i &lt; j ≤ n,...
Print the single number — the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
C
a37df9b239a40473516d1525d56a0da7
e821b04c9552b759e9ea41902bad9603
GNU C
standard output
256 megabytes
train_003.jsonl
[ "combinatorics" ]
1329750000
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
PASSED
1,400
standard input
2 seconds
The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
["4", "216"]
#include <stdio.h> #include <string.h> #include <stdlib.h> int main() {int a,b,c,d,e,i,j,k,p,q; long long int r=1,count=0; char *x[105]; int z[30]; for(i=0;i<30;i++) {z[i]=0;} scanf("%d %d",&a,&b); for(i=0;i<a;i++) {x[i]=(char *)malloc(b+1); scanf("%s",x[i]);} for(i=0;i<b;i++) { count=0; for(k=0;k<30;...
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≤ i &lt; j ≤ n,...
Print the single number — the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
C
a37df9b239a40473516d1525d56a0da7
3890f49d2591049120984a3963e9647f
GNU C
standard output
256 megabytes
train_003.jsonl
[ "combinatorics" ]
1329750000
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
PASSED
1,400
standard input
2 seconds
The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
["4", "216"]
#include <stdio.h> int main(){ int n, m, i, j, k, prov; long long c=1; scanf("%i %i", &n, &m); char names[n][m]; for(i=0; i<n; i++) scanf("%s%*c", &names[i]); for(j=0; j<m; j++){ prov=n; for(i=0; i<n; i++){ k=i+1; for(; k<n; k++){ if(names...
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≤ i &lt; j ≤ n,...
Print the single number — the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
C
a37df9b239a40473516d1525d56a0da7
02f863f1d715d2a4af7f267a71ff5235
GNU C
standard output
256 megabytes
train_003.jsonl
[ "combinatorics" ]
1329750000
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
PASSED
1,400
standard input
2 seconds
The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
["4", "216"]
#include<stdio.h> int main(){ int n,m; int a[101][30]; int b[101]; int i,j; char c; long long sum=1; scanf("%d %d",&n,&m); for(j=0;j<m;j++) { b[j]=0; for(i=0;i<30;i++) a[j][i]=0; } for(i=0;i<n;i++) for(j=0;j<m;j++) { c=getchar(); while(c<'A' || c>'Z') c= getchar(); if(a[j][c-'A']==0){ ...
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≤ i &lt; j ≤ n,...
Print the single number — the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
C
a37df9b239a40473516d1525d56a0da7
807fed3ac4340fcf3d320d4791ac4141
GNU C
standard output
256 megabytes
train_003.jsonl
[ "combinatorics" ]
1329750000
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
PASSED
1,400
standard input
2 seconds
The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
["4", "216"]
#include <stdio.h> #include <stdlib.h> int main() { long long res = 1; int n,m; scanf("%d %d\n",&n,&m); int arr[m][26]; int i,j; for(i = 0;i < m;i++) { for(j = 0;j < 26;j++) { arr[i][j] = 0; } } char x[m+1]; for(i =0;i < n;i++) { g...
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≤ i &lt; j ≤ n,...
Print the single number — the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
C
a37df9b239a40473516d1525d56a0da7
f89b52ece69d7a1705a4f0aaf5c1acc5
GNU C
standard output
256 megabytes
train_003.jsonl
[ "combinatorics" ]
1329750000
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
PASSED
1,400
standard input
2 seconds
The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
["4", "216"]
#include <stdio.h> #include <string.h> #include <stdlib.h> int main() { char s[101][101]; char al[26]; int n, m, i, j, num; __int64 as; while (scanf("%d %d", &n, &m) != EOF) { for (i=0; i<n; i++) scanf("%s", s[i]); as = 1; for (j=0; j<m; j++) { memset(al, 0, sizeof(al)); for (i=0; i<n; i++) { ...
Sengoku still remembers the mysterious "colourful meteoroids" she discovered with Lala-chan when they were little. In particular, one of the nights impressed her deeply, giving her the illusion that all her fancies would be realized.On that night, Sengoku constructed a permutation p1, p2, ..., pn of integers from 1 to ...
Output n space-separated integers p1, p2, ..., pn, denoting a possible permutation Sengoku could have had. If there are more than one possible answer, output any one of them. Input guarantees that such permutation exists.
C
6fc3da19da8d9ab024cdd5acfc4f4164
253c01c0fa71e818e73b980570152dd9
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms" ]
1496837700
["5\n1 2 3 4 3\n1 2 5 4 5", "5\n4 4 2 3 1\n5 4 5 3 1", "4\n1 1 3 4\n1 4 3 4"]
NoteIn the first sample, both 1, 2, 5, 4, 3 and 1, 2, 3, 4, 5 are acceptable outputs.In the second sample, 5, 4, 2, 3, 1 is the only permutation to satisfy the constraints.
PASSED
1,300
standard input
1 second
The first line of input contains a positive integer n (2 ≤ n ≤ 1 000) — the length of Sengoku's permutation, being the length of both meteor outbursts at the same time. The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the sequence of colours in the first meteor outburst. The third line...
["1 2 5 4 3", "5 4 2 3 1", "1 2 3 4"]
//Created by Pratik Paras Mandlecha #include<stdio.h> #include<stdlib.h> #include<math.h> #include<string.h> int q[100000],r[100000]; int main() { int n,repa,repb,nca,ncb,f[2]; scanf("%d",&n); int i,a[n],b[n],flag=0; for(i=0;i<n;i++) { scanf("%d",&a[i]); q[a[i]]++; if(q[a[i]]==2) repa=a[i]; } for(i=0;i<n;i...
Sengoku still remembers the mysterious "colourful meteoroids" she discovered with Lala-chan when they were little. In particular, one of the nights impressed her deeply, giving her the illusion that all her fancies would be realized.On that night, Sengoku constructed a permutation p1, p2, ..., pn of integers from 1 to ...
Output n space-separated integers p1, p2, ..., pn, denoting a possible permutation Sengoku could have had. If there are more than one possible answer, output any one of them. Input guarantees that such permutation exists.
C
6fc3da19da8d9ab024cdd5acfc4f4164
4afa4683e25231c3edec588815bce518
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms" ]
1496837700
["5\n1 2 3 4 3\n1 2 5 4 5", "5\n4 4 2 3 1\n5 4 5 3 1", "4\n1 1 3 4\n1 4 3 4"]
NoteIn the first sample, both 1, 2, 5, 4, 3 and 1, 2, 3, 4, 5 are acceptable outputs.In the second sample, 5, 4, 2, 3, 1 is the only permutation to satisfy the constraints.
PASSED
1,300
standard input
1 second
The first line of input contains a positive integer n (2 ≤ n ≤ 1 000) — the length of Sengoku's permutation, being the length of both meteor outbursts at the same time. The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the sequence of colours in the first meteor outburst. The third line...
["1 2 5 4 3", "5 4 2 3 1", "1 2 3 4"]
#include<stdio.h> int main() { int n,a[1000],b[1000],i,j,k,l,m=0,p,q[2]= {-1,-1},r=0; scanf("%d",&n); for(i=0; i<n; i++)scanf("%d",&a[i]); for(i=0; i<n; i++)scanf("%d",&b[i]); for(i=0; i<n; i++)if(a[i]!=b[i]) { k=0; m=0; for(j=0; j<n; j++) ...
Sengoku still remembers the mysterious "colourful meteoroids" she discovered with Lala-chan when they were little. In particular, one of the nights impressed her deeply, giving her the illusion that all her fancies would be realized.On that night, Sengoku constructed a permutation p1, p2, ..., pn of integers from 1 to ...
Output n space-separated integers p1, p2, ..., pn, denoting a possible permutation Sengoku could have had. If there are more than one possible answer, output any one of them. Input guarantees that such permutation exists.
C
6fc3da19da8d9ab024cdd5acfc4f4164
28d4df69b7b6696736a1f62ab34ed1e8
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms" ]
1496837700
["5\n1 2 3 4 3\n1 2 5 4 5", "5\n4 4 2 3 1\n5 4 5 3 1", "4\n1 1 3 4\n1 4 3 4"]
NoteIn the first sample, both 1, 2, 5, 4, 3 and 1, 2, 3, 4, 5 are acceptable outputs.In the second sample, 5, 4, 2, 3, 1 is the only permutation to satisfy the constraints.
PASSED
1,300
standard input
1 second
The first line of input contains a positive integer n (2 ≤ n ≤ 1 000) — the length of Sengoku's permutation, being the length of both meteor outbursts at the same time. The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the sequence of colours in the first meteor outburst. The third line...
["1 2 5 4 3", "5 4 2 3 1", "1 2 3 4"]
#include<stdio.h> int main(){ int n, a[1000],b[1000],c[1000],i,j,x,y,z,f=1,p=0,q=0; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&a[i]); c[i]=a[i]-1+1; } for(i=0;i<n;i++) scanf("%d",&b[i]); for(i=0;i<n;i++){ for(j=i+1;j<n;j++){ if(a[i]==a[j]){ x=j; ...
Sengoku still remembers the mysterious "colourful meteoroids" she discovered with Lala-chan when they were little. In particular, one of the nights impressed her deeply, giving her the illusion that all her fancies would be realized.On that night, Sengoku constructed a permutation p1, p2, ..., pn of integers from 1 to ...
Output n space-separated integers p1, p2, ..., pn, denoting a possible permutation Sengoku could have had. If there are more than one possible answer, output any one of them. Input guarantees that such permutation exists.
C
6fc3da19da8d9ab024cdd5acfc4f4164
fce606e129ca407dde6c12800a2cf20c
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms" ]
1496837700
["5\n1 2 3 4 3\n1 2 5 4 5", "5\n4 4 2 3 1\n5 4 5 3 1", "4\n1 1 3 4\n1 4 3 4"]
NoteIn the first sample, both 1, 2, 5, 4, 3 and 1, 2, 3, 4, 5 are acceptable outputs.In the second sample, 5, 4, 2, 3, 1 is the only permutation to satisfy the constraints.
PASSED
1,300
standard input
1 second
The first line of input contains a positive integer n (2 ≤ n ≤ 1 000) — the length of Sengoku's permutation, being the length of both meteor outbursts at the same time. The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the sequence of colours in the first meteor outburst. The third line...
["1 2 5 4 3", "5 4 2 3 1", "1 2 3 4"]
#include <stdio.h> //#include "array.h" int main() { int n, i, b1 = 0, b2 = 0, temp = 0, i1 = -1, i2 = -1, temp2 = 0; scanf("%d", &n); int a[n], checker[1001] = {}; for(i = 0; i < n; i++){ scanf("%d", &a[i]); checker[a[i]]++; } for(i = 0; i < n; i++){ scanf("%d", &temp);...
Sengoku still remembers the mysterious "colourful meteoroids" she discovered with Lala-chan when they were little. In particular, one of the nights impressed her deeply, giving her the illusion that all her fancies would be realized.On that night, Sengoku constructed a permutation p1, p2, ..., pn of integers from 1 to ...
Output n space-separated integers p1, p2, ..., pn, denoting a possible permutation Sengoku could have had. If there are more than one possible answer, output any one of them. Input guarantees that such permutation exists.
C
6fc3da19da8d9ab024cdd5acfc4f4164
28c5a02907871614e0d1903de4ea7ddc
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms" ]
1496837700
["5\n1 2 3 4 3\n1 2 5 4 5", "5\n4 4 2 3 1\n5 4 5 3 1", "4\n1 1 3 4\n1 4 3 4"]
NoteIn the first sample, both 1, 2, 5, 4, 3 and 1, 2, 3, 4, 5 are acceptable outputs.In the second sample, 5, 4, 2, 3, 1 is the only permutation to satisfy the constraints.
PASSED
1,300
standard input
1 second
The first line of input contains a positive integer n (2 ≤ n ≤ 1 000) — the length of Sengoku's permutation, being the length of both meteor outbursts at the same time. The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the sequence of colours in the first meteor outburst. The third line...
["1 2 5 4 3", "5 4 2 3 1", "1 2 3 4"]
#include<stdio.h> int main() { int a[1001],b[1001],a1[1001]={0},b1[1001]={0}; int check[1001] = {0}; int pair[1001]={0}; int result[1001]; int i=0,j=0,n; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&a[i]); a1[a[i]]++; } for(i=0;i<n;i++) { scanf("...
Sengoku still remembers the mysterious "colourful meteoroids" she discovered with Lala-chan when they were little. In particular, one of the nights impressed her deeply, giving her the illusion that all her fancies would be realized.On that night, Sengoku constructed a permutation p1, p2, ..., pn of integers from 1 to ...
Output n space-separated integers p1, p2, ..., pn, denoting a possible permutation Sengoku could have had. If there are more than one possible answer, output any one of them. Input guarantees that such permutation exists.
C
6fc3da19da8d9ab024cdd5acfc4f4164
020bfd406181de7e2e7926340de72340
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms" ]
1496837700
["5\n1 2 3 4 3\n1 2 5 4 5", "5\n4 4 2 3 1\n5 4 5 3 1", "4\n1 1 3 4\n1 4 3 4"]
NoteIn the first sample, both 1, 2, 5, 4, 3 and 1, 2, 3, 4, 5 are acceptable outputs.In the second sample, 5, 4, 2, 3, 1 is the only permutation to satisfy the constraints.
PASSED
1,300
standard input
1 second
The first line of input contains a positive integer n (2 ≤ n ≤ 1 000) — the length of Sengoku's permutation, being the length of both meteor outbursts at the same time. The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the sequence of colours in the first meteor outburst. The third line...
["1 2 5 4 3", "5 4 2 3 1", "1 2 3 4"]
#include <stdio.h> int main() { int a, b, c, d, e, f; int ZA[1001], ZB[1001]; scanf("%d", &a); for (b = 1; b <= a; ++b) ZB[b] = 0; c = 0; for (b = 1; b <= a; ++b) { scanf("%d", &ZA[b]); if (ZB[ZA[b]] == 1) { c = b; } else ZB[ZA[b]] = 1; } for (d = 1; d < c; ++d) if (ZA[d] == ZA[c]) break; fo...
Sengoku still remembers the mysterious "colourful meteoroids" she discovered with Lala-chan when they were little. In particular, one of the nights impressed her deeply, giving her the illusion that all her fancies would be realized.On that night, Sengoku constructed a permutation p1, p2, ..., pn of integers from 1 to ...
Output n space-separated integers p1, p2, ..., pn, denoting a possible permutation Sengoku could have had. If there are more than one possible answer, output any one of them. Input guarantees that such permutation exists.
C
6fc3da19da8d9ab024cdd5acfc4f4164
2a3da1757f8eddb9f09834cf30a75353
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms" ]
1496837700
["5\n1 2 3 4 3\n1 2 5 4 5", "5\n4 4 2 3 1\n5 4 5 3 1", "4\n1 1 3 4\n1 4 3 4"]
NoteIn the first sample, both 1, 2, 5, 4, 3 and 1, 2, 3, 4, 5 are acceptable outputs.In the second sample, 5, 4, 2, 3, 1 is the only permutation to satisfy the constraints.
PASSED
1,300
standard input
1 second
The first line of input contains a positive integer n (2 ≤ n ≤ 1 000) — the length of Sengoku's permutation, being the length of both meteor outbursts at the same time. The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the sequence of colours in the first meteor outburst. The third line...
["1 2 5 4 3", "5 4 2 3 1", "1 2 3 4"]
#include<stdio.h> int main() { int n; scanf("%d",&n); int a[n],b[n]; for(int i=0;i<n;i++) scanf("%d",&a[i]); for(int i=0;i<n;i++) scanf("%d",&b[i]); int count=0,ele[2],k=0,freq[n]; for(int i=0;i<n;i++) freq[i]=0; for(int i=0;i<n;i++) { if(a[i]!=b[i]) { count++; ele[k++]=i; } else freq[a[i]-1...
Sengoku still remembers the mysterious "colourful meteoroids" she discovered with Lala-chan when they were little. In particular, one of the nights impressed her deeply, giving her the illusion that all her fancies would be realized.On that night, Sengoku constructed a permutation p1, p2, ..., pn of integers from 1 to ...
Output n space-separated integers p1, p2, ..., pn, denoting a possible permutation Sengoku could have had. If there are more than one possible answer, output any one of them. Input guarantees that such permutation exists.
C
6fc3da19da8d9ab024cdd5acfc4f4164
41e28e3423461388160bfe10467fb05f
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms" ]
1496837700
["5\n1 2 3 4 3\n1 2 5 4 5", "5\n4 4 2 3 1\n5 4 5 3 1", "4\n1 1 3 4\n1 4 3 4"]
NoteIn the first sample, both 1, 2, 5, 4, 3 and 1, 2, 3, 4, 5 are acceptable outputs.In the second sample, 5, 4, 2, 3, 1 is the only permutation to satisfy the constraints.
PASSED
1,300
standard input
1 second
The first line of input contains a positive integer n (2 ≤ n ≤ 1 000) — the length of Sengoku's permutation, being the length of both meteor outbursts at the same time. The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the sequence of colours in the first meteor outburst. The third line...
["1 2 5 4 3", "5 4 2 3 1", "1 2 3 4"]
#include <stdio.h> #include <stdbool.h> #define MAXN 1000 int main() { int n, a[MAXN], b[MAXN], p[MAXN] = {0}, diff[2], cnt = 0; bool used[MAXN+1] = {false}; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", &a[i]); for (int i = 0; i < n; i++) scanf("%d", &b[i]); for (int...
The length of the longest common prefix of two strings $$$s = s_1 s_2 \ldots s_n$$$ and $$$t = t_1 t_2 \ldots t_m$$$ is defined as the maximum integer $$$k$$$ ($$$0 \le k \le min(n,m)$$$) such that $$$s_1 s_2 \ldots s_k$$$ equals $$$t_1 t_2 \ldots t_k$$$.Koa the Koala initially has $$$n+1$$$ strings $$$s_1, s_2, \dots,...
For each test case: Output $$$n+1$$$ lines. In the $$$i$$$-th line print string $$$s_i$$$ ($$$1 \le |s_i| \le 200$$$), consisting of lowercase Latin letters. Length of the longest common prefix of strings $$$s_i$$$ and $$$s_{i+1}$$$ has to be equal to $$$a_i$$$. If there are many answers print any. We can show that ans...
C
6983823efdc512f8759203460cd6bb4c
581e69682cce89327228be83a0c30526
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "strings" ]
1595601300
["4\n4\n1 2 4 2\n2\n5 3\n3\n1 3 1\n3\n0 0 0"]
NoteIn the $$$1$$$-st test case one of the possible answers is $$$s = [aeren, ari, arousal, around, ari]$$$.Lengths of longest common prefixes are: Between $$$\color{red}{a}eren$$$ and $$$\color{red}{a}ri$$$ $$$\rightarrow 1$$$ Between $$$\color{red}{ar}i$$$ and $$$\color{red}{ar}ousal$$$ $$$\rightarrow 2$$$ Between...
PASSED
1,200
standard input
1 second
Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the list $$$a$$$. The second line of e...
["aeren\nari\narousal\naround\nari\nmonogon\nmonogamy\nmonthly\nkevinvu\nkuroni\nkurioni\nkorone\nanton\nloves\nadhoc\nproblems"]
#include<stdio.h> #include<stdlib.h> int main() { int t,n,i,a[110],temp,j; char a1[210],a2[210]; scanf("%d",&t); while(t--) { scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&a[i]); } a1[0]='a'; for(i=1;i<200;i++) { a1[i]=a1[i-1]; } for(j=0;j<n;j++) { temp=a[j]; for(i=0;i<temp;i++) ...
The length of the longest common prefix of two strings $$$s = s_1 s_2 \ldots s_n$$$ and $$$t = t_1 t_2 \ldots t_m$$$ is defined as the maximum integer $$$k$$$ ($$$0 \le k \le min(n,m)$$$) such that $$$s_1 s_2 \ldots s_k$$$ equals $$$t_1 t_2 \ldots t_k$$$.Koa the Koala initially has $$$n+1$$$ strings $$$s_1, s_2, \dots,...
For each test case: Output $$$n+1$$$ lines. In the $$$i$$$-th line print string $$$s_i$$$ ($$$1 \le |s_i| \le 200$$$), consisting of lowercase Latin letters. Length of the longest common prefix of strings $$$s_i$$$ and $$$s_{i+1}$$$ has to be equal to $$$a_i$$$. If there are many answers print any. We can show that ans...
C
6983823efdc512f8759203460cd6bb4c
f3b9fde16964b9fa75619956dd9cdbf8
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "strings" ]
1595601300
["4\n4\n1 2 4 2\n2\n5 3\n3\n1 3 1\n3\n0 0 0"]
NoteIn the $$$1$$$-st test case one of the possible answers is $$$s = [aeren, ari, arousal, around, ari]$$$.Lengths of longest common prefixes are: Between $$$\color{red}{a}eren$$$ and $$$\color{red}{a}ri$$$ $$$\rightarrow 1$$$ Between $$$\color{red}{ar}i$$$ and $$$\color{red}{ar}ousal$$$ $$$\rightarrow 2$$$ Between...
PASSED
1,200
standard input
1 second
Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the list $$$a$$$. The second line of e...
["aeren\nari\narousal\naround\nari\nmonogon\nmonogamy\nmonthly\nkevinvu\nkuroni\nkurioni\nkorone\nanton\nloves\nadhoc\nproblems"]
#include<stdio.h> int main(){ int t,n,i,j; char s[100]; scanf("%d",&t); while(t--){ scanf("%d",&n); int a[n]; for(i=0;i<n;i++){ scanf("%d",&a[i]); } for(i=0;i<26;i++){ s[i]='a'+i; } for(i=26;i<52;i++){ s[i...
The length of the longest common prefix of two strings $$$s = s_1 s_2 \ldots s_n$$$ and $$$t = t_1 t_2 \ldots t_m$$$ is defined as the maximum integer $$$k$$$ ($$$0 \le k \le min(n,m)$$$) such that $$$s_1 s_2 \ldots s_k$$$ equals $$$t_1 t_2 \ldots t_k$$$.Koa the Koala initially has $$$n+1$$$ strings $$$s_1, s_2, \dots,...
For each test case: Output $$$n+1$$$ lines. In the $$$i$$$-th line print string $$$s_i$$$ ($$$1 \le |s_i| \le 200$$$), consisting of lowercase Latin letters. Length of the longest common prefix of strings $$$s_i$$$ and $$$s_{i+1}$$$ has to be equal to $$$a_i$$$. If there are many answers print any. We can show that ans...
C
6983823efdc512f8759203460cd6bb4c
5dfdfa6aed9da5ef2df1a6cc714aa197
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "strings" ]
1595601300
["4\n4\n1 2 4 2\n2\n5 3\n3\n1 3 1\n3\n0 0 0"]
NoteIn the $$$1$$$-st test case one of the possible answers is $$$s = [aeren, ari, arousal, around, ari]$$$.Lengths of longest common prefixes are: Between $$$\color{red}{a}eren$$$ and $$$\color{red}{a}ri$$$ $$$\rightarrow 1$$$ Between $$$\color{red}{ar}i$$$ and $$$\color{red}{ar}ousal$$$ $$$\rightarrow 2$$$ Between...
PASSED
1,200
standard input
1 second
Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the list $$$a$$$. The second line of e...
["aeren\nari\narousal\naround\nari\nmonogon\nmonogamy\nmonthly\nkevinvu\nkuroni\nkurioni\nkorone\nanton\nloves\nadhoc\nproblems"]
#include <stdio.h> int main(int argc, char *argv[]) { int tc; scanf("%d",&tc); while(tc--){ int n,a[300]={0},i,j,flip=1,len; char ch[205]; scanf("%d",&n); for(i=1;i<=n;i++) scanf("%d",&a[i]); for(i=0;i<200;i++) ch[i]='a'; ch[i]='\0'; printf("%s\n",ch); for(i=1;i<=n;i++){ if(ch[a[i]]=='a') ...
The length of the longest common prefix of two strings $$$s = s_1 s_2 \ldots s_n$$$ and $$$t = t_1 t_2 \ldots t_m$$$ is defined as the maximum integer $$$k$$$ ($$$0 \le k \le min(n,m)$$$) such that $$$s_1 s_2 \ldots s_k$$$ equals $$$t_1 t_2 \ldots t_k$$$.Koa the Koala initially has $$$n+1$$$ strings $$$s_1, s_2, \dots,...
For each test case: Output $$$n+1$$$ lines. In the $$$i$$$-th line print string $$$s_i$$$ ($$$1 \le |s_i| \le 200$$$), consisting of lowercase Latin letters. Length of the longest common prefix of strings $$$s_i$$$ and $$$s_{i+1}$$$ has to be equal to $$$a_i$$$. If there are many answers print any. We can show that ans...
C
6983823efdc512f8759203460cd6bb4c
e78d46c5f99d7820f38c7495bdb7abbf
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "strings" ]
1595601300
["4\n4\n1 2 4 2\n2\n5 3\n3\n1 3 1\n3\n0 0 0"]
NoteIn the $$$1$$$-st test case one of the possible answers is $$$s = [aeren, ari, arousal, around, ari]$$$.Lengths of longest common prefixes are: Between $$$\color{red}{a}eren$$$ and $$$\color{red}{a}ri$$$ $$$\rightarrow 1$$$ Between $$$\color{red}{ar}i$$$ and $$$\color{red}{ar}ousal$$$ $$$\rightarrow 2$$$ Between...
PASSED
1,200
standard input
1 second
Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the list $$$a$$$. The second line of e...
["aeren\nari\narousal\naround\nari\nmonogon\nmonogamy\nmonthly\nkevinvu\nkuroni\nkurioni\nkorone\nanton\nloves\nadhoc\nproblems"]
#include<stdio.h> #include<string.h> int main() { int t; scanf("%d",&t); while(t--) { int n,max=0; scanf("%d",&n); int a[n],k=98; for(int i=0;i<n;i++) { scanf("%d",&a[i]); if(a[i]>max) max=a[i]; } char f[max]; if(max==0) { for(int i=0;i<=n;i++) {if(k>122) k=98; printf("%...
The length of the longest common prefix of two strings $$$s = s_1 s_2 \ldots s_n$$$ and $$$t = t_1 t_2 \ldots t_m$$$ is defined as the maximum integer $$$k$$$ ($$$0 \le k \le min(n,m)$$$) such that $$$s_1 s_2 \ldots s_k$$$ equals $$$t_1 t_2 \ldots t_k$$$.Koa the Koala initially has $$$n+1$$$ strings $$$s_1, s_2, \dots,...
For each test case: Output $$$n+1$$$ lines. In the $$$i$$$-th line print string $$$s_i$$$ ($$$1 \le |s_i| \le 200$$$), consisting of lowercase Latin letters. Length of the longest common prefix of strings $$$s_i$$$ and $$$s_{i+1}$$$ has to be equal to $$$a_i$$$. If there are many answers print any. We can show that ans...
C
6983823efdc512f8759203460cd6bb4c
86bbe2e00efba2de842907bec8d70446
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "strings" ]
1595601300
["4\n4\n1 2 4 2\n2\n5 3\n3\n1 3 1\n3\n0 0 0"]
NoteIn the $$$1$$$-st test case one of the possible answers is $$$s = [aeren, ari, arousal, around, ari]$$$.Lengths of longest common prefixes are: Between $$$\color{red}{a}eren$$$ and $$$\color{red}{a}ri$$$ $$$\rightarrow 1$$$ Between $$$\color{red}{ar}i$$$ and $$$\color{red}{ar}ousal$$$ $$$\rightarrow 2$$$ Between...
PASSED
1,200
standard input
1 second
Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the list $$$a$$$. The second line of e...
["aeren\nari\narousal\naround\nari\nmonogon\nmonogamy\nmonthly\nkevinvu\nkuroni\nkurioni\nkorone\nanton\nloves\nadhoc\nproblems"]
#include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX 101 int n; int pre[MAX]; char str[MAX+1]; void solve(void){ for(int i = 0; i < MAX; i++){ str[i] = 'a'; } str[MAX] = '\0'; scanf("%d", &n); for(int i = 0; i < n; i++){ scanf("%d", &pre[i]); } printf("%s\n", str); for(int i = 0; i...
The length of the longest common prefix of two strings $$$s = s_1 s_2 \ldots s_n$$$ and $$$t = t_1 t_2 \ldots t_m$$$ is defined as the maximum integer $$$k$$$ ($$$0 \le k \le min(n,m)$$$) such that $$$s_1 s_2 \ldots s_k$$$ equals $$$t_1 t_2 \ldots t_k$$$.Koa the Koala initially has $$$n+1$$$ strings $$$s_1, s_2, \dots,...
For each test case: Output $$$n+1$$$ lines. In the $$$i$$$-th line print string $$$s_i$$$ ($$$1 \le |s_i| \le 200$$$), consisting of lowercase Latin letters. Length of the longest common prefix of strings $$$s_i$$$ and $$$s_{i+1}$$$ has to be equal to $$$a_i$$$. If there are many answers print any. We can show that ans...
C
6983823efdc512f8759203460cd6bb4c
375f223643626b3a6fa489146063364a
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "strings" ]
1595601300
["4\n4\n1 2 4 2\n2\n5 3\n3\n1 3 1\n3\n0 0 0"]
NoteIn the $$$1$$$-st test case one of the possible answers is $$$s = [aeren, ari, arousal, around, ari]$$$.Lengths of longest common prefixes are: Between $$$\color{red}{a}eren$$$ and $$$\color{red}{a}ri$$$ $$$\rightarrow 1$$$ Between $$$\color{red}{ar}i$$$ and $$$\color{red}{ar}ousal$$$ $$$\rightarrow 2$$$ Between...
PASSED
1,200
standard input
1 second
Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the list $$$a$$$. The second line of e...
["aeren\nari\narousal\naround\nari\nmonogon\nmonogamy\nmonthly\nkevinvu\nkuroni\nkurioni\nkorone\nanton\nloves\nadhoc\nproblems"]
#include <stdio.h> int main () { int t,n,i; scanf("%d", &t); while(t--) { scanf("%d", &n); int arr[n+5]; char output[205] = "ilovemyselfcauseihatemyselfcauseilovemyselfcauseihatemyself"; for(i=0;i<n;i++) { scanf("%d", &arr[i]); } printf("%s\n", o...
The length of the longest common prefix of two strings $$$s = s_1 s_2 \ldots s_n$$$ and $$$t = t_1 t_2 \ldots t_m$$$ is defined as the maximum integer $$$k$$$ ($$$0 \le k \le min(n,m)$$$) such that $$$s_1 s_2 \ldots s_k$$$ equals $$$t_1 t_2 \ldots t_k$$$.Koa the Koala initially has $$$n+1$$$ strings $$$s_1, s_2, \dots,...
For each test case: Output $$$n+1$$$ lines. In the $$$i$$$-th line print string $$$s_i$$$ ($$$1 \le |s_i| \le 200$$$), consisting of lowercase Latin letters. Length of the longest common prefix of strings $$$s_i$$$ and $$$s_{i+1}$$$ has to be equal to $$$a_i$$$. If there are many answers print any. We can show that ans...
C
6983823efdc512f8759203460cd6bb4c
3a18af449120a28480226c60a92e0480
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "strings" ]
1595601300
["4\n4\n1 2 4 2\n2\n5 3\n3\n1 3 1\n3\n0 0 0"]
NoteIn the $$$1$$$-st test case one of the possible answers is $$$s = [aeren, ari, arousal, around, ari]$$$.Lengths of longest common prefixes are: Between $$$\color{red}{a}eren$$$ and $$$\color{red}{a}ri$$$ $$$\rightarrow 1$$$ Between $$$\color{red}{ar}i$$$ and $$$\color{red}{ar}ousal$$$ $$$\rightarrow 2$$$ Between...
PASSED
1,200
standard input
1 second
Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the list $$$a$$$. The second line of e...
["aeren\nari\narousal\naround\nari\nmonogon\nmonogamy\nmonthly\nkevinvu\nkuroni\nkurioni\nkorone\nanton\nloves\nadhoc\nproblems"]
#include <stdio.h> int sl; char s[100007]; int max(int a,int b) { return a > b? a: b; } int main() { int t; scanf("%d", &t); while (t--) { int n; scanf("%d", &n); int minl = 0, prel = 0; for (int i = 0, a; i < n; i ++) { scanf("%d", &a); int tl = max(1, max(minl, a)); for (int...
The length of the longest common prefix of two strings $$$s = s_1 s_2 \ldots s_n$$$ and $$$t = t_1 t_2 \ldots t_m$$$ is defined as the maximum integer $$$k$$$ ($$$0 \le k \le min(n,m)$$$) such that $$$s_1 s_2 \ldots s_k$$$ equals $$$t_1 t_2 \ldots t_k$$$.Koa the Koala initially has $$$n+1$$$ strings $$$s_1, s_2, \dots,...
For each test case: Output $$$n+1$$$ lines. In the $$$i$$$-th line print string $$$s_i$$$ ($$$1 \le |s_i| \le 200$$$), consisting of lowercase Latin letters. Length of the longest common prefix of strings $$$s_i$$$ and $$$s_{i+1}$$$ has to be equal to $$$a_i$$$. If there are many answers print any. We can show that ans...
C
6983823efdc512f8759203460cd6bb4c
f6b99020055db157603ed6cea5fdef39
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "strings" ]
1595601300
["4\n4\n1 2 4 2\n2\n5 3\n3\n1 3 1\n3\n0 0 0"]
NoteIn the $$$1$$$-st test case one of the possible answers is $$$s = [aeren, ari, arousal, around, ari]$$$.Lengths of longest common prefixes are: Between $$$\color{red}{a}eren$$$ and $$$\color{red}{a}ri$$$ $$$\rightarrow 1$$$ Between $$$\color{red}{ar}i$$$ and $$$\color{red}{ar}ousal$$$ $$$\rightarrow 2$$$ Between...
PASSED
1,200
standard input
1 second
Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the list $$$a$$$. The second line of e...
["aeren\nari\narousal\naround\nari\nmonogon\nmonogamy\nmonthly\nkevinvu\nkuroni\nkurioni\nkorone\nanton\nloves\nadhoc\nproblems"]
#include<stdio.h> #include<string.h> #include<stdlib.h> #include<math.h> int main() { int t; scanf("%d",&t); for(int q=0;q<t;q++) { int n,i,j,max=0; scanf("%d",&n); int arr[n]; for(i=0;i<n;i++) { scanf("%d",&arr[i]); if(arr[i]>max) ...
The length of the longest common prefix of two strings $$$s = s_1 s_2 \ldots s_n$$$ and $$$t = t_1 t_2 \ldots t_m$$$ is defined as the maximum integer $$$k$$$ ($$$0 \le k \le min(n,m)$$$) such that $$$s_1 s_2 \ldots s_k$$$ equals $$$t_1 t_2 \ldots t_k$$$.Koa the Koala initially has $$$n+1$$$ strings $$$s_1, s_2, \dots,...
For each test case: Output $$$n+1$$$ lines. In the $$$i$$$-th line print string $$$s_i$$$ ($$$1 \le |s_i| \le 200$$$), consisting of lowercase Latin letters. Length of the longest common prefix of strings $$$s_i$$$ and $$$s_{i+1}$$$ has to be equal to $$$a_i$$$. If there are many answers print any. We can show that ans...
C
6983823efdc512f8759203460cd6bb4c
79b43ac5602bc102fd7f0fc69575e1be
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "strings" ]
1595601300
["4\n4\n1 2 4 2\n2\n5 3\n3\n1 3 1\n3\n0 0 0"]
NoteIn the $$$1$$$-st test case one of the possible answers is $$$s = [aeren, ari, arousal, around, ari]$$$.Lengths of longest common prefixes are: Between $$$\color{red}{a}eren$$$ and $$$\color{red}{a}ri$$$ $$$\rightarrow 1$$$ Between $$$\color{red}{ar}i$$$ and $$$\color{red}{ar}ousal$$$ $$$\rightarrow 2$$$ Between...
PASSED
1,200
standard input
1 second
Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the list $$$a$$$. The second line of e...
["aeren\nari\narousal\naround\nari\nmonogon\nmonogamy\nmonthly\nkevinvu\nkuroni\nkurioni\nkorone\nanton\nloves\nadhoc\nproblems"]
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(){ int t; scanf("%d", &t); while(t--){ int n; int *a; scanf("%d", &n); a = malloc(sizeof(int) * n); char s[n + 1][201]; for(int i = 0; i < n; i++){ scanf("%d", a + i); ...
The length of the longest common prefix of two strings $$$s = s_1 s_2 \ldots s_n$$$ and $$$t = t_1 t_2 \ldots t_m$$$ is defined as the maximum integer $$$k$$$ ($$$0 \le k \le min(n,m)$$$) such that $$$s_1 s_2 \ldots s_k$$$ equals $$$t_1 t_2 \ldots t_k$$$.Koa the Koala initially has $$$n+1$$$ strings $$$s_1, s_2, \dots,...
For each test case: Output $$$n+1$$$ lines. In the $$$i$$$-th line print string $$$s_i$$$ ($$$1 \le |s_i| \le 200$$$), consisting of lowercase Latin letters. Length of the longest common prefix of strings $$$s_i$$$ and $$$s_{i+1}$$$ has to be equal to $$$a_i$$$. If there are many answers print any. We can show that ans...
C
6983823efdc512f8759203460cd6bb4c
d7b69a6fb2be9b038871e1a8ee60bf93
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "strings" ]
1595601300
["4\n4\n1 2 4 2\n2\n5 3\n3\n1 3 1\n3\n0 0 0"]
NoteIn the $$$1$$$-st test case one of the possible answers is $$$s = [aeren, ari, arousal, around, ari]$$$.Lengths of longest common prefixes are: Between $$$\color{red}{a}eren$$$ and $$$\color{red}{a}ri$$$ $$$\rightarrow 1$$$ Between $$$\color{red}{ar}i$$$ and $$$\color{red}{ar}ousal$$$ $$$\rightarrow 2$$$ Between...
PASSED
1,200
standard input
1 second
Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the list $$$a$$$. The second line of e...
["aeren\nari\narousal\naround\nari\nmonogon\nmonogamy\nmonthly\nkevinvu\nkuroni\nkurioni\nkorone\nanton\nloves\nadhoc\nproblems"]
char s[52]={[0 ...51]=98};main(n,x){for(scanf("%*d");~scanf("%d",&n);)for(puts(s);n--;puts(s))scanf("%d",&x),s[x]^=1;}
The length of the longest common prefix of two strings $$$s = s_1 s_2 \ldots s_n$$$ and $$$t = t_1 t_2 \ldots t_m$$$ is defined as the maximum integer $$$k$$$ ($$$0 \le k \le min(n,m)$$$) such that $$$s_1 s_2 \ldots s_k$$$ equals $$$t_1 t_2 \ldots t_k$$$.Koa the Koala initially has $$$n+1$$$ strings $$$s_1, s_2, \dots,...
For each test case: Output $$$n+1$$$ lines. In the $$$i$$$-th line print string $$$s_i$$$ ($$$1 \le |s_i| \le 200$$$), consisting of lowercase Latin letters. Length of the longest common prefix of strings $$$s_i$$$ and $$$s_{i+1}$$$ has to be equal to $$$a_i$$$. If there are many answers print any. We can show that ans...
C
6983823efdc512f8759203460cd6bb4c
ade2995ab749210db5b05ec02c0478bd
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "strings" ]
1595601300
["4\n4\n1 2 4 2\n2\n5 3\n3\n1 3 1\n3\n0 0 0"]
NoteIn the $$$1$$$-st test case one of the possible answers is $$$s = [aeren, ari, arousal, around, ari]$$$.Lengths of longest common prefixes are: Between $$$\color{red}{a}eren$$$ and $$$\color{red}{a}ri$$$ $$$\rightarrow 1$$$ Between $$$\color{red}{ar}i$$$ and $$$\color{red}{ar}ousal$$$ $$$\rightarrow 2$$$ Between...
PASSED
1,200
standard input
1 second
Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the list $$$a$$$. The second line of e...
["aeren\nari\narousal\naround\nari\nmonogon\nmonogamy\nmonthly\nkevinvu\nkuroni\nkurioni\nkorone\nanton\nloves\nadhoc\nproblems"]
//Common prefixes(Incomplete) #include<stdio.h> #include<string.h> int main() { int t,n,i,j,ara[103]; char str[203]; scanf("%d",&t); while(t--) { scanf("%d",&n); for(i=0;i<n;i++) scanf("%d",&ara[i]); for(i=0;i<200;i++) str[i]='a'; for(i=0;i<200...
The length of the longest common prefix of two strings $$$s = s_1 s_2 \ldots s_n$$$ and $$$t = t_1 t_2 \ldots t_m$$$ is defined as the maximum integer $$$k$$$ ($$$0 \le k \le min(n,m)$$$) such that $$$s_1 s_2 \ldots s_k$$$ equals $$$t_1 t_2 \ldots t_k$$$.Koa the Koala initially has $$$n+1$$$ strings $$$s_1, s_2, \dots,...
For each test case: Output $$$n+1$$$ lines. In the $$$i$$$-th line print string $$$s_i$$$ ($$$1 \le |s_i| \le 200$$$), consisting of lowercase Latin letters. Length of the longest common prefix of strings $$$s_i$$$ and $$$s_{i+1}$$$ has to be equal to $$$a_i$$$. If there are many answers print any. We can show that ans...
C
6983823efdc512f8759203460cd6bb4c
e5d977aa1631efe0a13f350427a6e735
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "strings" ]
1595601300
["4\n4\n1 2 4 2\n2\n5 3\n3\n1 3 1\n3\n0 0 0"]
NoteIn the $$$1$$$-st test case one of the possible answers is $$$s = [aeren, ari, arousal, around, ari]$$$.Lengths of longest common prefixes are: Between $$$\color{red}{a}eren$$$ and $$$\color{red}{a}ri$$$ $$$\rightarrow 1$$$ Between $$$\color{red}{ar}i$$$ and $$$\color{red}{ar}ousal$$$ $$$\rightarrow 2$$$ Between...
PASSED
1,200
standard input
1 second
Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the list $$$a$$$. The second line of e...
["aeren\nari\narousal\naround\nari\nmonogon\nmonogamy\nmonthly\nkevinvu\nkuroni\nkurioni\nkorone\nanton\nloves\nadhoc\nproblems"]
#include<stdio.h> int main() { int t ; scanf("%d",&t); while (t--){ int n ; scanf("%d",&n); int a[n ], i , j , max =1 ; for(i=0 ; i<n ; i++){ scanf("%d",&a[i]); if (a[i]>max){ max=a[i] ; } } int s[n+1][52] ; ...
The length of the longest common prefix of two strings $$$s = s_1 s_2 \ldots s_n$$$ and $$$t = t_1 t_2 \ldots t_m$$$ is defined as the maximum integer $$$k$$$ ($$$0 \le k \le min(n,m)$$$) such that $$$s_1 s_2 \ldots s_k$$$ equals $$$t_1 t_2 \ldots t_k$$$.Koa the Koala initially has $$$n+1$$$ strings $$$s_1, s_2, \dots,...
For each test case: Output $$$n+1$$$ lines. In the $$$i$$$-th line print string $$$s_i$$$ ($$$1 \le |s_i| \le 200$$$), consisting of lowercase Latin letters. Length of the longest common prefix of strings $$$s_i$$$ and $$$s_{i+1}$$$ has to be equal to $$$a_i$$$. If there are many answers print any. We can show that ans...
C
6983823efdc512f8759203460cd6bb4c
1aa0e3980b971a2e6b12af6ffef605dd
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "strings" ]
1595601300
["4\n4\n1 2 4 2\n2\n5 3\n3\n1 3 1\n3\n0 0 0"]
NoteIn the $$$1$$$-st test case one of the possible answers is $$$s = [aeren, ari, arousal, around, ari]$$$.Lengths of longest common prefixes are: Between $$$\color{red}{a}eren$$$ and $$$\color{red}{a}ri$$$ $$$\rightarrow 1$$$ Between $$$\color{red}{ar}i$$$ and $$$\color{red}{ar}ousal$$$ $$$\rightarrow 2$$$ Between...
PASSED
1,200
standard input
1 second
Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the list $$$a$$$. The second line of e...
["aeren\nari\narousal\naround\nari\nmonogon\nmonogamy\nmonthly\nkevinvu\nkuroni\nkurioni\nkorone\nanton\nloves\nadhoc\nproblems"]
#include <stdio.h> int main() { int n, i, x[101], t, max; char b[55]; scanf("%d", &t); while(t--) { for(i=0;i<=51;i++) b[i]='a'; scanf("%d", &n); max=0; for(i=0;i<n;i++) { scanf("%d", &x[i]); if(x[i]>max) max=x[i]; } b[m...
The length of the longest common prefix of two strings $$$s = s_1 s_2 \ldots s_n$$$ and $$$t = t_1 t_2 \ldots t_m$$$ is defined as the maximum integer $$$k$$$ ($$$0 \le k \le min(n,m)$$$) such that $$$s_1 s_2 \ldots s_k$$$ equals $$$t_1 t_2 \ldots t_k$$$.Koa the Koala initially has $$$n+1$$$ strings $$$s_1, s_2, \dots,...
For each test case: Output $$$n+1$$$ lines. In the $$$i$$$-th line print string $$$s_i$$$ ($$$1 \le |s_i| \le 200$$$), consisting of lowercase Latin letters. Length of the longest common prefix of strings $$$s_i$$$ and $$$s_{i+1}$$$ has to be equal to $$$a_i$$$. If there are many answers print any. We can show that ans...
C
6983823efdc512f8759203460cd6bb4c
7b9a058718d191059549dd4161933d28
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "strings" ]
1595601300
["4\n4\n1 2 4 2\n2\n5 3\n3\n1 3 1\n3\n0 0 0"]
NoteIn the $$$1$$$-st test case one of the possible answers is $$$s = [aeren, ari, arousal, around, ari]$$$.Lengths of longest common prefixes are: Between $$$\color{red}{a}eren$$$ and $$$\color{red}{a}ri$$$ $$$\rightarrow 1$$$ Between $$$\color{red}{ar}i$$$ and $$$\color{red}{ar}ousal$$$ $$$\rightarrow 2$$$ Between...
PASSED
1,200
standard input
1 second
Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the list $$$a$$$. The second line of e...
["aeren\nari\narousal\naround\nari\nmonogon\nmonogamy\nmonthly\nkevinvu\nkuroni\nkurioni\nkorone\nanton\nloves\nadhoc\nproblems"]
#include <stdio.h> #include <memory.h> int main(void){ int T, n, i, j, flag, arr[101]; char str[101][201]; scanf("%d", &T); while(T--){ scanf("%d", &n); flag='a'; for(i=1; i<=n; ++i){ scanf("%d", arr+i); } for(i=0; i<=60; ++i){ str[0][i]=flag; ++flag; if(flag>'z'){ flag='a'; ...
The length of the longest common prefix of two strings $$$s = s_1 s_2 \ldots s_n$$$ and $$$t = t_1 t_2 \ldots t_m$$$ is defined as the maximum integer $$$k$$$ ($$$0 \le k \le min(n,m)$$$) such that $$$s_1 s_2 \ldots s_k$$$ equals $$$t_1 t_2 \ldots t_k$$$.Koa the Koala initially has $$$n+1$$$ strings $$$s_1, s_2, \dots,...
For each test case: Output $$$n+1$$$ lines. In the $$$i$$$-th line print string $$$s_i$$$ ($$$1 \le |s_i| \le 200$$$), consisting of lowercase Latin letters. Length of the longest common prefix of strings $$$s_i$$$ and $$$s_{i+1}$$$ has to be equal to $$$a_i$$$. If there are many answers print any. We can show that ans...
C
6983823efdc512f8759203460cd6bb4c
1eaf32831d7be11ac7e378b6b4edc4b1
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "strings" ]
1595601300
["4\n4\n1 2 4 2\n2\n5 3\n3\n1 3 1\n3\n0 0 0"]
NoteIn the $$$1$$$-st test case one of the possible answers is $$$s = [aeren, ari, arousal, around, ari]$$$.Lengths of longest common prefixes are: Between $$$\color{red}{a}eren$$$ and $$$\color{red}{a}ri$$$ $$$\rightarrow 1$$$ Between $$$\color{red}{ar}i$$$ and $$$\color{red}{ar}ousal$$$ $$$\rightarrow 2$$$ Between...
PASSED
1,200
standard input
1 second
Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the list $$$a$$$. The second line of e...
["aeren\nari\narousal\naround\nari\nmonogon\nmonogamy\nmonthly\nkevinvu\nkuroni\nkurioni\nkorone\nanton\nloves\nadhoc\nproblems"]
#include<stdio.h> #include<stdlib.h> #include<math.h> int comparefunc (const void * a, const void * b) { return (*(long long int*)a)-(*(long long int*)b); } int main() { int i,j,m,n,t; scanf("%d", &t); for(i=0;i<t;i++){ scanf("%d", &n); int a[n]; char str[200]; for(j=0;j<...
The length of the longest common prefix of two strings $$$s = s_1 s_2 \ldots s_n$$$ and $$$t = t_1 t_2 \ldots t_m$$$ is defined as the maximum integer $$$k$$$ ($$$0 \le k \le min(n,m)$$$) such that $$$s_1 s_2 \ldots s_k$$$ equals $$$t_1 t_2 \ldots t_k$$$.Koa the Koala initially has $$$n+1$$$ strings $$$s_1, s_2, \dots,...
For each test case: Output $$$n+1$$$ lines. In the $$$i$$$-th line print string $$$s_i$$$ ($$$1 \le |s_i| \le 200$$$), consisting of lowercase Latin letters. Length of the longest common prefix of strings $$$s_i$$$ and $$$s_{i+1}$$$ has to be equal to $$$a_i$$$. If there are many answers print any. We can show that ans...
C
6983823efdc512f8759203460cd6bb4c
b7c0960f73bc6f324c2a1b51a18532aa
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "strings" ]
1595601300
["4\n4\n1 2 4 2\n2\n5 3\n3\n1 3 1\n3\n0 0 0"]
NoteIn the $$$1$$$-st test case one of the possible answers is $$$s = [aeren, ari, arousal, around, ari]$$$.Lengths of longest common prefixes are: Between $$$\color{red}{a}eren$$$ and $$$\color{red}{a}ri$$$ $$$\rightarrow 1$$$ Between $$$\color{red}{ar}i$$$ and $$$\color{red}{ar}ousal$$$ $$$\rightarrow 2$$$ Between...
PASSED
1,200
standard input
1 second
Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the list $$$a$$$. The second line of e...
["aeren\nari\narousal\naround\nari\nmonogon\nmonogamy\nmonthly\nkevinvu\nkuroni\nkurioni\nkorone\nanton\nloves\nadhoc\nproblems"]
#include<stdio.h> int main() { int t; scanf("%d",&t); while(t--) { int n; scanf("%d",&n); int i,j,a[n]; for(i=0;i<n;i++) { scanf("%d ",&a[i]); } char s[100]; for(i=0;i<26;i++) { s[i]='a'+i; } ...
The length of the longest common prefix of two strings $$$s = s_1 s_2 \ldots s_n$$$ and $$$t = t_1 t_2 \ldots t_m$$$ is defined as the maximum integer $$$k$$$ ($$$0 \le k \le min(n,m)$$$) such that $$$s_1 s_2 \ldots s_k$$$ equals $$$t_1 t_2 \ldots t_k$$$.Koa the Koala initially has $$$n+1$$$ strings $$$s_1, s_2, \dots,...
For each test case: Output $$$n+1$$$ lines. In the $$$i$$$-th line print string $$$s_i$$$ ($$$1 \le |s_i| \le 200$$$), consisting of lowercase Latin letters. Length of the longest common prefix of strings $$$s_i$$$ and $$$s_{i+1}$$$ has to be equal to $$$a_i$$$. If there are many answers print any. We can show that ans...
C
6983823efdc512f8759203460cd6bb4c
88e1ec138ad2fb0ca998a4ba0bf1f606
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "strings" ]
1595601300
["4\n4\n1 2 4 2\n2\n5 3\n3\n1 3 1\n3\n0 0 0"]
NoteIn the $$$1$$$-st test case one of the possible answers is $$$s = [aeren, ari, arousal, around, ari]$$$.Lengths of longest common prefixes are: Between $$$\color{red}{a}eren$$$ and $$$\color{red}{a}ri$$$ $$$\rightarrow 1$$$ Between $$$\color{red}{ar}i$$$ and $$$\color{red}{ar}ousal$$$ $$$\rightarrow 2$$$ Between...
PASSED
1,200
standard input
1 second
Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the list $$$a$$$. The second line of e...
["aeren\nari\narousal\naround\nari\nmonogon\nmonogamy\nmonthly\nkevinvu\nkuroni\nkurioni\nkorone\nanton\nloves\nadhoc\nproblems"]
#include <stdio.h> int main() { int t; scanf("%d",&t); while(t--) { int n; scanf("%d",&n); int a[n]; int i,j; for(i=0;i<n;i++) { scanf("%d ",&a[i]); } char s[100]="abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"; ...
The length of the longest common prefix of two strings $$$s = s_1 s_2 \ldots s_n$$$ and $$$t = t_1 t_2 \ldots t_m$$$ is defined as the maximum integer $$$k$$$ ($$$0 \le k \le min(n,m)$$$) such that $$$s_1 s_2 \ldots s_k$$$ equals $$$t_1 t_2 \ldots t_k$$$.Koa the Koala initially has $$$n+1$$$ strings $$$s_1, s_2, \dots,...
For each test case: Output $$$n+1$$$ lines. In the $$$i$$$-th line print string $$$s_i$$$ ($$$1 \le |s_i| \le 200$$$), consisting of lowercase Latin letters. Length of the longest common prefix of strings $$$s_i$$$ and $$$s_{i+1}$$$ has to be equal to $$$a_i$$$. If there are many answers print any. We can show that ans...
C
6983823efdc512f8759203460cd6bb4c
bdf5d6ec420e66cf3fc985de3ae30394
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "strings" ]
1595601300
["4\n4\n1 2 4 2\n2\n5 3\n3\n1 3 1\n3\n0 0 0"]
NoteIn the $$$1$$$-st test case one of the possible answers is $$$s = [aeren, ari, arousal, around, ari]$$$.Lengths of longest common prefixes are: Between $$$\color{red}{a}eren$$$ and $$$\color{red}{a}ri$$$ $$$\rightarrow 1$$$ Between $$$\color{red}{ar}i$$$ and $$$\color{red}{ar}ousal$$$ $$$\rightarrow 2$$$ Between...
PASSED
1,200
standard input
1 second
Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the list $$$a$$$. The second line of e...
["aeren\nari\narousal\naround\nari\nmonogon\nmonogamy\nmonthly\nkevinvu\nkuroni\nkurioni\nkorone\nanton\nloves\nadhoc\nproblems"]
#include<stdio.h> int main(){ int t,m; scanf("%d",&t); m=t; while(t--){ int an,i; scanf("%d",&an); int k[an]; for(i=0;i<an;i++){ scanf("%d",&k[i]); } char s[52]; s[51]='\0'; for(i=0;i<51;i++){ s[i]='a'; } printf("%s\n",s); for(i=0;i<an;i++){ if(s[k[i]]=='z')s[k[i]]='a'; else{ s...
The length of the longest common prefix of two strings $$$s = s_1 s_2 \ldots s_n$$$ and $$$t = t_1 t_2 \ldots t_m$$$ is defined as the maximum integer $$$k$$$ ($$$0 \le k \le min(n,m)$$$) such that $$$s_1 s_2 \ldots s_k$$$ equals $$$t_1 t_2 \ldots t_k$$$.Koa the Koala initially has $$$n+1$$$ strings $$$s_1, s_2, \dots,...
For each test case: Output $$$n+1$$$ lines. In the $$$i$$$-th line print string $$$s_i$$$ ($$$1 \le |s_i| \le 200$$$), consisting of lowercase Latin letters. Length of the longest common prefix of strings $$$s_i$$$ and $$$s_{i+1}$$$ has to be equal to $$$a_i$$$. If there are many answers print any. We can show that ans...
C
6983823efdc512f8759203460cd6bb4c
c18c96b9e80c34a422e02b0d2d622e7f
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "strings" ]
1595601300
["4\n4\n1 2 4 2\n2\n5 3\n3\n1 3 1\n3\n0 0 0"]
NoteIn the $$$1$$$-st test case one of the possible answers is $$$s = [aeren, ari, arousal, around, ari]$$$.Lengths of longest common prefixes are: Between $$$\color{red}{a}eren$$$ and $$$\color{red}{a}ri$$$ $$$\rightarrow 1$$$ Between $$$\color{red}{ar}i$$$ and $$$\color{red}{ar}ousal$$$ $$$\rightarrow 2$$$ Between...
PASSED
1,200
standard input
1 second
Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the list $$$a$$$. The second line of e...
["aeren\nari\narousal\naround\nari\nmonogon\nmonogamy\nmonthly\nkevinvu\nkuroni\nkurioni\nkorone\nanton\nloves\nadhoc\nproblems"]
#include<stdio.h> int main(){int t,n,i,j,k,a[155]; char c,s[260]; scanf("%d",&t); for(i=0;i<t;i++) { scanf("%d",&n); for(j=0;j<n;j++) { scanf("%d",&a[j]); } c='a'; for(j=0;j<200;j++) { s[j]=c; c++; if(c>1...
The length of the longest common prefix of two strings $$$s = s_1 s_2 \ldots s_n$$$ and $$$t = t_1 t_2 \ldots t_m$$$ is defined as the maximum integer $$$k$$$ ($$$0 \le k \le min(n,m)$$$) such that $$$s_1 s_2 \ldots s_k$$$ equals $$$t_1 t_2 \ldots t_k$$$.Koa the Koala initially has $$$n+1$$$ strings $$$s_1, s_2, \dots,...
For each test case: Output $$$n+1$$$ lines. In the $$$i$$$-th line print string $$$s_i$$$ ($$$1 \le |s_i| \le 200$$$), consisting of lowercase Latin letters. Length of the longest common prefix of strings $$$s_i$$$ and $$$s_{i+1}$$$ has to be equal to $$$a_i$$$. If there are many answers print any. We can show that ans...
C
6983823efdc512f8759203460cd6bb4c
d7a8100cce1bcf181b9a8e678d6a98de
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "strings" ]
1595601300
["4\n4\n1 2 4 2\n2\n5 3\n3\n1 3 1\n3\n0 0 0"]
NoteIn the $$$1$$$-st test case one of the possible answers is $$$s = [aeren, ari, arousal, around, ari]$$$.Lengths of longest common prefixes are: Between $$$\color{red}{a}eren$$$ and $$$\color{red}{a}ri$$$ $$$\rightarrow 1$$$ Between $$$\color{red}{ar}i$$$ and $$$\color{red}{ar}ousal$$$ $$$\rightarrow 2$$$ Between...
PASSED
1,200
standard input
1 second
Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the list $$$a$$$. The second line of e...
["aeren\nari\narousal\naround\nari\nmonogon\nmonogamy\nmonthly\nkevinvu\nkuroni\nkurioni\nkorone\nanton\nloves\nadhoc\nproblems"]
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> #include <stdbool.h> typedef long long LL; typedef long double Lf; #define Rep(i,a,n)for(int i=(int)(a);i<(int)(n);i++) //#define Rep(i,a,n)for(LL i=(LL)(a);i<(LL)(n);i++) #define rep(i,n)Rep(i,0,n) #define Repp(i,l,r,k)for(int i=(int)(l);i<(i...
The length of the longest common prefix of two strings $$$s = s_1 s_2 \ldots s_n$$$ and $$$t = t_1 t_2 \ldots t_m$$$ is defined as the maximum integer $$$k$$$ ($$$0 \le k \le min(n,m)$$$) such that $$$s_1 s_2 \ldots s_k$$$ equals $$$t_1 t_2 \ldots t_k$$$.Koa the Koala initially has $$$n+1$$$ strings $$$s_1, s_2, \dots,...
For each test case: Output $$$n+1$$$ lines. In the $$$i$$$-th line print string $$$s_i$$$ ($$$1 \le |s_i| \le 200$$$), consisting of lowercase Latin letters. Length of the longest common prefix of strings $$$s_i$$$ and $$$s_{i+1}$$$ has to be equal to $$$a_i$$$. If there are many answers print any. We can show that ans...
C
6983823efdc512f8759203460cd6bb4c
0022de4be277a20f59320d958b423cce
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "strings" ]
1595601300
["4\n4\n1 2 4 2\n2\n5 3\n3\n1 3 1\n3\n0 0 0"]
NoteIn the $$$1$$$-st test case one of the possible answers is $$$s = [aeren, ari, arousal, around, ari]$$$.Lengths of longest common prefixes are: Between $$$\color{red}{a}eren$$$ and $$$\color{red}{a}ri$$$ $$$\rightarrow 1$$$ Between $$$\color{red}{ar}i$$$ and $$$\color{red}{ar}ousal$$$ $$$\rightarrow 2$$$ Between...
PASSED
1,200
standard input
1 second
Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the list $$$a$$$. The second line of e...
["aeren\nari\narousal\naround\nari\nmonogon\nmonogamy\nmonthly\nkevinvu\nkuroni\nkurioni\nkorone\nanton\nloves\nadhoc\nproblems"]
#include<stdio.h> int main() { int t, n, arr[100], i, j, k, flag; char c[200], a, b, d; scanf("%d", &t); while(t--){ scanf("%d", &n); for(i = 0; i < n; i++){ scanf("%d", &arr[i]); } a = 'a'; b = 'b',...
The length of the longest common prefix of two strings $$$s = s_1 s_2 \ldots s_n$$$ and $$$t = t_1 t_2 \ldots t_m$$$ is defined as the maximum integer $$$k$$$ ($$$0 \le k \le min(n,m)$$$) such that $$$s_1 s_2 \ldots s_k$$$ equals $$$t_1 t_2 \ldots t_k$$$.Koa the Koala initially has $$$n+1$$$ strings $$$s_1, s_2, \dots,...
For each test case: Output $$$n+1$$$ lines. In the $$$i$$$-th line print string $$$s_i$$$ ($$$1 \le |s_i| \le 200$$$), consisting of lowercase Latin letters. Length of the longest common prefix of strings $$$s_i$$$ and $$$s_{i+1}$$$ has to be equal to $$$a_i$$$. If there are many answers print any. We can show that ans...
C
6983823efdc512f8759203460cd6bb4c
326e9df7878707eebaf345f0363c20cd
GNU C11
standard output
256 megabytes
train_003.jsonl
[ "constructive algorithms", "greedy", "strings" ]
1595601300
["4\n4\n1 2 4 2\n2\n5 3\n3\n1 3 1\n3\n0 0 0"]
NoteIn the $$$1$$$-st test case one of the possible answers is $$$s = [aeren, ari, arousal, around, ari]$$$.Lengths of longest common prefixes are: Between $$$\color{red}{a}eren$$$ and $$$\color{red}{a}ri$$$ $$$\rightarrow 1$$$ Between $$$\color{red}{ar}i$$$ and $$$\color{red}{ar}ousal$$$ $$$\rightarrow 2$$$ Between...
PASSED
1,200
standard input
1 second
Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the list $$$a$$$. The second line of e...
["aeren\nari\narousal\naround\nari\nmonogon\nmonogamy\nmonthly\nkevinvu\nkuroni\nkurioni\nkorone\nanton\nloves\nadhoc\nproblems"]
#include<stdio.h> int main() { int t,n,m,i,k,j,u,l; scanf("%d",&t); while(t--) { scanf("%d",&n); int a[n]; for(i=0;i<n;i++) { scanf("%d",&a[i]); } char s[200],d; for(i=0;i<200;i++)s[i]='a'; for(i=0;i<200;i++) printf("%c...
Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then...
Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on.
C
b97eeaa66e91bbcc3b5e616cb480c7af
351ad04e90c3f52c7ac2424db5a4f2fe
GNU C
standard output
512 megabytes
train_003.jsonl
[ "two pointers", "dsu", "implementation", "sortings", "trees" ]
1508151900
["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"]
NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan...
PASSED
1,500
standard input
1 second
The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s...
["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"]
#include <stdio.h> #include <string.h> #include <ctype.h> #define LL long long #define uLL unsigned long long #define uL unsigned int #define uC unsigned char #define NODES 1000007 #define NNNN 1000007 #define MemoryStackTotal 10000000 #define error 1e-8 long min(long a,long b) { if (b<a) {return b;} return a;...
Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then...
Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on.
C
b97eeaa66e91bbcc3b5e616cb480c7af
e8c7c2ef9f9142c56dfd156dac544274
GNU C
standard output
512 megabytes
train_003.jsonl
[ "two pointers", "dsu", "implementation", "sortings", "trees" ]
1508151900
["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"]
NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan...
PASSED
1,500
standard input
1 second
The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s...
["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"]
#include <stdio.h> #include <stdlib.h> int main() { int n; scanf("%d", &n); int *arr = (int*)malloc(n * sizeof(int)); int ls = n - 1, tmp, t1, i; printf("1 "); for (i = 0; i < n; i++) { scanf("%d", &tmp); tmp--; arr[tmp] = 1; while (ls >= 0 && arr[ls] == 1) { ls--; } t1 = i + 2 - (n - 1 - ls); p...
Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then...
Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on.
C
b97eeaa66e91bbcc3b5e616cb480c7af
7ba38a36c7fe1bbffc9b8a0e96fcab9c
GNU C
standard output
512 megabytes
train_003.jsonl
[ "two pointers", "dsu", "implementation", "sortings", "trees" ]
1508151900
["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"]
NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan...
PASSED
1,500
standard input
1 second
The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s...
["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"]
#include <stdio.h> char Flag[300001]; int main() { int n, num, bound, Cnt = 0; scanf("%d", &n); printf("%d ", 1); bound = n; for(int i = 0; i < n; ++i) { scanf("%d", &num); ++Cnt; Flag[num] = 1; while(Flag[bound]) { --bound; --Cnt; } ...
Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then...
Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on.
C
b97eeaa66e91bbcc3b5e616cb480c7af
cadb96f6f8e10b8ba651ccb472452f32
GNU C
standard output
512 megabytes
train_003.jsonl
[ "two pointers", "dsu", "implementation", "sortings", "trees" ]
1508151900
["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"]
NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan...
PASSED
1,500
standard input
1 second
The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s...
["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"]
#include <stdio.h> #include <string.h> #include <stdlib.h> #define maxn 300010 #define Min(a, b) (a < b ? a : b) #define Max(a, b) (a > b ? a : b) int a[maxn]; int main(){ int n; scanf("%d", &n); printf("1 "); int ans = 1, p, pos = n, max = 1; while(n--){ ans++; scanf("%d", &p); a[p] = 1; while(a[pos]){...
Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then...
Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on.
C
b97eeaa66e91bbcc3b5e616cb480c7af
21d6c17102257ab581e04d7ad8b802c7
GNU C
standard output
512 megabytes
train_003.jsonl
[ "two pointers", "dsu", "implementation", "sortings", "trees" ]
1508151900
["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"]
NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan...
PASSED
1,500
standard input
1 second
The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s...
["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"]
#include <stdio.h> #include <string.h> int a[3000001]; int main() { int n,i,j,ans=1; scanf("%d",&n); printf("1"); int last=n; memset(a,0,sizeof(a)); for (i=1;i<=n;i++) { int t; scanf("%d",&t); a[t]=1; ans++; if (t==last) { while (a[last]) { last--; ans--; } } printf(" %d",ans); } p...
Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then...
Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on.
C
b97eeaa66e91bbcc3b5e616cb480c7af
c71c81949f9fe346f33520accebee605
GNU C
standard output
512 megabytes
train_003.jsonl
[ "two pointers", "dsu", "implementation", "sortings", "trees" ]
1508151900
["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"]
NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan...
PASSED
1,500
standard input
1 second
The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s...
["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"]
#include <stdlib.h> #include <stdio.h> #include <string.h> #define MAX_N 300000 int arr[MAX_N]; int main(int pArgc, char **pArgs) { #ifdef LOCAL freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif int n; scanf("%d", &n); int k = n; printf("1 "); for (int i = 0; i < n; ++i) { int ...
Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then...
Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on.
C
b97eeaa66e91bbcc3b5e616cb480c7af
597ad5f75b2c7ad44c4befb478f503a8
GNU C
standard output
512 megabytes
train_003.jsonl
[ "two pointers", "dsu", "implementation", "sortings", "trees" ]
1508151900
["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"]
NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan...
PASSED
1,500
standard input
1 second
The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s...
["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"]
int p, q[300001], n, c; int main() { scanf("%d", &n); c = n; printf("1 "); for (int i = 2; i <= n; ++i) { scanf(" %d", &p); q[p] = 1; while (q[c]) c--; printf("%d ", i-n+c); } putchar('1'); return 0; }
Polycarpus is a system administrator. There are two servers under his strict guidance — a and b. To stay informed about the servers' performance, Polycarpus executes commands "ping a" and "ping b". Each ping command sends exactly ten packets to the server specified in the argument of the command. Executing a program re...
In the first line print string "LIVE" (without the quotes) if server a is "alive", otherwise print "DEAD" (without the quotes). In the second line print the state of server b in the similar format.
C
1d8870a705036b9820227309d74dd1e8
c633f2e1acf97acc562a34e76aac1307
GNU C
standard output
256 megabytes
train_003.jsonl
[ "implementation" ]
1353339000
["2\n1 5 5\n2 6 4", "3\n1 0 10\n2 0 10\n1 10 0"]
NoteConsider the first test case. There 10 packets were sent to server a, 5 of them reached it. Therefore, at least half of all packets sent to this server successfully reached it through the network. Overall there were 10 packets sent to server b, 6 of them reached it. Therefore, at least half of all packets sent to t...
PASSED
800
standard input
2 seconds
The first line contains a single integer n (2 ≤ n ≤ 1000) — the number of commands Polycarpus has fulfilled. Each of the following n lines contains three integers — the description of the commands. The i-th of these lines contains three space-separated integers ti, xi, yi (1 ≤ ti ≤ 2; xi, yi ≥ 0; xi + yi = 10). If ti =...
["LIVE\nLIVE", "LIVE\nDEAD"]
#include <stdio.h> int main() { int n; scanf("%d",&n); int a[n][3],i,j,t_a=0,t_b=0,s_a=0,s_b=0; for(i=0;i<n;i++){ for(j=0;j<3;j++){ scanf("%d",&a[i][j]); } if(a[i][0]==1){ t_a=t_a+10; s_a=s_a+a[i][1]; } else if(a[i][0]==2){ ...
Polycarpus is a system administrator. There are two servers under his strict guidance — a and b. To stay informed about the servers' performance, Polycarpus executes commands "ping a" and "ping b". Each ping command sends exactly ten packets to the server specified in the argument of the command. Executing a program re...
In the first line print string "LIVE" (without the quotes) if server a is "alive", otherwise print "DEAD" (without the quotes). In the second line print the state of server b in the similar format.
C
1d8870a705036b9820227309d74dd1e8
420731a32178eebbb6f1f3d26d92d142
GNU C
standard output
256 megabytes
train_003.jsonl
[ "implementation" ]
1353339000
["2\n1 5 5\n2 6 4", "3\n1 0 10\n2 0 10\n1 10 0"]
NoteConsider the first test case. There 10 packets were sent to server a, 5 of them reached it. Therefore, at least half of all packets sent to this server successfully reached it through the network. Overall there were 10 packets sent to server b, 6 of them reached it. Therefore, at least half of all packets sent to t...
PASSED
800
standard input
2 seconds
The first line contains a single integer n (2 ≤ n ≤ 1000) — the number of commands Polycarpus has fulfilled. Each of the following n lines contains three integers — the description of the commands. The i-th of these lines contains three space-separated integers ti, xi, yi (1 ≤ ti ≤ 2; xi, yi ≥ 0; xi + yi = 10). If ti =...
["LIVE\nLIVE", "LIVE\nDEAD"]
#include<stdio.h> #include<stdlib.h> #include<stdbool.h> #include<math.h> int main() { int t,x,y,i,T,a=0,b=0,c=0,d=0; scanf("%d",&T); while(T--) { scanf("%d%d%d",&t,&x,&y); if(t==1) { a=a+x; d=d+y; } else { b=b+x; c=c+y; ...
Polycarpus is a system administrator. There are two servers under his strict guidance — a and b. To stay informed about the servers' performance, Polycarpus executes commands "ping a" and "ping b". Each ping command sends exactly ten packets to the server specified in the argument of the command. Executing a program re...
In the first line print string "LIVE" (without the quotes) if server a is "alive", otherwise print "DEAD" (without the quotes). In the second line print the state of server b in the similar format.
C
1d8870a705036b9820227309d74dd1e8
dc3d133e81237a407ad1c1c46261bf4e
GNU C
standard output
256 megabytes
train_003.jsonl
[ "implementation" ]
1353339000
["2\n1 5 5\n2 6 4", "3\n1 0 10\n2 0 10\n1 10 0"]
NoteConsider the first test case. There 10 packets were sent to server a, 5 of them reached it. Therefore, at least half of all packets sent to this server successfully reached it through the network. Overall there were 10 packets sent to server b, 6 of them reached it. Therefore, at least half of all packets sent to t...
PASSED
800
standard input
2 seconds
The first line contains a single integer n (2 ≤ n ≤ 1000) — the number of commands Polycarpus has fulfilled. Each of the following n lines contains three integers — the description of the commands. The i-th of these lines contains three space-separated integers ti, xi, yi (1 ≤ ti ≤ 2; xi, yi ≥ 0; xi + yi = 10). If ti =...
["LIVE\nLIVE", "LIVE\nDEAD"]
#include<stdio.h> #include<string.h> int main() { int t,a,x,y,sum=0,sum1=0,b=0,c=0; scanf("%d",&t); while(t--) { scanf("%d%d%d",&a,&x,&y); if(a==1) { sum=sum+x+y; b=b+x; } if(a==2) { sum1=sum1+x+y; c=c+x; } } if(b>=sum/2...