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
Given an array a1, a2, ..., an of n integers, find the largest number in the array that is not a perfect square.A number x is said to be a perfect square if there exists an integer y such that x = y2.
Print the largest number in the array which is not a perfect square. It is guaranteed that an answer always exists.
C
d46d5f130d8c443f28b52096c384fef3
7afcd7579cc2246d61aee311c8b7efe1
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "brute force", "math" ]
1516462500
["2\n4 2", "8\n1 2 4 8 16 32 64 576"]
NoteIn the first sample case, 4 is a perfect square, so the largest number in the array that is not a perfect square is 2.
PASSED
900
standard input
1 second
The first line contains a single integer n (1 ≀ n ≀ 1000)Β β€” the number of elements in the array. The second line contains n integers a1, a2, ..., an ( - 106 ≀ ai ≀ 106)Β β€” the elements of the array. It is guaranteed that at least one element of the array is not a perfect square.
["2", "32"]
#include <stdio.h> int main() { int n,i,max,k,j; int a[1005]; while(~scanf("%d",&n)) { max=-1000005; for(i=0;i<n;i++) { scanf("%d",&a[i]); if(a[i]<0&&a[i]>max) max=a[i]; if(a[i]>=0) { for(j=0;j<=1000;j++) if(j*j==a[i]) break; if(j==1001) max=max<a[i]?a[i]:max; } } printf("%d\...
Given an array a1, a2, ..., an of n integers, find the largest number in the array that is not a perfect square.A number x is said to be a perfect square if there exists an integer y such that x = y2.
Print the largest number in the array which is not a perfect square. It is guaranteed that an answer always exists.
C
d46d5f130d8c443f28b52096c384fef3
337b876603724d2234ce19eb5b034331
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "brute force", "math" ]
1516462500
["2\n4 2", "8\n1 2 4 8 16 32 64 576"]
NoteIn the first sample case, 4 is a perfect square, so the largest number in the array that is not a perfect square is 2.
PASSED
900
standard input
1 second
The first line contains a single integer n (1 ≀ n ≀ 1000)Β β€” the number of elements in the array. The second line contains n integers a1, a2, ..., an ( - 106 ≀ ai ≀ 106)Β β€” the elements of the array. It is guaranteed that at least one element of the array is not a perfect square.
["2", "32"]
#include<stdio.h> #include<math.h> int main() { int i , a[1000] , n,x,j,k,temp,a1; float b; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&a[i]); } x=0; for(j=0;j<n;j++) { b=sqrt(a[j]); if(b!=(int)b) { a[x]=a[j]; x++; ...
Given an array a1, a2, ..., an of n integers, find the largest number in the array that is not a perfect square.A number x is said to be a perfect square if there exists an integer y such that x = y2.
Print the largest number in the array which is not a perfect square. It is guaranteed that an answer always exists.
C
d46d5f130d8c443f28b52096c384fef3
fe58d08ecfc5ba54073d8fa4875bbc21
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "brute force", "math" ]
1516462500
["2\n4 2", "8\n1 2 4 8 16 32 64 576"]
NoteIn the first sample case, 4 is a perfect square, so the largest number in the array that is not a perfect square is 2.
PASSED
900
standard input
1 second
The first line contains a single integer n (1 ≀ n ≀ 1000)Β β€” the number of elements in the array. The second line contains n integers a1, a2, ..., an ( - 106 ≀ ai ≀ 106)Β β€” the elements of the array. It is guaranteed that at least one element of the array is not a perfect square.
["2", "32"]
#include<stdio.h> #include<math.h> int main() { int i , a[1000] , n,x,j,k,temp,a1; float b; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&a[i]); } x=0; for(j=0;j<n;j++) { b=sqrt(a[j]); if(b!=(int)b) { a[x]=a[j]; x++; ...
Given an array a1, a2, ..., an of n integers, find the largest number in the array that is not a perfect square.A number x is said to be a perfect square if there exists an integer y such that x = y2.
Print the largest number in the array which is not a perfect square. It is guaranteed that an answer always exists.
C
d46d5f130d8c443f28b52096c384fef3
d2bea945cf0ae32a9c438c6ea29773fa
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "brute force", "math" ]
1516462500
["2\n4 2", "8\n1 2 4 8 16 32 64 576"]
NoteIn the first sample case, 4 is a perfect square, so the largest number in the array that is not a perfect square is 2.
PASSED
900
standard input
1 second
The first line contains a single integer n (1 ≀ n ≀ 1000)Β β€” the number of elements in the array. The second line contains n integers a1, a2, ..., an ( - 106 ≀ ai ≀ 106)Β β€” the elements of the array. It is guaranteed that at least one element of the array is not a perfect square.
["2", "32"]
#include<stdio.h> #include<math.h> int main() { int n,i; int d=-1000000; scanf("%d",&n); int a[n]; for(i=0;i<n;i++){ scanf("%d",&a[i]); if((a[i]>0)&&((int)(sqrt(a[i]))!=sqrt(a[i]))&&(d<a[i])) d=a[i]; else if((a[i]<0)&&(d<a[i])){ d=a[i];} } prin...
Given an array a1, a2, ..., an of n integers, find the largest number in the array that is not a perfect square.A number x is said to be a perfect square if there exists an integer y such that x = y2.
Print the largest number in the array which is not a perfect square. It is guaranteed that an answer always exists.
C
d46d5f130d8c443f28b52096c384fef3
e342d74c8296204628185739f77e5245
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "brute force", "math" ]
1516462500
["2\n4 2", "8\n1 2 4 8 16 32 64 576"]
NoteIn the first sample case, 4 is a perfect square, so the largest number in the array that is not a perfect square is 2.
PASSED
900
standard input
1 second
The first line contains a single integer n (1 ≀ n ≀ 1000)Β β€” the number of elements in the array. The second line contains n integers a1, a2, ..., an ( - 106 ≀ ai ≀ 106)Β β€” the elements of the array. It is guaranteed that at least one element of the array is not a perfect square.
["2", "32"]
#include <stdio.h> #include <stdlib.h> int main() { int i,m; float l; signed n=-1000000; signed x; scanf("%d",&x); int arr[x]; for(i=0;i<x;i++){ scanf("%d",&arr[i]); } for(i=0;i<x;i++){ l=sqrt(arr[i]); m=sqrt(arr[i]); if(l!=m){ if(arr[i]>n) n=arr...
There is a square matrix n × n, consisting of non-negative integer numbers. You should find such a way on it that starts in the upper left cell of the matrix; each following cell is to the right or down from the current cell; the way ends in the bottom right cell. Moreover, if we multiply together all the numbers a...
In the first line print the least number of trailing zeros. In the second line print the correspondent way itself.
C
13c58291ab9cf7ad1b8c466c3e36aacf
8db5d9a1e692383c8e119b7e457b079f
GNU C
standard output
64 megabytes
train_001.jsonl
[ "dp", "math" ]
1267117200
["3\n1 2 3\n4 5 6\n7 8 9"]
null
PASSED
2,000
standard input
2 seconds
The first line contains an integer number n (2 ≀ n ≀ 1000), n is the size of the matrix. Then follow n lines containing the matrix elements (non-negative integer numbers not exceeding 109).
["0\nDDRR"]
#include <stdio.h> int x=-1; int compute(int (*a)[1001],int (*b)[1001],char (*c)[1001],int n) { int i,j; b[0][0]=a[0][0]; for(i=0;i<n;i++) { for(j=0;j<n;j++) { if(j-1<0 && i-1<0) continue; if(j-1<0) goto down; if(i-1<0) goto right; if(b[i][j-1]<b[i-1][j]) goto right; ...
There is a given string S consisting of N symbols. Your task is to find the number of ordered pairs of integers i and j such that1. 1 ≀ i, j ≀ N2. S[i] = S[j], that is the i-th symbol of string S is equal to the j-th.
Print a single number which represents the number of pairs i and j with the needed property. Pairs (x, y) and (y, x) should be considered different, i.e. the ordered pairs count.
C
6bb2793e275426eb076972fab69d0eba
0536d8670abb204217de2cd32a8113ab
GNU C
standard output
256 megabytes
train_001.jsonl
[ "strings" ]
1292862000
["great10", "aaaaaaaaaa"]
null
PASSED
1,500
standard input
2 seconds
The single input line contains S, consisting of lowercase Latin letters and digits. It is guaranteed that string S in not empty and its length does not exceed 105.
["7", "100"]
#include<stdio.h> int count[300]; int main() { int i=0; char myarray[1000000]; while(1) { scanf("%c",&myarray[i]); if(myarray[i]=='\n') { myarray[i]='\0'; break; } else { count[myarray[i]]++; } i++; ...
There is a given string S consisting of N symbols. Your task is to find the number of ordered pairs of integers i and j such that1. 1 ≀ i, j ≀ N2. S[i] = S[j], that is the i-th symbol of string S is equal to the j-th.
Print a single number which represents the number of pairs i and j with the needed property. Pairs (x, y) and (y, x) should be considered different, i.e. the ordered pairs count.
C
6bb2793e275426eb076972fab69d0eba
ed50612e04551da26ef1bb7b1c96df3a
GNU C
standard output
256 megabytes
train_001.jsonl
[ "strings" ]
1292862000
["great10", "aaaaaaaaaa"]
null
PASSED
1,500
standard input
2 seconds
The single input line contains S, consisting of lowercase Latin letters and digits. It is guaranteed that string S in not empty and its length does not exceed 105.
["7", "100"]
#include <stdio.h> #include <string.h> int main() { int i, l; long long sum; static char s[100001]; static int cnt[128]; scanf("%s", s); l = strlen(s); for (i = 0; i < l; i++) cnt[s[i] - '0']++; sum = 0; for (i = 0; i < l; i++) sum += cnt[s[i] - '0']; printf("%lld\n", sum); return 0; }
There is a given string S consisting of N symbols. Your task is to find the number of ordered pairs of integers i and j such that1. 1 ≀ i, j ≀ N2. S[i] = S[j], that is the i-th symbol of string S is equal to the j-th.
Print a single number which represents the number of pairs i and j with the needed property. Pairs (x, y) and (y, x) should be considered different, i.e. the ordered pairs count.
C
6bb2793e275426eb076972fab69d0eba
22c24fc89aa3d590f5b46e49b469b71b
GNU C
standard output
256 megabytes
train_001.jsonl
[ "strings" ]
1292862000
["great10", "aaaaaaaaaa"]
null
PASSED
1,500
standard input
2 seconds
The single input line contains S, consisting of lowercase Latin letters and digits. It is guaranteed that string S in not empty and its length does not exceed 105.
["7", "100"]
#include <stdio.h> #include <string.h> int main() { int i, l; long long sum; static char s[100001]; static int cnt[128]; scanf("%s", s); l = strlen(s); for (i = 0; i < l; i++) cnt[s[i] - '0']++; sum = 0; for (i = 0; i < l; i++) sum += cnt[s[i] - '0']; printf("%lld\n", sum); return 0; }
There is a given string S consisting of N symbols. Your task is to find the number of ordered pairs of integers i and j such that1. 1 ≀ i, j ≀ N2. S[i] = S[j], that is the i-th symbol of string S is equal to the j-th.
Print a single number which represents the number of pairs i and j with the needed property. Pairs (x, y) and (y, x) should be considered different, i.e. the ordered pairs count.
C
6bb2793e275426eb076972fab69d0eba
85b32db7fd0b16da1e94e0149ade7d22
GNU C
standard output
256 megabytes
train_001.jsonl
[ "strings" ]
1292862000
["great10", "aaaaaaaaaa"]
null
PASSED
1,500
standard input
2 seconds
The single input line contains S, consisting of lowercase Latin letters and digits. It is guaranteed that string S in not empty and its length does not exceed 105.
["7", "100"]
#include <stdio.h> #include <string.h> char s[100001]; long long int flit[30]; long long int fcif[15]; int main() { long long int n,i,total=0; gets(s); n=strlen(s); for(i=0;i<n;i++) { if(s[i]>='a' && s[i]<='z') flit[s[i]-'a']++; else { if(s[i]>='0' && ...
There is a given string S consisting of N symbols. Your task is to find the number of ordered pairs of integers i and j such that1. 1 ≀ i, j ≀ N2. S[i] = S[j], that is the i-th symbol of string S is equal to the j-th.
Print a single number which represents the number of pairs i and j with the needed property. Pairs (x, y) and (y, x) should be considered different, i.e. the ordered pairs count.
C
6bb2793e275426eb076972fab69d0eba
de19d39407ac2ff57efe697c12b72cc6
GNU C
standard output
256 megabytes
train_001.jsonl
[ "strings" ]
1292862000
["great10", "aaaaaaaaaa"]
null
PASSED
1,500
standard input
2 seconds
The single input line contains S, consisting of lowercase Latin letters and digits. It is guaranteed that string S in not empty and its length does not exceed 105.
["7", "100"]
#include <stdio.h> char str[100001]; int cnt[128]; long long s; int main(int argc, char *argv[]) { int i; gets(str); for(i = 0; str[i]; i ++) cnt[str[i]] ++; for(i = '0'; i <= '9'; i ++) s += (long long) cnt[i] * cnt[i]; for(i = 'a'; i <= 'z'; i ++) s += (long long) cnt[i...
There is a given string S consisting of N symbols. Your task is to find the number of ordered pairs of integers i and j such that1. 1 ≀ i, j ≀ N2. S[i] = S[j], that is the i-th symbol of string S is equal to the j-th.
Print a single number which represents the number of pairs i and j with the needed property. Pairs (x, y) and (y, x) should be considered different, i.e. the ordered pairs count.
C
6bb2793e275426eb076972fab69d0eba
aea2e09b7c3df3c462aa230c89e1ada8
GNU C
standard output
256 megabytes
train_001.jsonl
[ "strings" ]
1292862000
["great10", "aaaaaaaaaa"]
null
PASSED
1,500
standard input
2 seconds
The single input line contains S, consisting of lowercase Latin letters and digits. It is guaranteed that string S in not empty and its length does not exceed 105.
["7", "100"]
#include <stdio.h> int main() { long long i,j,k=0,counter=0; char arr[1000000]; scanf("%s",arr); long long spare[1000]; for(i=0;arr[i]!='\0';i++) {counter=0; if(arr[i]!='*') { for(j=i+1;arr[j]!='\0';j++) { if(arr[i]==arr[j]) ...
There is a given string S consisting of N symbols. Your task is to find the number of ordered pairs of integers i and j such that1. 1 ≀ i, j ≀ N2. S[i] = S[j], that is the i-th symbol of string S is equal to the j-th.
Print a single number which represents the number of pairs i and j with the needed property. Pairs (x, y) and (y, x) should be considered different, i.e. the ordered pairs count.
C
6bb2793e275426eb076972fab69d0eba
5d9668e8f9d889fe642074a6e3f7a940
GNU C
standard output
256 megabytes
train_001.jsonl
[ "strings" ]
1292862000
["great10", "aaaaaaaaaa"]
null
PASSED
1,500
standard input
2 seconds
The single input line contains S, consisting of lowercase Latin letters and digits. It is guaranteed that string S in not empty and its length does not exceed 105.
["7", "100"]
#include<math.h> #include<time.h> #include<stdio.h> #include<string.h> #include<stdlib.h> #define oo 1000000000 #define pi 3.14159265359 #define zero(a) (abb(a)<=1e-7) #define lowbit(a) ((a)&(-(a))) #define min(a,b) ((a)<(b)?(a):(b)) #define max(a,b) ((a)>(b)?(a):(b)) #define abb(a) ((a)>0?(a):(-(a))) #define cj(x1,y1,...
There is a given string S consisting of N symbols. Your task is to find the number of ordered pairs of integers i and j such that1. 1 ≀ i, j ≀ N2. S[i] = S[j], that is the i-th symbol of string S is equal to the j-th.
Print a single number which represents the number of pairs i and j with the needed property. Pairs (x, y) and (y, x) should be considered different, i.e. the ordered pairs count.
C
6bb2793e275426eb076972fab69d0eba
998e5113510ec334f9ede70261c33c00
GNU C
standard output
256 megabytes
train_001.jsonl
[ "strings" ]
1292862000
["great10", "aaaaaaaaaa"]
null
PASSED
1,500
standard input
2 seconds
The single input line contains S, consisting of lowercase Latin letters and digits. It is guaranteed that string S in not empty and its length does not exceed 105.
["7", "100"]
#include <stdio.h> #include <string.h> #include <math.h> int main(){ char string[100001]; long asciiNumbers[10], asciiLowercase[26], i; long long numPairs; numPairs = 0; for(i = 0; i < 10; i++){ asciiNumbers[i] = 0; asciiLowercase[i] = 0; } for(i = 10; i < 26; i++) ...
There is a given string S consisting of N symbols. Your task is to find the number of ordered pairs of integers i and j such that1. 1 ≀ i, j ≀ N2. S[i] = S[j], that is the i-th symbol of string S is equal to the j-th.
Print a single number which represents the number of pairs i and j with the needed property. Pairs (x, y) and (y, x) should be considered different, i.e. the ordered pairs count.
C
6bb2793e275426eb076972fab69d0eba
aff1a80acfb18ae5a301edcdd0bb6715
GNU C
standard output
256 megabytes
train_001.jsonl
[ "strings" ]
1292862000
["great10", "aaaaaaaaaa"]
null
PASSED
1,500
standard input
2 seconds
The single input line contains S, consisting of lowercase Latin letters and digits. It is guaranteed that string S in not empty and its length does not exceed 105.
["7", "100"]
#include<stdio.h> #include<string.h> int t[125]; int main() { int i,l; char s[100004]; while(scanf("%s",s)!=EOF) { l=strlen(s); memset(t,0,sizeof(t)); for(i=0; i<l; i++) { t[s[i]]++; } double ans=0; for(i='0'; i<='z'; i++) { ...
There is a given string S consisting of N symbols. Your task is to find the number of ordered pairs of integers i and j such that1. 1 ≀ i, j ≀ N2. S[i] = S[j], that is the i-th symbol of string S is equal to the j-th.
Print a single number which represents the number of pairs i and j with the needed property. Pairs (x, y) and (y, x) should be considered different, i.e. the ordered pairs count.
C
6bb2793e275426eb076972fab69d0eba
11794f1a2633234b12f5240fad19061b
GNU C
standard output
256 megabytes
train_001.jsonl
[ "strings" ]
1292862000
["great10", "aaaaaaaaaa"]
null
PASSED
1,500
standard input
2 seconds
The single input line contains S, consisting of lowercase Latin letters and digits. It is guaranteed that string S in not empty and its length does not exceed 105.
["7", "100"]
#include<stdio.h> #include<string.h> int t[125]; int main() { int i,l; char s[100004]; while(scanf("%s",s)!=EOF) { l=strlen(s); memset(t,0,sizeof(t)); for(i=0; i<l; i++) { t[s[i]]++; } double ans=0; for(i='0'; i<='z'; i++) { ...
There is a given string S consisting of N symbols. Your task is to find the number of ordered pairs of integers i and j such that1. 1 ≀ i, j ≀ N2. S[i] = S[j], that is the i-th symbol of string S is equal to the j-th.
Print a single number which represents the number of pairs i and j with the needed property. Pairs (x, y) and (y, x) should be considered different, i.e. the ordered pairs count.
C
6bb2793e275426eb076972fab69d0eba
c8d848b8cb8209795b066a0efe523498
GNU C
standard output
256 megabytes
train_001.jsonl
[ "strings" ]
1292862000
["great10", "aaaaaaaaaa"]
null
PASSED
1,500
standard input
2 seconds
The single input line contains S, consisting of lowercase Latin letters and digits. It is guaranteed that string S in not empty and its length does not exceed 105.
["7", "100"]
#include<stdio.h> #include<string.h> long long a[256]; char s[100001]; int main() { scanf("%s",s); long long ans=0,i,l=strlen(s); for(i=0;i<l;++i) ++a[s[i]]; for(i=0;i<256;++i) ans+=a[i]*a[i]; printf("%lld",ans); return 0; }
There is a given string S consisting of N symbols. Your task is to find the number of ordered pairs of integers i and j such that1. 1 ≀ i, j ≀ N2. S[i] = S[j], that is the i-th symbol of string S is equal to the j-th.
Print a single number which represents the number of pairs i and j with the needed property. Pairs (x, y) and (y, x) should be considered different, i.e. the ordered pairs count.
C
6bb2793e275426eb076972fab69d0eba
07cb031f14d80a8fc16db68d15991025
GNU C
standard output
256 megabytes
train_001.jsonl
[ "strings" ]
1292862000
["great10", "aaaaaaaaaa"]
null
PASSED
1,500
standard input
2 seconds
The single input line contains S, consisting of lowercase Latin letters and digits. It is guaranteed that string S in not empty and its length does not exceed 105.
["7", "100"]
#include <stdio.h> #include <stdlib.h> char str[1000000+5]; int main() { scanf("%s",str); long long arr[500]={0}; long long i,sum=0; for(i=0;str[i]!='\0';i++){ arr[(int)str[i]]++; } for(i=0;i<500;i++){ sum+=arr[i]*arr[i]; } printf("%lld\n",sum); return 0; }
There is a given string S consisting of N symbols. Your task is to find the number of ordered pairs of integers i and j such that1. 1 ≀ i, j ≀ N2. S[i] = S[j], that is the i-th symbol of string S is equal to the j-th.
Print a single number which represents the number of pairs i and j with the needed property. Pairs (x, y) and (y, x) should be considered different, i.e. the ordered pairs count.
C
6bb2793e275426eb076972fab69d0eba
d1ed87536018bc4363f8c2df389a3d6b
GNU C
standard output
256 megabytes
train_001.jsonl
[ "strings" ]
1292862000
["great10", "aaaaaaaaaa"]
null
PASSED
1,500
standard input
2 seconds
The single input line contains S, consisting of lowercase Latin letters and digits. It is guaranteed that string S in not empty and its length does not exceed 105.
["7", "100"]
#include<stdio.h> int main() { long long int i,a[200]={0},c=0; char s[100001]; scanf("%s",s); for(i=0;s[i]!='\0';i++) { a[(int)s[i]]++; } for(i=0;i<200;i++) { c+=a[i]*a[i]; } printf("%I64d\n",c); return(0); }
There is a given string S consisting of N symbols. Your task is to find the number of ordered pairs of integers i and j such that1. 1 ≀ i, j ≀ N2. S[i] = S[j], that is the i-th symbol of string S is equal to the j-th.
Print a single number which represents the number of pairs i and j with the needed property. Pairs (x, y) and (y, x) should be considered different, i.e. the ordered pairs count.
C
6bb2793e275426eb076972fab69d0eba
d75786834df89d138bffab4b75f77c16
GNU C
standard output
256 megabytes
train_001.jsonl
[ "strings" ]
1292862000
["great10", "aaaaaaaaaa"]
null
PASSED
1,500
standard input
2 seconds
The single input line contains S, consisting of lowercase Latin letters and digits. It is guaranteed that string S in not empty and its length does not exceed 105.
["7", "100"]
#include <stdio.h> #include <string.h> #include <math.h> int main(){ char string[100001]; long asciiNumbers[10], asciiLowercase[26], i; long long numPairs; numPairs = 0; for(i = 0; i < 10; i++){ asciiNumbers[i] = 0; asciiLowercase[i] = 0; } for(i = 10; i < 26; i++) asciiLowercase[i] = 0; scanf("%s", s...
There is a given string S consisting of N symbols. Your task is to find the number of ordered pairs of integers i and j such that1. 1 ≀ i, j ≀ N2. S[i] = S[j], that is the i-th symbol of string S is equal to the j-th.
Print a single number which represents the number of pairs i and j with the needed property. Pairs (x, y) and (y, x) should be considered different, i.e. the ordered pairs count.
C
6bb2793e275426eb076972fab69d0eba
ecfe8d46bd81ff71dc0f1c20a5f2a89e
GNU C
standard output
256 megabytes
train_001.jsonl
[ "strings" ]
1292862000
["great10", "aaaaaaaaaa"]
null
PASSED
1,500
standard input
2 seconds
The single input line contains S, consisting of lowercase Latin letters and digits. It is guaranteed that string S in not empty and its length does not exceed 105.
["7", "100"]
#include <stdio.h> #include <stdlib.h> int main(int argc, char** argv) { long long int s = 0LL; long long int arr [100]; int i; for (i = 0; i < 100; i++) arr[i] = 0LL; int t; char c; scanf("%c", &c); while ((c != ' ') && (c != '\n') && (c != '\t')){ t = c; s += 1 + 2 * a...
There is a given string S consisting of N symbols. Your task is to find the number of ordered pairs of integers i and j such that1. 1 ≀ i, j ≀ N2. S[i] = S[j], that is the i-th symbol of string S is equal to the j-th.
Print a single number which represents the number of pairs i and j with the needed property. Pairs (x, y) and (y, x) should be considered different, i.e. the ordered pairs count.
C
6bb2793e275426eb076972fab69d0eba
9706471e77619124dac7f3206c6c6930
GNU C
standard output
256 megabytes
train_001.jsonl
[ "strings" ]
1292862000
["great10", "aaaaaaaaaa"]
null
PASSED
1,500
standard input
2 seconds
The single input line contains S, consisting of lowercase Latin letters and digits. It is guaranteed that string S in not empty and its length does not exceed 105.
["7", "100"]
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> int main() { long long soma; int i, *letras, codletra, tamanho, metade, resto; char palavra[100010]; //char *palavra; i = 0; letras = calloc(90, sizeof(int)); //while (i < 50){ // letras[i] = 0; // ...
There is a given string S consisting of N symbols. Your task is to find the number of ordered pairs of integers i and j such that1. 1 ≀ i, j ≀ N2. S[i] = S[j], that is the i-th symbol of string S is equal to the j-th.
Print a single number which represents the number of pairs i and j with the needed property. Pairs (x, y) and (y, x) should be considered different, i.e. the ordered pairs count.
C
6bb2793e275426eb076972fab69d0eba
bdbbb28610af9ad2052268839233e784
GNU C
standard output
256 megabytes
train_001.jsonl
[ "strings" ]
1292862000
["great10", "aaaaaaaaaa"]
null
PASSED
1,500
standard input
2 seconds
The single input line contains S, consisting of lowercase Latin letters and digits. It is guaranteed that string S in not empty and its length does not exceed 105.
["7", "100"]
#include<stdio.h> int main() { long int i,j,a[257]={0}; unsigned long long int sum=0,p; char s[100001]; scanf("%s",s); for(i=0;s[i]!='\0';i++) a[(int)(s[i])]++; for(i=0;i<257;i++) { p=a[i]; sum=sum+p*p; } printf("%I64u\n",sum); retu...
There is a given string S consisting of N symbols. Your task is to find the number of ordered pairs of integers i and j such that1. 1 ≀ i, j ≀ N2. S[i] = S[j], that is the i-th symbol of string S is equal to the j-th.
Print a single number which represents the number of pairs i and j with the needed property. Pairs (x, y) and (y, x) should be considered different, i.e. the ordered pairs count.
C
6bb2793e275426eb076972fab69d0eba
5e249328191d407271949e0b7836b231
GNU C
standard output
256 megabytes
train_001.jsonl
[ "strings" ]
1292862000
["great10", "aaaaaaaaaa"]
null
PASSED
1,500
standard input
2 seconds
The single input line contains S, consisting of lowercase Latin letters and digits. It is guaranteed that string S in not empty and its length does not exceed 105.
["7", "100"]
#include<stdio.h> int main() { long long int i,a[200]={0},c=0; char s[100001]; gets(s); for(i=0;s[i]!='\0';i++) a[(int)s[i]]++; for(i=0;i<200;i++) c+=a[i]*a[i]; printf("%I64d",c); return(0);}
There is a given string S consisting of N symbols. Your task is to find the number of ordered pairs of integers i and j such that1. 1 ≀ i, j ≀ N2. S[i] = S[j], that is the i-th symbol of string S is equal to the j-th.
Print a single number which represents the number of pairs i and j with the needed property. Pairs (x, y) and (y, x) should be considered different, i.e. the ordered pairs count.
C
6bb2793e275426eb076972fab69d0eba
cf21ba96bc6288b63a43bc1beb2ec94d
GNU C
standard output
256 megabytes
train_001.jsonl
[ "strings" ]
1292862000
["great10", "aaaaaaaaaa"]
null
PASSED
1,500
standard input
2 seconds
The single input line contains S, consisting of lowercase Latin letters and digits. It is guaranteed that string S in not empty and its length does not exceed 105.
["7", "100"]
#include<stdio.h> #include<string.h> #include<stdlib.h> long long int factorial(int n) { long long int a[n+1]; a[0]=1; int i; for(i=1;i<=n;i++) { a[i]=a[i-1]*i; } return a[n]; } int cmp(const void *a,const void *b) { return *(int *)a-*(int *)b; } int cmpi(const void *a,const void *b) { retu...
There is a given string S consisting of N symbols. Your task is to find the number of ordered pairs of integers i and j such that1. 1 ≀ i, j ≀ N2. S[i] = S[j], that is the i-th symbol of string S is equal to the j-th.
Print a single number which represents the number of pairs i and j with the needed property. Pairs (x, y) and (y, x) should be considered different, i.e. the ordered pairs count.
C
6bb2793e275426eb076972fab69d0eba
38d73b7ddb4c513f21fbbad036a4ac4d
GNU C
standard output
256 megabytes
train_001.jsonl
[ "strings" ]
1292862000
["great10", "aaaaaaaaaa"]
null
PASSED
1,500
standard input
2 seconds
The single input line contains S, consisting of lowercase Latin letters and digits. It is guaranteed that string S in not empty and its length does not exceed 105.
["7", "100"]
#include <stdio.h> #include <string.h> int main() { long long int i,j,k=0,w,s,t,f; char str[100001]; char ch[100001]; scanf("%s",str); w=strlen(str); for (i=0;i<w-1;i++){ f=0; for (j=i+1;j<w;j++){ if (str[i]==str[j]){ f=1; break; } } if (f==0){ ch[k]=str[i]; k++; } } ch[k]=str[w-1]...
There is a given string S consisting of N symbols. Your task is to find the number of ordered pairs of integers i and j such that1. 1 ≀ i, j ≀ N2. S[i] = S[j], that is the i-th symbol of string S is equal to the j-th.
Print a single number which represents the number of pairs i and j with the needed property. Pairs (x, y) and (y, x) should be considered different, i.e. the ordered pairs count.
C
6bb2793e275426eb076972fab69d0eba
3978ab6c9f76fa36c90f2b8ba79c0d1a
GNU C
standard output
256 megabytes
train_001.jsonl
[ "strings" ]
1292862000
["great10", "aaaaaaaaaa"]
null
PASSED
1,500
standard input
2 seconds
The single input line contains S, consisting of lowercase Latin letters and digits. It is guaranteed that string S in not empty and its length does not exceed 105.
["7", "100"]
#include<stdio.h> #include<string.h> long long count[300]; int main() { int i=0,j,k; char a[1000000]; while(1){ scanf("%c",&a[i]); if(a[i]=='\n'){a[i]='\0';break;} else{ count[a[i]]++; } i++; } long long sum=0; for(j=0;j<i;j++){ sum+=c...
There is a given string S consisting of N symbols. Your task is to find the number of ordered pairs of integers i and j such that1. 1 ≀ i, j ≀ N2. S[i] = S[j], that is the i-th symbol of string S is equal to the j-th.
Print a single number which represents the number of pairs i and j with the needed property. Pairs (x, y) and (y, x) should be considered different, i.e. the ordered pairs count.
C
6bb2793e275426eb076972fab69d0eba
b5267e1f6d944ba593932e16f32fa902
GNU C
standard output
256 megabytes
train_001.jsonl
[ "strings" ]
1292862000
["great10", "aaaaaaaaaa"]
null
PASSED
1,500
standard input
2 seconds
The single input line contains S, consisting of lowercase Latin letters and digits. It is guaranteed that string S in not empty and its length does not exceed 105.
["7", "100"]
#include <stdio.h> #include <stdlib.h> int main() { long long sum = 0 , i=0 ; char word[100001] = {'/0'}; long long a[100001]={0}; gets(word); long long length = strlen(word); for (i=0 ; i< length ; i++) { a[word[i]]++ ; } for (i=0 ; i< 300 ; i++) { sum += a[i]...
There is a given string S consisting of N symbols. Your task is to find the number of ordered pairs of integers i and j such that1. 1 ≀ i, j ≀ N2. S[i] = S[j], that is the i-th symbol of string S is equal to the j-th.
Print a single number which represents the number of pairs i and j with the needed property. Pairs (x, y) and (y, x) should be considered different, i.e. the ordered pairs count.
C
6bb2793e275426eb076972fab69d0eba
384e7c3a3bca79b30f25757c621e6e3d
GNU C
standard output
256 megabytes
train_001.jsonl
[ "strings" ]
1292862000
["great10", "aaaaaaaaaa"]
null
PASSED
1,500
standard input
2 seconds
The single input line contains S, consisting of lowercase Latin letters and digits. It is guaranteed that string S in not empty and its length does not exceed 105.
["7", "100"]
int s[260]; char str[100005]; int main() { int i; long long ans=0; gets(str+1); for(i=1;str[i];i++) s[str[i]]++; for(i=1;i<=260;i++) ans+=(long long)s[i]*s[i]; printf("%lld\n",ans); return 0; }
There is a given string S consisting of N symbols. Your task is to find the number of ordered pairs of integers i and j such that1. 1 ≀ i, j ≀ N2. S[i] = S[j], that is the i-th symbol of string S is equal to the j-th.
Print a single number which represents the number of pairs i and j with the needed property. Pairs (x, y) and (y, x) should be considered different, i.e. the ordered pairs count.
C
6bb2793e275426eb076972fab69d0eba
18cb4651d53688319b590cd4a6856e3c
GNU C
standard output
256 megabytes
train_001.jsonl
[ "strings" ]
1292862000
["great10", "aaaaaaaaaa"]
null
PASSED
1,500
standard input
2 seconds
The single input line contains S, consisting of lowercase Latin letters and digits. It is guaranteed that string S in not empty and its length does not exceed 105.
["7", "100"]
int s[260]; char str[100005]; main() { int i; long long ans=0; gets(str+1); for(i=1;str[i];i++) s[str[i]]++; for(i=1;i<=260;i++) ans+=(long long)s[i]*s[i]; printf("%lld\n",ans); return 0; }
There is a given string S consisting of N symbols. Your task is to find the number of ordered pairs of integers i and j such that1. 1 ≀ i, j ≀ N2. S[i] = S[j], that is the i-th symbol of string S is equal to the j-th.
Print a single number which represents the number of pairs i and j with the needed property. Pairs (x, y) and (y, x) should be considered different, i.e. the ordered pairs count.
C
6bb2793e275426eb076972fab69d0eba
36381a8e0f7bbad8b2f1d2bde3320ef8
GNU C
standard output
256 megabytes
train_001.jsonl
[ "strings" ]
1292862000
["great10", "aaaaaaaaaa"]
null
PASSED
1,500
standard input
2 seconds
The single input line contains S, consisting of lowercase Latin letters and digits. It is guaranteed that string S in not empty and its length does not exceed 105.
["7", "100"]
#include<stdio.h> #define N 100001 int main() { char str[N]; int i,j; unsigned long long sum,flag[270]; sum = 0; scanf("%s",str); for(i=0;i<270;i++) flag[i] = (unsigned long long)0; i = 0; while(str[i]) { flag[str[i]] += (unsigned long long)1; i++; } i = 0; for(i=0;i<270;i+...
There is a given string S consisting of N symbols. Your task is to find the number of ordered pairs of integers i and j such that1. 1 ≀ i, j ≀ N2. S[i] = S[j], that is the i-th symbol of string S is equal to the j-th.
Print a single number which represents the number of pairs i and j with the needed property. Pairs (x, y) and (y, x) should be considered different, i.e. the ordered pairs count.
C
6bb2793e275426eb076972fab69d0eba
54858768accad696dc8010ea34e1afe7
GNU C
standard output
256 megabytes
train_001.jsonl
[ "strings" ]
1292862000
["great10", "aaaaaaaaaa"]
null
PASSED
1,500
standard input
2 seconds
The single input line contains S, consisting of lowercase Latin letters and digits. It is guaranteed that string S in not empty and its length does not exceed 105.
["7", "100"]
#include<stdio.h> #include<string.h> #include<stdlib.h> #include<math.h> int main() { char s[100001]; double arr[100001]; int len,i; double n=0; scanf("%s",s); len=strlen(s); memset(arr,0,sizeof(arr)); for(i=0;i<len;i++) arr[s[i]]++; for(i=0;i<100001;i++) { if(ar...
There is a given string S consisting of N symbols. Your task is to find the number of ordered pairs of integers i and j such that1. 1 ≀ i, j ≀ N2. S[i] = S[j], that is the i-th symbol of string S is equal to the j-th.
Print a single number which represents the number of pairs i and j with the needed property. Pairs (x, y) and (y, x) should be considered different, i.e. the ordered pairs count.
C
6bb2793e275426eb076972fab69d0eba
d3aa3448382c370e42e8fd1d88fb5d3c
GNU C
standard output
256 megabytes
train_001.jsonl
[ "strings" ]
1292862000
["great10", "aaaaaaaaaa"]
null
PASSED
1,500
standard input
2 seconds
The single input line contains S, consisting of lowercase Latin letters and digits. It is guaranteed that string S in not empty and its length does not exceed 105.
["7", "100"]
#include <stdio.h> int s[333]; char str[100005]; int main() { int i; long long ans=0; gets(str+1); for (i=1;str[i];i++) s[str[i]]++; for (i=1;i<=300;i++) ans+=(long long)s[i]*s[i]; printf("%I64d\n",ans); return 0; }
There is a given string S consisting of N symbols. Your task is to find the number of ordered pairs of integers i and j such that1. 1 ≀ i, j ≀ N2. S[i] = S[j], that is the i-th symbol of string S is equal to the j-th.
Print a single number which represents the number of pairs i and j with the needed property. Pairs (x, y) and (y, x) should be considered different, i.e. the ordered pairs count.
C
6bb2793e275426eb076972fab69d0eba
8be5bb251abe4f2bdb11793b31456968
GNU C
standard output
256 megabytes
train_001.jsonl
[ "strings" ]
1292862000
["great10", "aaaaaaaaaa"]
null
PASSED
1,500
standard input
2 seconds
The single input line contains S, consisting of lowercase Latin letters and digits. It is guaranteed that string S in not empty and its length does not exceed 105.
["7", "100"]
int s[260]; char str[100005]; int main() { int i; long long ans=0; gets(str+1); for(i=1;str[i];i++) s[str[i]]++; for(i=1;i<=260;i++) ans+=(long long)s[i]*s[i]; printf("%I64d\n",ans); return 0; }
You are given a sequence $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ integers.You may perform the following operation on this sequence: choose any element and either increase or decrease it by one.Calculate the minimum possible difference between the maximum element and the minimum element in the sequence, if you ...
Print the minimum possible difference between the maximum element and the minimum element in the sequence, if you can perform the aforementioned operation no more than $$$k$$$ times.
C
51113dfdbf9f59152712b60e7a14368a
d922d0edf3d417817e70640f3fafcab5
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "greedy", "constructive algorithms", "two pointers", "sortings", "binary search", "ternary search" ]
1570957500
["4 5\n3 1 7 5", "3 10\n100 100 100", "10 9\n4 5 5 7 5 4 5 2 4 3"]
NoteIn the first example you can increase the first element twice and decrease the third element twice, so the sequence becomes $$$[3, 3, 5, 5]$$$, and the difference between maximum and minimum is $$$2$$$. You still can perform one operation after that, but it's useless since you can't make the answer less than $$$2$$...
PASSED
2,000
standard input
2 seconds
The first line contains two integers $$$n$$$ and $$$k$$$ $$$(2 \le n \le 10^{5}, 1 \le k \le 10^{14})$$$ β€” the number of elements in the sequence and the maximum number of times you can perform the operation, respectively. The second line contains a sequence of integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{...
["2", "0", "1"]
#include <stdio.h> #define MX 100008 void swap(long long *a,long long *b){ long long t = *a; *a = *b; *b = t; } int maxChild(long long *a,int n,int r,int x,int y){ if(x<n && a[r]<a[x]) r = x; if(y<n && a[r]<a[y]) r = y; return r; } void heapify(long long *a,int n,int r){ int c = maxChild(a, ...
You are given a sequence $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ integers.You may perform the following operation on this sequence: choose any element and either increase or decrease it by one.Calculate the minimum possible difference between the maximum element and the minimum element in the sequence, if you ...
Print the minimum possible difference between the maximum element and the minimum element in the sequence, if you can perform the aforementioned operation no more than $$$k$$$ times.
C
51113dfdbf9f59152712b60e7a14368a
90c2fb00faf98326992083ce0cc0c16a
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "greedy", "constructive algorithms", "two pointers", "sortings", "binary search", "ternary search" ]
1570957500
["4 5\n3 1 7 5", "3 10\n100 100 100", "10 9\n4 5 5 7 5 4 5 2 4 3"]
NoteIn the first example you can increase the first element twice and decrease the third element twice, so the sequence becomes $$$[3, 3, 5, 5]$$$, and the difference between maximum and minimum is $$$2$$$. You still can perform one operation after that, but it's useless since you can't make the answer less than $$$2$$...
PASSED
2,000
standard input
2 seconds
The first line contains two integers $$$n$$$ and $$$k$$$ $$$(2 \le n \le 10^{5}, 1 \le k \le 10^{14})$$$ β€” the number of elements in the sequence and the maximum number of times you can perform the operation, respectively. The second line contains a sequence of integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{...
["2", "0", "1"]
#include<stdio.h> #include<math.h> long long int a,b,sb1,sb2,i,j,k,l,times,shit,ass,n,cnm1,cnm2,cnm11,cnm22,mag,c,d,excited,ctmlgb=0,fuck[10000000],fuck2[300000]; int main() { scanf("%lld%lld",&a,&mag); b=log2(a)+1; for(i=0;i<=a-1;i++) { scanf("%lld",&fuck[i]); } for(i=1;i<=b;i++) { shit=pow(2,i); times=a/...
You are given a sequence $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ integers.You may perform the following operation on this sequence: choose any element and either increase or decrease it by one.Calculate the minimum possible difference between the maximum element and the minimum element in the sequence, if you ...
Print the minimum possible difference between the maximum element and the minimum element in the sequence, if you can perform the aforementioned operation no more than $$$k$$$ times.
C
51113dfdbf9f59152712b60e7a14368a
9cd724c01516e1b5dde4ff337174088f
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "greedy", "constructive algorithms", "two pointers", "sortings", "binary search", "ternary search" ]
1570957500
["4 5\n3 1 7 5", "3 10\n100 100 100", "10 9\n4 5 5 7 5 4 5 2 4 3"]
NoteIn the first example you can increase the first element twice and decrease the third element twice, so the sequence becomes $$$[3, 3, 5, 5]$$$, and the difference between maximum and minimum is $$$2$$$. You still can perform one operation after that, but it's useless since you can't make the answer less than $$$2$$...
PASSED
2,000
standard input
2 seconds
The first line contains two integers $$$n$$$ and $$$k$$$ $$$(2 \le n \le 10^{5}, 1 \le k \le 10^{14})$$$ β€” the number of elements in the sequence and the maximum number of times you can perform the operation, respectively. The second line contains a sequence of integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{...
["2", "0", "1"]
#include<string.h> #include<stdio.h> #include<stdlib.h> void merge(long long* arr, long long p, long long q, long long r) { long long i = 0, j = 0; long long* L = (long long*)malloc(sizeof(long long) * (q - p + 1)); long long* R = (long long*)malloc(sizeof(long long)*(r - q)); for (i = 0; i < q - p + 1; i++) { L[...
DZY loves Physics, and he enjoys calculating density.Almost everything has density, even a graph. We define the density of a non-directed graph (nodes and edges of the graph have some values) as follows: where v is the sum of the values of the nodes, e is the sum of the values of the edges.Once DZY got a graph G, now ...
Output a real number denoting the answer, with an absolute or relative error of at most 10 - 9.
C
ba4304e79d85d13c12233bcbcce6d0a6
e660470a55a8a67b20c52a7c5b092ff4
GNU C
standard output
256 megabytes
train_001.jsonl
[ "greedy", "math" ]
1404651900
["1 0\n1", "2 1\n1 2\n1 2 1", "5 6\n13 56 73 98 17\n1 2 56\n1 3 29\n1 4 42\n2 3 95\n2 4 88\n3 4 63"]
NoteIn the first sample, you can only choose an empty subgraph, or the subgraph containing only node 1.In the second sample, choosing the whole graph is optimal.
PASSED
1,600
standard input
1 second
The first line contains two space-separated integers nΒ (1 ≀ n ≀ 500), . Integer n represents the number of nodes of the graph G, m represents the number of edges. The second line contains n space-separated integers xiΒ (1 ≀ xi ≀ 106), where xi represents the value of the i-th node. Consider the graph nodes are numbered ...
["0.000000000000000", "3.000000000000000", "2.965517241379311"]
#include <stdio.h> #include <stdlib.h> int nodes[500]; struct edge { int a; int b; double value; }; struct edge edges[124750]; int cmp(const void* a,const void* b) { struct edge *c,*d; c=(struct edge*)a; d=(struct edge*)b; return d->value-c->value; } int main() { int n,m; int i; ...
DZY loves Physics, and he enjoys calculating density.Almost everything has density, even a graph. We define the density of a non-directed graph (nodes and edges of the graph have some values) as follows: where v is the sum of the values of the nodes, e is the sum of the values of the edges.Once DZY got a graph G, now ...
Output a real number denoting the answer, with an absolute or relative error of at most 10 - 9.
C
ba4304e79d85d13c12233bcbcce6d0a6
3172a4e3137f8e6da35bbf95e756d477
GNU C
standard output
256 megabytes
train_001.jsonl
[ "greedy", "math" ]
1404651900
["1 0\n1", "2 1\n1 2\n1 2 1", "5 6\n13 56 73 98 17\n1 2 56\n1 3 29\n1 4 42\n2 3 95\n2 4 88\n3 4 63"]
NoteIn the first sample, you can only choose an empty subgraph, or the subgraph containing only node 1.In the second sample, choosing the whole graph is optimal.
PASSED
1,600
standard input
1 second
The first line contains two space-separated integers nΒ (1 ≀ n ≀ 500), . Integer n represents the number of nodes of the graph G, m represents the number of edges. The second line contains n space-separated integers xiΒ (1 ≀ xi ≀ 106), where xi represents the value of the i-th node. Consider the graph nodes are numbered ...
["0.000000000000000", "3.000000000000000", "2.965517241379311"]
#include<stdio.h> #include<stdlib.h> #include<string.h> #define me(x) (memset(x,0,sizeof(x))) long n,m,va[505]; double max(double x,double y) { return x>y?x:y; } int main() { long i,a,b,c; double ans=0; scanf("%ld %ld",&n,&m); if (m==0) {printf("%.15lf",0.0); return 0;} for (i=1;i<=n;i++) scanf("%ld",&va[i]); fo...
DZY loves Physics, and he enjoys calculating density.Almost everything has density, even a graph. We define the density of a non-directed graph (nodes and edges of the graph have some values) as follows: where v is the sum of the values of the nodes, e is the sum of the values of the edges.Once DZY got a graph G, now ...
Output a real number denoting the answer, with an absolute or relative error of at most 10 - 9.
C
ba4304e79d85d13c12233bcbcce6d0a6
1e7299009ac2f60fa8d055cfa7d4273b
GNU C
standard output
256 megabytes
train_001.jsonl
[ "greedy", "math" ]
1404651900
["1 0\n1", "2 1\n1 2\n1 2 1", "5 6\n13 56 73 98 17\n1 2 56\n1 3 29\n1 4 42\n2 3 95\n2 4 88\n3 4 63"]
NoteIn the first sample, you can only choose an empty subgraph, or the subgraph containing only node 1.In the second sample, choosing the whole graph is optimal.
PASSED
1,600
standard input
1 second
The first line contains two space-separated integers nΒ (1 ≀ n ≀ 500), . Integer n represents the number of nodes of the graph G, m represents the number of edges. The second line contains n space-separated integers xiΒ (1 ≀ xi ≀ 106), where xi represents the value of the i-th node. Consider the graph nodes are numbered ...
["0.000000000000000", "3.000000000000000", "2.965517241379311"]
#include<stdio.h> double a[501]; int main() { int x,y,n,m,i; double max=0,c; scanf("%d%d",&n,&m); for(i=1;i<=n;++i) scanf("%lf",a+i); while(m--) { scanf("%d%d%lf",&x,&y,&c); if((a[x]+a[y])/c>max) max=(a[x]+a[y])/c; } printf("%0.9lf",max); return 0;...
DZY loves Physics, and he enjoys calculating density.Almost everything has density, even a graph. We define the density of a non-directed graph (nodes and edges of the graph have some values) as follows: where v is the sum of the values of the nodes, e is the sum of the values of the edges.Once DZY got a graph G, now ...
Output a real number denoting the answer, with an absolute or relative error of at most 10 - 9.
C
ba4304e79d85d13c12233bcbcce6d0a6
967874c0e34dac4d29fb6678ae17ac95
GNU C
standard output
256 megabytes
train_001.jsonl
[ "greedy", "math" ]
1404651900
["1 0\n1", "2 1\n1 2\n1 2 1", "5 6\n13 56 73 98 17\n1 2 56\n1 3 29\n1 4 42\n2 3 95\n2 4 88\n3 4 63"]
NoteIn the first sample, you can only choose an empty subgraph, or the subgraph containing only node 1.In the second sample, choosing the whole graph is optimal.
PASSED
1,600
standard input
1 second
The first line contains two space-separated integers nΒ (1 ≀ n ≀ 500), . Integer n represents the number of nodes of the graph G, m represents the number of edges. The second line contains n space-separated integers xiΒ (1 ≀ xi ≀ 106), where xi represents the value of the i-th node. Consider the graph nodes are numbered ...
["0.000000000000000", "3.000000000000000", "2.965517241379311"]
#include<stdio.h> double max(double a,double b){return a>b?a:b;} main() { int n,m,i,u,v;double ans=0,edge_val; scanf("%d%d",&n,&m); double a[n+1]; for(i=1; i<=n; i++) scanf("%lf",&a[i]); for(i=0; i<m; i++) { scanf("%d%d%lf",&u,&v,&edge_val); ans = max(ans,(a[u]+a[v])/edge_val); } printf("%.12lf",ans);return 0; }
Once Vasya and Petya assembled a figure of m cubes, each of them is associated with a number between 0 and m - 1 (inclusive, each number appeared exactly once). Let's consider a coordinate system such that the OX is the ground, and the OY is directed upwards. Each cube is associated with the coordinates of its lower le...
In the only line print the answer to the problem.
C
9f36d49541e6dd7082e37416cdb1949c
76b0328be1a0747b6ca63c00105fa6a4
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "greedy", "games" ]
1425279600
["3\n2 1\n1 0\n0 1", "5\n0 0\n0 1\n0 2\n0 3\n0 4"]
null
PASSED
2,100
standard input
3 seconds
The first line contains number m (2 ≀ m ≀ 105). The following m lines contain the coordinates of the cubes xi, yi ( - 109 ≀ xi ≀ 109, 0 ≀ yi ≀ 109) in ascending order of numbers written on them. It is guaranteed that the original figure is stable. No two cubes occupy the same place.
["19", "2930"]
#include <stdio.h> #include <stdlib.h> typedef long long ll; typedef int pair[2]; #define TAM ((1<<17)+5) #define MOD 1000000009LL #define add(a,b) (((a)+(b))%MOD) #define prod(a,b) (((a)*(b))%MOD) #define assign(a,b) memcpy(a,b,sizeof(a)) int cmp_int ( int a, int b ) { return ( a < b ? -1 : ( a == b ? 0 ...
Once Vasya and Petya assembled a figure of m cubes, each of them is associated with a number between 0 and m - 1 (inclusive, each number appeared exactly once). Let's consider a coordinate system such that the OX is the ground, and the OY is directed upwards. Each cube is associated with the coordinates of its lower le...
In the only line print the answer to the problem.
C
9f36d49541e6dd7082e37416cdb1949c
cfbb3896e1257977462b2f2cfcf38833
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "greedy", "games" ]
1425279600
["3\n2 1\n1 0\n0 1", "5\n0 0\n0 1\n0 2\n0 3\n0 4"]
null
PASSED
2,100
standard input
3 seconds
The first line contains number m (2 ≀ m ≀ 105). The following m lines contain the coordinates of the cubes xi, yi ( - 109 ≀ xi ≀ 109, 0 ≀ yi ≀ 109) in ascending order of numbers written on them. It is guaranteed that the original figure is stable. No two cubes occupy the same place.
["19", "2930"]
#include <stdio.h> #include <stdlib.h> typedef long long ll; typedef int pair[2]; #define TAM 100100 #define MOD 1000000009LL #define add(a,b) (((a)+(b))%MOD) #define prod(a,b) (((a)*(b))%MOD) #define assign(a,b) memcpy(a,b,sizeof(a)) int cmp_int ( int a, int b ) { return ( a < b ? -1 : ( a == b ? 0 : 1 )...
Once Vasya and Petya assembled a figure of m cubes, each of them is associated with a number between 0 and m - 1 (inclusive, each number appeared exactly once). Let's consider a coordinate system such that the OX is the ground, and the OY is directed upwards. Each cube is associated with the coordinates of its lower le...
In the only line print the answer to the problem.
C
9f36d49541e6dd7082e37416cdb1949c
e0c4b370a4135ed1e37db5758de13392
GNU C
standard output
256 megabytes
train_001.jsonl
[ "implementation", "greedy", "games" ]
1425279600
["3\n2 1\n1 0\n0 1", "5\n0 0\n0 1\n0 2\n0 3\n0 4"]
null
PASSED
2,100
standard input
3 seconds
The first line contains number m (2 ≀ m ≀ 105). The following m lines contain the coordinates of the cubes xi, yi ( - 109 ≀ xi ≀ 109, 0 ≀ yi ≀ 109) in ascending order of numbers written on them. It is guaranteed that the original figure is stable. No two cubes occupy the same place.
["19", "2930"]
#include <stdio.h> #include <stdlib.h> typedef long long ll; typedef int pair[2]; #define TAM (1<<18) #define MOD 1000000009LL #define add(a,b) (((a)+(b))%MOD) #define prod(a,b) (((a)*(b))%MOD) #define assign(a,b) memcpy(a,b,sizeof(a)) int cmp_int ( int a, int b ) { return ( a < b ? -1 : ( a == b ? 0 : 1 ...
There are n beacons located at distinct positions on a number line. The i-th beacon has position ai and power level bi. When the i-th beacon is activated, it destroys all beacons to its left (direction of decreasing coordinates) within distance bi inclusive. The beacon itself is not destroyed however. Saitama will acti...
Print a single integerΒ β€” the minimum number of beacons that could be destroyed if exactly one beacon is added.
C
bcd689387c9167c7d0d45d4ca3b0c4c7
3896d7eefd92316bba01f358b0153d9c
GNU C
standard output
256 megabytes
train_001.jsonl
[ "dp" ]
1450888500
["4\n1 9\n3 1\n6 1\n7 4", "7\n1 1\n2 1\n3 1\n4 1\n5 1\n6 1\n7 1"]
NoteFor the first sample case, the minimum number of beacons destroyed is 1. One way to achieve this is to place a beacon at position 9 with power level 2.For the second sample case, the minimum number of beacons destroyed is 3. One way to achieve this is to place a beacon at position 1337 with power level 42.
PASSED
1,600
standard input
2 seconds
The first line of input contains a single integer n (1 ≀ n ≀ 100 000) β€” the initial number of beacons. The i-th of next n lines contains two integers ai and bi (0 ≀ ai ≀ 1 000 000, 1 ≀ bi ≀ 1 000 000)Β β€” the position and power level of the i-th beacon respectively. No two beacons will have the same position, so ai ≠ aj ...
["1", "3"]
#include<stdio.h> int arr[2][100005],brr[2][100005]; int dp[1000003]; void merge(int b[][100005],int start,int mid ,int end) { int lctr=start,rctr=mid,k=0; for(k=start;lctr<mid&&rctr<end;k++) { if(b[0][lctr]<b[0][rctr]) { brr[1][k]=b[1][lctr]; brr[0][k]=b[0][lctr]; ...
There are n beacons located at distinct positions on a number line. The i-th beacon has position ai and power level bi. When the i-th beacon is activated, it destroys all beacons to its left (direction of decreasing coordinates) within distance bi inclusive. The beacon itself is not destroyed however. Saitama will acti...
Print a single integerΒ β€” the minimum number of beacons that could be destroyed if exactly one beacon is added.
C
bcd689387c9167c7d0d45d4ca3b0c4c7
2d49e926f09cef71a1562996fefaeb3d
GNU C
standard output
256 megabytes
train_001.jsonl
[ "dp" ]
1450888500
["4\n1 9\n3 1\n6 1\n7 4", "7\n1 1\n2 1\n3 1\n4 1\n5 1\n6 1\n7 1"]
NoteFor the first sample case, the minimum number of beacons destroyed is 1. One way to achieve this is to place a beacon at position 9 with power level 2.For the second sample case, the minimum number of beacons destroyed is 3. One way to achieve this is to place a beacon at position 1337 with power level 42.
PASSED
1,600
standard input
2 seconds
The first line of input contains a single integer n (1 ≀ n ≀ 100 000) β€” the initial number of beacons. The i-th of next n lines contains two integers ai and bi (0 ≀ ai ≀ 1 000 000, 1 ≀ bi ≀ 1 000 000)Β β€” the position and power level of the i-th beacon respectively. No two beacons will have the same position, so ai ≠ aj ...
["1", "3"]
#include<stdio.h> typedef unsigned u; u D[1111111],B[1111111]; int main() { u n,i=-1,j,k,l,s,r=-1; for(scanf("%u",&n);++i<n;D[j]=k)scanf("%u%u",&j,&k); for(i=-1;++i<1111111;)if(D[i]) { B[i]=(k=i?B[i-1]:0)+1; j=D[i]; l=i>j?i-j-1:-1u; if(l==-1u)s=k; else s=k-B[l]+D[l]; D[i]=s; if(r>(s+=n-k-1))r=s; } e...
There are n beacons located at distinct positions on a number line. The i-th beacon has position ai and power level bi. When the i-th beacon is activated, it destroys all beacons to its left (direction of decreasing coordinates) within distance bi inclusive. The beacon itself is not destroyed however. Saitama will acti...
Print a single integerΒ β€” the minimum number of beacons that could be destroyed if exactly one beacon is added.
C
bcd689387c9167c7d0d45d4ca3b0c4c7
d2059931afc48ac51a90ae2b7ec9f13c
GNU C
standard output
256 megabytes
train_001.jsonl
[ "dp" ]
1450888500
["4\n1 9\n3 1\n6 1\n7 4", "7\n1 1\n2 1\n3 1\n4 1\n5 1\n6 1\n7 1"]
NoteFor the first sample case, the minimum number of beacons destroyed is 1. One way to achieve this is to place a beacon at position 9 with power level 2.For the second sample case, the minimum number of beacons destroyed is 3. One way to achieve this is to place a beacon at position 1337 with power level 42.
PASSED
1,600
standard input
2 seconds
The first line of input contains a single integer n (1 ≀ n ≀ 100 000) β€” the initial number of beacons. The i-th of next n lines contains two integers ai and bi (0 ≀ ai ≀ 1 000 000, 1 ≀ bi ≀ 1 000 000)Β β€” the position and power level of the i-th beacon respectively. No two beacons will have the same position, so ai ≠ aj ...
["1", "3"]
#include<stdio.h> #include<stdlib.h> typedef struct __BEAM{ int ind; int p; }BEAM; int max(int a,int b){return a>b?a:b;} int min(int a,int b){return a<b?a:b;} int cmpfunc(const void *a,const void *b){ return ((BEAM *)a)->ind-((BEAM *)b)->ind; } int main(){ int n,left[1000006],dp[100005],i,j; BEAM ar[100005]; s...
A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros and ones, where 0 means that the corresponding column is all white, and 1 means...
If the photo can be a photo of zebra, print "YES" (without quotes). Otherwise, print "NO". You can print each letter in any case (upper or lower).
C
75a00d8a614fd0bcb8504b0268a121e0
1f8e6d2bf52bb1ebbbece640244907bb
GNU C11
standard output
256 megabytes
train_001.jsonl
[]
1521300900
["9\n0 0 0 1 1 1 0 0 0", "7\n0 0 0 1 1 1 1", "5\n1 1 1 1 1", "8\n1 1 1 0 0 0 1 1", "9\n1 1 0 1 1 0 1 1 0"]
NoteThe first two examples are described in the statements.In the third example all pixels are white, so the photo can be a photo of zebra.In the fourth example the width of the first stripe is equal to three (white color), the width of the second stripe is equal to three (black), and the width of the third stripe is e...
PASSED
1,700
standard input
1 second
The first line contains a single integer n (1 ≀ n ≀ 100 000) β€” the width of the photo. The second line contains a sequence of integers a1, a2, ..., an (0 ≀ ai ≀ 1) β€” the description of the photo. If ai is zero, the i-th column is all black. If ai is one, then the i-th column is all white.
["YES", "NO", "YES", "NO", "NO"]
#include <stdio.h> #include <math.h> // #include <bits/stdc++.h> // #define RET(_x) return std::cout << (_x) << '\n', 0; // #define endl "\n" // using namespace std; // using ll = int64_t; int main() { // ios_base::sync_with_stdio(false); // std::cin.tie(nullptr); int n; scanf("%d", &n); in...
A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros and ones, where 0 means that the corresponding column is all white, and 1 means...
If the photo can be a photo of zebra, print "YES" (without quotes). Otherwise, print "NO". You can print each letter in any case (upper or lower).
C
75a00d8a614fd0bcb8504b0268a121e0
13680060a6794ba4f99ea9bb293ff3bd
GNU C11
standard output
256 megabytes
train_001.jsonl
[]
1521300900
["9\n0 0 0 1 1 1 0 0 0", "7\n0 0 0 1 1 1 1", "5\n1 1 1 1 1", "8\n1 1 1 0 0 0 1 1", "9\n1 1 0 1 1 0 1 1 0"]
NoteThe first two examples are described in the statements.In the third example all pixels are white, so the photo can be a photo of zebra.In the fourth example the width of the first stripe is equal to three (white color), the width of the second stripe is equal to three (black), and the width of the third stripe is e...
PASSED
1,700
standard input
1 second
The first line contains a single integer n (1 ≀ n ≀ 100 000) β€” the width of the photo. The second line contains a sequence of integers a1, a2, ..., an (0 ≀ ai ≀ 1) β€” the description of the photo. If ai is zero, the i-th column is all black. If ai is one, then the i-th column is all white.
["YES", "NO", "YES", "NO", "NO"]
#include "stdio.h" int main(void) { int n; scanf("%d",&n); int i; int first_num; int j = 0; scanf("%d",&first_num); int per = 0; for(i = 1;i < n;i++) { int k; scanf("%d",&k); if(k != first_num) { if(!per) { per = i; } first_num = k; if(i-j == per)...
A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros and ones, where 0 means that the corresponding column is all white, and 1 means...
If the photo can be a photo of zebra, print "YES" (without quotes). Otherwise, print "NO". You can print each letter in any case (upper or lower).
C
75a00d8a614fd0bcb8504b0268a121e0
5ac2cd9c73972a86b7899e8009b41d06
GNU C11
standard output
256 megabytes
train_001.jsonl
[]
1521300900
["9\n0 0 0 1 1 1 0 0 0", "7\n0 0 0 1 1 1 1", "5\n1 1 1 1 1", "8\n1 1 1 0 0 0 1 1", "9\n1 1 0 1 1 0 1 1 0"]
NoteThe first two examples are described in the statements.In the third example all pixels are white, so the photo can be a photo of zebra.In the fourth example the width of the first stripe is equal to three (white color), the width of the second stripe is equal to three (black), and the width of the third stripe is e...
PASSED
1,700
standard input
1 second
The first line contains a single integer n (1 ≀ n ≀ 100 000) β€” the width of the photo. The second line contains a sequence of integers a1, a2, ..., an (0 ≀ ai ≀ 1) β€” the description of the photo. If ai is zero, the i-th column is all black. If ai is one, then the i-th column is all white.
["YES", "NO", "YES", "NO", "NO"]
#include<stdio.h> #include <conio.h> #include <math.h> #define M_PI 3.14159265358979323846 #pragma comment (linker, "/STACK:5000000000") #define ll long long #define sc(a) scanf("%d", &(a)); #define scl(a) scanf("%I64d", &(a)); #define mp make_pair #define pb push_back //const long long m = 1000000007; const int INF = ...
A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros and ones, where 0 means that the corresponding column is all white, and 1 means...
If the photo can be a photo of zebra, print "YES" (without quotes). Otherwise, print "NO". You can print each letter in any case (upper or lower).
C
75a00d8a614fd0bcb8504b0268a121e0
e01482e75e347ae18d2bfdc9bc0a62f1
GNU C11
standard output
256 megabytes
train_001.jsonl
[]
1521300900
["9\n0 0 0 1 1 1 0 0 0", "7\n0 0 0 1 1 1 1", "5\n1 1 1 1 1", "8\n1 1 1 0 0 0 1 1", "9\n1 1 0 1 1 0 1 1 0"]
NoteThe first two examples are described in the statements.In the third example all pixels are white, so the photo can be a photo of zebra.In the fourth example the width of the first stripe is equal to three (white color), the width of the second stripe is equal to three (black), and the width of the third stripe is e...
PASSED
1,700
standard input
1 second
The first line contains a single integer n (1 ≀ n ≀ 100 000) β€” the width of the photo. The second line contains a sequence of integers a1, a2, ..., an (0 ≀ ai ≀ 1) β€” the description of the photo. If ai is zero, the i-th column is all black. If ai is one, then the i-th column is all white.
["YES", "NO", "YES", "NO", "NO"]
// // main.cpp // test // // Created by Максим Π‘Π°Ρ‡ΡƒΡ€ΠΈΠ½ on 04.02.17. // Copyright Β© 2017 Максим Π‘Π°Ρ‡ΡƒΡ€ΠΈΠ½. All rights reserved. // #include <stdio.h> //using namespace std; int mas[100005]; char func(int d, int r, char zero) { char good = 1; for(int j = 0; j < d; j++) { for(int t = 0; t < r; t++) {...
A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros and ones, where 0 means that the corresponding column is all white, and 1 means...
If the photo can be a photo of zebra, print "YES" (without quotes). Otherwise, print "NO". You can print each letter in any case (upper or lower).
C
75a00d8a614fd0bcb8504b0268a121e0
10111c5e25c974420eab3a4400aa074d
GNU C11
standard output
256 megabytes
train_001.jsonl
[]
1521300900
["9\n0 0 0 1 1 1 0 0 0", "7\n0 0 0 1 1 1 1", "5\n1 1 1 1 1", "8\n1 1 1 0 0 0 1 1", "9\n1 1 0 1 1 0 1 1 0"]
NoteThe first two examples are described in the statements.In the third example all pixels are white, so the photo can be a photo of zebra.In the fourth example the width of the first stripe is equal to three (white color), the width of the second stripe is equal to three (black), and the width of the third stripe is e...
PASSED
1,700
standard input
1 second
The first line contains a single integer n (1 ≀ n ≀ 100 000) β€” the width of the photo. The second line contains a sequence of integers a1, a2, ..., an (0 ≀ ai ≀ 1) β€” the description of the photo. If ai is zero, the i-th column is all black. If ai is one, then the i-th column is all white.
["YES", "NO", "YES", "NO", "NO"]
#include<stdio.h> #include<stdlib.h> struct pair { int first, second; }; struct pair a[100005]; int point = 0; void push(int x, int y) { a[point].first = x; a[point].second = y; point++; } int main() { long n; scanf("%ld", &n); int ar[n]; for(int i = 0; i < n; ++i) scanf("%d", &ar[i]); ...
A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros and ones, where 0 means that the corresponding column is all white, and 1 means...
If the photo can be a photo of zebra, print "YES" (without quotes). Otherwise, print "NO". You can print each letter in any case (upper or lower).
C
75a00d8a614fd0bcb8504b0268a121e0
08ba85c8b875d557110f6c800e138ce1
GNU C11
standard output
256 megabytes
train_001.jsonl
[]
1521300900
["9\n0 0 0 1 1 1 0 0 0", "7\n0 0 0 1 1 1 1", "5\n1 1 1 1 1", "8\n1 1 1 0 0 0 1 1", "9\n1 1 0 1 1 0 1 1 0"]
NoteThe first two examples are described in the statements.In the third example all pixels are white, so the photo can be a photo of zebra.In the fourth example the width of the first stripe is equal to three (white color), the width of the second stripe is equal to three (black), and the width of the third stripe is e...
PASSED
1,700
standard input
1 second
The first line contains a single integer n (1 ≀ n ≀ 100 000) β€” the width of the photo. The second line contains a sequence of integers a1, a2, ..., an (0 ≀ ai ≀ 1) β€” the description of the photo. If ai is zero, the i-th column is all black. If ai is one, then the i-th column is all white.
["YES", "NO", "YES", "NO", "NO"]
#include <stdio.h> #include <stdlib.h> int mn = 100005; int a[10005]; int main() { int n, i, x, p = 0, len=-1, cur = 0; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d", &x); if (i == 0) { cur = 1; } else { if (x == p) { cur = cur + 1; ...
A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros and ones, where 0 means that the corresponding column is all white, and 1 means...
If the photo can be a photo of zebra, print "YES" (without quotes). Otherwise, print "NO". You can print each letter in any case (upper or lower).
C
75a00d8a614fd0bcb8504b0268a121e0
ed2ba5d33533f8722c967ef349556436
GNU C11
standard output
256 megabytes
train_001.jsonl
[]
1521300900
["9\n0 0 0 1 1 1 0 0 0", "7\n0 0 0 1 1 1 1", "5\n1 1 1 1 1", "8\n1 1 1 0 0 0 1 1", "9\n1 1 0 1 1 0 1 1 0"]
NoteThe first two examples are described in the statements.In the third example all pixels are white, so the photo can be a photo of zebra.In the fourth example the width of the first stripe is equal to three (white color), the width of the second stripe is equal to three (black), and the width of the third stripe is e...
PASSED
1,700
standard input
1 second
The first line contains a single integer n (1 ≀ n ≀ 100 000) β€” the width of the photo. The second line contains a sequence of integers a1, a2, ..., an (0 ≀ ai ≀ 1) β€” the description of the photo. If ai is zero, the i-th column is all black. If ai is one, then the i-th column is all white.
["YES", "NO", "YES", "NO", "NO"]
#include <stdio.h> #include <stdlib.h> #pragma warning(disable : 4996) int main() { int n; scanf("%i", &n); int col0 = 1, col1 = 0, maxCol = 0; int a; int last; scanf("%i", &last); int q = 1; for (q; q < n; q++) { scanf("%i", &a); if (a == last) col0++; else break; } last = a; maxCol = col0; if...
A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros and ones, where 0 means that the corresponding column is all white, and 1 means...
If the photo can be a photo of zebra, print "YES" (without quotes). Otherwise, print "NO". You can print each letter in any case (upper or lower).
C
75a00d8a614fd0bcb8504b0268a121e0
0cd76c7453983328f74ba70fdf0c8448
GNU C11
standard output
256 megabytes
train_001.jsonl
[]
1521300900
["9\n0 0 0 1 1 1 0 0 0", "7\n0 0 0 1 1 1 1", "5\n1 1 1 1 1", "8\n1 1 1 0 0 0 1 1", "9\n1 1 0 1 1 0 1 1 0"]
NoteThe first two examples are described in the statements.In the third example all pixels are white, so the photo can be a photo of zebra.In the fourth example the width of the first stripe is equal to three (white color), the width of the second stripe is equal to three (black), and the width of the third stripe is e...
PASSED
1,700
standard input
1 second
The first line contains a single integer n (1 ≀ n ≀ 100 000) β€” the width of the photo. The second line contains a sequence of integers a1, a2, ..., an (0 ≀ ai ≀ 1) β€” the description of the photo. If ai is zero, the i-th column is all black. If ai is one, then the i-th column is all white.
["YES", "NO", "YES", "NO", "NO"]
#include "stdio.h" #include "stdlib.h" int main(){ int w; scanf("%d", &w); // int* p = malloc(sizeof(int) * w); int counting = 1; int c = 0; int acc = 0; int first_col; int curr_col; int fail = 0; for(int i = 0; i < w; ++i){ int x; scanf("%d", &x); if(i==0){ first_col = x; +...
A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros and ones, where 0 means that the corresponding column is all white, and 1 means...
If the photo can be a photo of zebra, print "YES" (without quotes). Otherwise, print "NO". You can print each letter in any case (upper or lower).
C
75a00d8a614fd0bcb8504b0268a121e0
a3fe2ac014f1d7b4e7986bc9a44fcdf9
GNU C11
standard output
256 megabytes
train_001.jsonl
[]
1521300900
["9\n0 0 0 1 1 1 0 0 0", "7\n0 0 0 1 1 1 1", "5\n1 1 1 1 1", "8\n1 1 1 0 0 0 1 1", "9\n1 1 0 1 1 0 1 1 0"]
NoteThe first two examples are described in the statements.In the third example all pixels are white, so the photo can be a photo of zebra.In the fourth example the width of the first stripe is equal to three (white color), the width of the second stripe is equal to three (black), and the width of the third stripe is e...
PASSED
1,700
standard input
1 second
The first line contains a single integer n (1 ≀ n ≀ 100 000) β€” the width of the photo. The second line contains a sequence of integers a1, a2, ..., an (0 ≀ ai ≀ 1) β€” the description of the photo. If ai is zero, the i-th column is all black. If ai is one, then the i-th column is all white.
["YES", "NO", "YES", "NO", "NO"]
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> int main() { int t; int arr[100000]; scanf("%d", &t); for (int i = 0; i < t; i++) { scanf("%d", &arr[i]); } int bil = 0; int blak = 0; int tmp = 1; if (arr[0] == 1) { int i = 0; while (i < t && arr[i] == 1) { blak++; i++; } while (i < t &&...
A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros and ones, where 0 means that the corresponding column is all white, and 1 means...
If the photo can be a photo of zebra, print "YES" (without quotes). Otherwise, print "NO". You can print each letter in any case (upper or lower).
C
75a00d8a614fd0bcb8504b0268a121e0
bb931fa7303bca244d5eff42063d0cdd
GNU C11
standard output
256 megabytes
train_001.jsonl
[]
1521300900
["9\n0 0 0 1 1 1 0 0 0", "7\n0 0 0 1 1 1 1", "5\n1 1 1 1 1", "8\n1 1 1 0 0 0 1 1", "9\n1 1 0 1 1 0 1 1 0"]
NoteThe first two examples are described in the statements.In the third example all pixels are white, so the photo can be a photo of zebra.In the fourth example the width of the first stripe is equal to three (white color), the width of the second stripe is equal to three (black), and the width of the third stripe is e...
PASSED
1,700
standard input
1 second
The first line contains a single integer n (1 ≀ n ≀ 100 000) β€” the width of the photo. The second line contains a sequence of integers a1, a2, ..., an (0 ≀ ai ≀ 1) β€” the description of the photo. If ai is zero, the i-th column is all black. If ai is one, then the i-th column is all white.
["YES", "NO", "YES", "NO", "NO"]
#include <stdio.h> int main() { // your code goes here long int n; scanf("%ld",&n); int num; int last=-1,lwidth=-1,cwidth=0; int pos=1; for(long int i=0;i<n;i++){ scanf("%d",&num); if(pos==0) continue; if(last==-1 || last==num) cwidth++; else{ if(lwidth==-1){ lwidth=cwidth; cwidth=1; ...
A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros and ones, where 0 means that the corresponding column is all white, and 1 means...
If the photo can be a photo of zebra, print "YES" (without quotes). Otherwise, print "NO". You can print each letter in any case (upper or lower).
C
75a00d8a614fd0bcb8504b0268a121e0
64d518245f320030540e69f615954b87
GNU C11
standard output
256 megabytes
train_001.jsonl
[]
1521300900
["9\n0 0 0 1 1 1 0 0 0", "7\n0 0 0 1 1 1 1", "5\n1 1 1 1 1", "8\n1 1 1 0 0 0 1 1", "9\n1 1 0 1 1 0 1 1 0"]
NoteThe first two examples are described in the statements.In the third example all pixels are white, so the photo can be a photo of zebra.In the fourth example the width of the first stripe is equal to three (white color), the width of the second stripe is equal to three (black), and the width of the third stripe is e...
PASSED
1,700
standard input
1 second
The first line contains a single integer n (1 ≀ n ≀ 100 000) β€” the width of the photo. The second line contains a sequence of integers a1, a2, ..., an (0 ≀ ai ≀ 1) β€” the description of the photo. If ai is zero, the i-th column is all black. If ai is one, then the i-th column is all white.
["YES", "NO", "YES", "NO", "NO"]
#include <stdio.h> #define FOR(i, s, f) for (int (i) = (s); (i) < (f); ++(i)) #define forn(i, f) FOR((i), 0, (f)) #define sci(a) scanf("%d", &(a)) #define scid(a) int (a); sci(a) #define scvin(a, n) forn(IT_FOR_SCANNING, (n)) sci((a)[IT_FOR_SCANNING]) int a[300000]; int main() { scid(n); scvin(a, n); i...
A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros and ones, where 0 means that the corresponding column is all white, and 1 means...
If the photo can be a photo of zebra, print "YES" (without quotes). Otherwise, print "NO". You can print each letter in any case (upper or lower).
C
75a00d8a614fd0bcb8504b0268a121e0
7781e47f8c6e2ae0cc9bc2ec1cb0f19a
GNU C11
standard output
256 megabytes
train_001.jsonl
[]
1521300900
["9\n0 0 0 1 1 1 0 0 0", "7\n0 0 0 1 1 1 1", "5\n1 1 1 1 1", "8\n1 1 1 0 0 0 1 1", "9\n1 1 0 1 1 0 1 1 0"]
NoteThe first two examples are described in the statements.In the third example all pixels are white, so the photo can be a photo of zebra.In the fourth example the width of the first stripe is equal to three (white color), the width of the second stripe is equal to three (black), and the width of the third stripe is e...
PASSED
1,700
standard input
1 second
The first line contains a single integer n (1 ≀ n ≀ 100 000) β€” the width of the photo. The second line contains a sequence of integers a1, a2, ..., an (0 ≀ ai ≀ 1) β€” the description of the photo. If ai is zero, the i-th column is all black. If ai is one, then the i-th column is all white.
["YES", "NO", "YES", "NO", "NO"]
#include <stdio.h> int main() { int n; int a[100007]; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", &a[i]); int cur = a[0]; int p1 = 0; int i = 0; int fl = 1; int len = -1; while (i < n) { cur = a[i]; while (i < n && a[i] == cur) ...
A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros and ones, where 0 means that the corresponding column is all white, and 1 means...
If the photo can be a photo of zebra, print "YES" (without quotes). Otherwise, print "NO". You can print each letter in any case (upper or lower).
C
75a00d8a614fd0bcb8504b0268a121e0
211f1ecf44527c9e7a5664ef4b417c3f
GNU C11
standard output
256 megabytes
train_001.jsonl
[]
1521300900
["9\n0 0 0 1 1 1 0 0 0", "7\n0 0 0 1 1 1 1", "5\n1 1 1 1 1", "8\n1 1 1 0 0 0 1 1", "9\n1 1 0 1 1 0 1 1 0"]
NoteThe first two examples are described in the statements.In the third example all pixels are white, so the photo can be a photo of zebra.In the fourth example the width of the first stripe is equal to three (white color), the width of the second stripe is equal to three (black), and the width of the third stripe is e...
PASSED
1,700
standard input
1 second
The first line contains a single integer n (1 ≀ n ≀ 100 000) β€” the width of the photo. The second line contains a sequence of integers a1, a2, ..., an (0 ≀ ai ≀ 1) β€” the description of the photo. If ai is zero, the i-th column is all black. If ai is one, then the i-th column is all white.
["YES", "NO", "YES", "NO", "NO"]
#include <stdio.h> int a[100009]; int main() { int n; scanf("%d", &n); int cnt = 1, pr, tcnt = 0, f = 0, ans = 1; scanf("%d", &pr); for (int i = 1; i < n; ++i) { int x; scanf("%d", &x); if (x == pr) { if (!f) ++cnt; else ++tcnt; } els...
A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros and ones, where 0 means that the corresponding column is all white, and 1 means...
If the photo can be a photo of zebra, print "YES" (without quotes). Otherwise, print "NO". You can print each letter in any case (upper or lower).
C
75a00d8a614fd0bcb8504b0268a121e0
175bb5ffd7a8ad11a56a19d37efd29e0
GNU C11
standard output
256 megabytes
train_001.jsonl
[]
1521300900
["9\n0 0 0 1 1 1 0 0 0", "7\n0 0 0 1 1 1 1", "5\n1 1 1 1 1", "8\n1 1 1 0 0 0 1 1", "9\n1 1 0 1 1 0 1 1 0"]
NoteThe first two examples are described in the statements.In the third example all pixels are white, so the photo can be a photo of zebra.In the fourth example the width of the first stripe is equal to three (white color), the width of the second stripe is equal to three (black), and the width of the third stripe is e...
PASSED
1,700
standard input
1 second
The first line contains a single integer n (1 ≀ n ≀ 100 000) β€” the width of the photo. The second line contains a sequence of integers a1, a2, ..., an (0 ≀ ai ≀ 1) β€” the description of the photo. If ai is zero, the i-th column is all black. If ai is one, then the i-th column is all white.
["YES", "NO", "YES", "NO", "NO"]
#include <stdio.h> #define ACCEPTED return 0; int A[100001]; int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", &A[i]); int color = A[0]; int len = 0, cur = 1; for (int i = 1; i < n; i++) if (A[i] == color) cur++; else { if (len == 0) len = cur; else if (len != cur) { pr...
A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros and ones, where 0 means that the corresponding column is all white, and 1 means...
If the photo can be a photo of zebra, print "YES" (without quotes). Otherwise, print "NO". You can print each letter in any case (upper or lower).
C
75a00d8a614fd0bcb8504b0268a121e0
377ad361ac474e937014f35a9d995ab3
GNU C11
standard output
256 megabytes
train_001.jsonl
[]
1521300900
["9\n0 0 0 1 1 1 0 0 0", "7\n0 0 0 1 1 1 1", "5\n1 1 1 1 1", "8\n1 1 1 0 0 0 1 1", "9\n1 1 0 1 1 0 1 1 0"]
NoteThe first two examples are described in the statements.In the third example all pixels are white, so the photo can be a photo of zebra.In the fourth example the width of the first stripe is equal to three (white color), the width of the second stripe is equal to three (black), and the width of the third stripe is e...
PASSED
1,700
standard input
1 second
The first line contains a single integer n (1 ≀ n ≀ 100 000) β€” the width of the photo. The second line contains a sequence of integers a1, a2, ..., an (0 ≀ ai ≀ 1) β€” the description of the photo. If ai is zero, the i-th column is all black. If ai is one, then the i-th column is all white.
["YES", "NO", "YES", "NO", "NO"]
#include <stdio.h> int main() { int n, a[100010], pref[100010]; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d", &a[i]); if (i == 0) pref[i] = a[i]; else pref[i] = pref[i - 1] + a[i]; } for (int len = 1; len <= n; len++) if (n % len == 0) { int can = pref[len - 1] == 0 || pref[len - 1]...
A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros and ones, where 0 means that the corresponding column is all white, and 1 means...
If the photo can be a photo of zebra, print "YES" (without quotes). Otherwise, print "NO". You can print each letter in any case (upper or lower).
C
75a00d8a614fd0bcb8504b0268a121e0
848d33dd24c7a2e358d218959a0750fb
GNU C11
standard output
256 megabytes
train_001.jsonl
[]
1521300900
["9\n0 0 0 1 1 1 0 0 0", "7\n0 0 0 1 1 1 1", "5\n1 1 1 1 1", "8\n1 1 1 0 0 0 1 1", "9\n1 1 0 1 1 0 1 1 0"]
NoteThe first two examples are described in the statements.In the third example all pixels are white, so the photo can be a photo of zebra.In the fourth example the width of the first stripe is equal to three (white color), the width of the second stripe is equal to three (black), and the width of the third stripe is e...
PASSED
1,700
standard input
1 second
The first line contains a single integer n (1 ≀ n ≀ 100 000) β€” the width of the photo. The second line contains a sequence of integers a1, a2, ..., an (0 ≀ ai ≀ 1) β€” the description of the photo. If ai is zero, the i-th column is all black. If ai is one, then the i-th column is all white.
["YES", "NO", "YES", "NO", "NO"]
#include <stdio.h> int main() { int n; scanf("%d", &n); int a[n]; for (int i = 0; i < n; ++i) { scanf("%d", &a[i]); } int i = 1; while (i < n && a[i] == a[i - 1]) { ++i; } if (i == n) { printf("YES"); return 0; } int best = i; ...
A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros and ones, where 0 means that the corresponding column is all white, and 1 means...
If the photo can be a photo of zebra, print "YES" (without quotes). Otherwise, print "NO". You can print each letter in any case (upper or lower).
C
75a00d8a614fd0bcb8504b0268a121e0
1bc18b76fbf675895fe7c404b40a65c9
GNU C11
standard output
256 megabytes
train_001.jsonl
[]
1521300900
["9\n0 0 0 1 1 1 0 0 0", "7\n0 0 0 1 1 1 1", "5\n1 1 1 1 1", "8\n1 1 1 0 0 0 1 1", "9\n1 1 0 1 1 0 1 1 0"]
NoteThe first two examples are described in the statements.In the third example all pixels are white, so the photo can be a photo of zebra.In the fourth example the width of the first stripe is equal to three (white color), the width of the second stripe is equal to three (black), and the width of the third stripe is e...
PASSED
1,700
standard input
1 second
The first line contains a single integer n (1 ≀ n ≀ 100 000) β€” the width of the photo. The second line contains a sequence of integers a1, a2, ..., an (0 ≀ ai ≀ 1) β€” the description of the photo. If ai is zero, the i-th column is all black. If ai is one, then the i-th column is all white.
["YES", "NO", "YES", "NO", "NO"]
#include <stdio.h> //#include <algorithm> //#include <math.h> //#define ll long long // #define ld long double int main() { int n,m,k,l,p=-1,a[100005]={}; scanf("%d",&n); for (int i=1; i<=n; i++) scanf("%d",&a[i]); a[0]=a[1]; a[n...
A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros and ones, where 0 means that the corresponding column is all white, and 1 means...
If the photo can be a photo of zebra, print "YES" (without quotes). Otherwise, print "NO". You can print each letter in any case (upper or lower).
C
75a00d8a614fd0bcb8504b0268a121e0
044e8e233c6692f44e88dd4b895815f0
GNU C11
standard output
256 megabytes
train_001.jsonl
[]
1521300900
["9\n0 0 0 1 1 1 0 0 0", "7\n0 0 0 1 1 1 1", "5\n1 1 1 1 1", "8\n1 1 1 0 0 0 1 1", "9\n1 1 0 1 1 0 1 1 0"]
NoteThe first two examples are described in the statements.In the third example all pixels are white, so the photo can be a photo of zebra.In the fourth example the width of the first stripe is equal to three (white color), the width of the second stripe is equal to three (black), and the width of the third stripe is e...
PASSED
1,700
standard input
1 second
The first line contains a single integer n (1 ≀ n ≀ 100 000) β€” the width of the photo. The second line contains a sequence of integers a1, a2, ..., an (0 ≀ ai ≀ 1) β€” the description of the photo. If ai is zero, the i-th column is all black. If ai is one, then the i-th column is all white.
["YES", "NO", "YES", "NO", "NO"]
int main() { int n; scanf("%d", &n); int a[n]; for (int i = 0; i<n; i++) scanf("%d", &a[i]); int temp = 0; int idx = 0; int kek = 1; while ((idx<n-1)&&(a[idx]==a[idx+1])) { idx++; temp++; } idx++; while (idx<n) { int temp1 = 0; ...
A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros and ones, where 0 means that the corresponding column is all white, and 1 means...
If the photo can be a photo of zebra, print "YES" (without quotes). Otherwise, print "NO". You can print each letter in any case (upper or lower).
C
75a00d8a614fd0bcb8504b0268a121e0
1f1dfa538340f2c4a2c2c54dfd7a2325
GNU C11
standard output
256 megabytes
train_001.jsonl
[]
1521300900
["9\n0 0 0 1 1 1 0 0 0", "7\n0 0 0 1 1 1 1", "5\n1 1 1 1 1", "8\n1 1 1 0 0 0 1 1", "9\n1 1 0 1 1 0 1 1 0"]
NoteThe first two examples are described in the statements.In the third example all pixels are white, so the photo can be a photo of zebra.In the fourth example the width of the first stripe is equal to three (white color), the width of the second stripe is equal to three (black), and the width of the third stripe is e...
PASSED
1,700
standard input
1 second
The first line contains a single integer n (1 ≀ n ≀ 100 000) β€” the width of the photo. The second line contains a sequence of integers a1, a2, ..., an (0 ≀ ai ≀ 1) β€” the description of the photo. If ai is zero, the i-th column is all black. If ai is one, then the i-th column is all white.
["YES", "NO", "YES", "NO", "NO"]
#include <stdio.h> #include <stdlib.h> #include <malloc.h> #include <math.h> int main(void) { int size, min = -1, max = -1, count = 0; scanf("%d", &size); for (int i = 0, loc, st = -1; i < size; i++) { scanf("%d", &loc); if (st == -1) st = loc; if (loc != st) { if (min == -1 || count < min) min = co...
A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros and ones, where 0 means that the corresponding column is all white, and 1 means...
If the photo can be a photo of zebra, print "YES" (without quotes). Otherwise, print "NO". You can print each letter in any case (upper or lower).
C
75a00d8a614fd0bcb8504b0268a121e0
7afe691d8e3c66aad7ec02a488f0700a
GNU C11
standard output
256 megabytes
train_001.jsonl
[]
1521300900
["9\n0 0 0 1 1 1 0 0 0", "7\n0 0 0 1 1 1 1", "5\n1 1 1 1 1", "8\n1 1 1 0 0 0 1 1", "9\n1 1 0 1 1 0 1 1 0"]
NoteThe first two examples are described in the statements.In the third example all pixels are white, so the photo can be a photo of zebra.In the fourth example the width of the first stripe is equal to three (white color), the width of the second stripe is equal to three (black), and the width of the third stripe is e...
PASSED
1,700
standard input
1 second
The first line contains a single integer n (1 ≀ n ≀ 100 000) β€” the width of the photo. The second line contains a sequence of integers a1, a2, ..., an (0 ≀ ai ≀ 1) β€” the description of the photo. If ai is zero, the i-th column is all black. If ai is one, then the i-th column is all white.
["YES", "NO", "YES", "NO", "NO"]
#include <stdio.h> int main() { int n; scanf("%d", &n); int result = 1; int currentColor = 0; int requiredLength = 0; int currentLength = 0; int i = 0; for ( ; i < n; ++i ) { int cur; scanf("%d", &cur); if ( cur == currentColor ) { ++cur...
A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros and ones, where 0 means that the corresponding column is all white, and 1 means...
If the photo can be a photo of zebra, print "YES" (without quotes). Otherwise, print "NO". You can print each letter in any case (upper or lower).
C
75a00d8a614fd0bcb8504b0268a121e0
c3ece7e15a9db69380e99226df78c684
GNU C11
standard output
256 megabytes
train_001.jsonl
[]
1521300900
["9\n0 0 0 1 1 1 0 0 0", "7\n0 0 0 1 1 1 1", "5\n1 1 1 1 1", "8\n1 1 1 0 0 0 1 1", "9\n1 1 0 1 1 0 1 1 0"]
NoteThe first two examples are described in the statements.In the third example all pixels are white, so the photo can be a photo of zebra.In the fourth example the width of the first stripe is equal to three (white color), the width of the second stripe is equal to three (black), and the width of the third stripe is e...
PASSED
1,700
standard input
1 second
The first line contains a single integer n (1 ≀ n ≀ 100 000) β€” the width of the photo. The second line contains a sequence of integers a1, a2, ..., an (0 ≀ ai ≀ 1) β€” the description of the photo. If ai is zero, the i-th column is all black. If ai is one, then the i-th column is all white.
["YES", "NO", "YES", "NO", "NO"]
//#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> int n, k, a[100100], b[100100], frr; int main() { scanf("%d", &n); for (int i = 0; i < n; ++i) { scanf("%d", &k); a[i] = k; } int q = 0, l = 0; for (int i = 0; i < n; ++i) { if (q == 0) if (a[i] == 1) { l = 1; q = 1; } else { l = 1; ...
A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros and ones, where 0 means that the corresponding column is all white, and 1 means...
If the photo can be a photo of zebra, print "YES" (without quotes). Otherwise, print "NO". You can print each letter in any case (upper or lower).
C
75a00d8a614fd0bcb8504b0268a121e0
05537b6b30ae0271ae62967706837f2d
GNU C11
standard output
256 megabytes
train_001.jsonl
[]
1521300900
["9\n0 0 0 1 1 1 0 0 0", "7\n0 0 0 1 1 1 1", "5\n1 1 1 1 1", "8\n1 1 1 0 0 0 1 1", "9\n1 1 0 1 1 0 1 1 0"]
NoteThe first two examples are described in the statements.In the third example all pixels are white, so the photo can be a photo of zebra.In the fourth example the width of the first stripe is equal to three (white color), the width of the second stripe is equal to three (black), and the width of the third stripe is e...
PASSED
1,700
standard input
1 second
The first line contains a single integer n (1 ≀ n ≀ 100 000) β€” the width of the photo. The second line contains a sequence of integers a1, a2, ..., an (0 ≀ ai ≀ 1) β€” the description of the photo. If ai is zero, the i-th column is all black. If ai is one, then the i-th column is all white.
["YES", "NO", "YES", "NO", "NO"]
#include <stdio.h> #include<string.h> int main() { int n; scanf("%d", &n); int a[n]; for (int i = 0; i < n; ++i) { scanf("%d", &a[i]); } int have=-1, cnt=1; for (int i = 1; i < n; ++i) { if(a[i]==a[i-1]) { cnt++; } else { if(h...
A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros and ones, where 0 means that the corresponding column is all white, and 1 means...
If the photo can be a photo of zebra, print "YES" (without quotes). Otherwise, print "NO". You can print each letter in any case (upper or lower).
C
75a00d8a614fd0bcb8504b0268a121e0
b12d61e8e512548dcb5a395455f599be
GNU C11
standard output
256 megabytes
train_001.jsonl
[]
1521300900
["9\n0 0 0 1 1 1 0 0 0", "7\n0 0 0 1 1 1 1", "5\n1 1 1 1 1", "8\n1 1 1 0 0 0 1 1", "9\n1 1 0 1 1 0 1 1 0"]
NoteThe first two examples are described in the statements.In the third example all pixels are white, so the photo can be a photo of zebra.In the fourth example the width of the first stripe is equal to three (white color), the width of the second stripe is equal to three (black), and the width of the third stripe is e...
PASSED
1,700
standard input
1 second
The first line contains a single integer n (1 ≀ n ≀ 100 000) β€” the width of the photo. The second line contains a sequence of integers a1, a2, ..., an (0 ≀ ai ≀ 1) β€” the description of the photo. If ai is zero, the i-th column is all black. If ai is one, then the i-th column is all white.
["YES", "NO", "YES", "NO", "NO"]
#include <stdio.h> #include <memory.h> #include <math.h> #include <stdlib.h> #define int64_t long long int64_t nxt() { int64_t x; scanf("%I64d", &x); return x; } // please, accepted! int main() { int64_t n = nxt(); int64_t mas[n]; for(int i = 0; i < n; i++) { mas[i] = nxt();...
A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros and ones, where 0 means that the corresponding column is all white, and 1 means...
If the photo can be a photo of zebra, print "YES" (without quotes). Otherwise, print "NO". You can print each letter in any case (upper or lower).
C
75a00d8a614fd0bcb8504b0268a121e0
18e18d67133a38b76fcd5f111fb1203a
GNU C11
standard output
256 megabytes
train_001.jsonl
[]
1521300900
["9\n0 0 0 1 1 1 0 0 0", "7\n0 0 0 1 1 1 1", "5\n1 1 1 1 1", "8\n1 1 1 0 0 0 1 1", "9\n1 1 0 1 1 0 1 1 0"]
NoteThe first two examples are described in the statements.In the third example all pixels are white, so the photo can be a photo of zebra.In the fourth example the width of the first stripe is equal to three (white color), the width of the second stripe is equal to three (black), and the width of the third stripe is e...
PASSED
1,700
standard input
1 second
The first line contains a single integer n (1 ≀ n ≀ 100 000) β€” the width of the photo. The second line contains a sequence of integers a1, a2, ..., an (0 ≀ ai ≀ 1) β€” the description of the photo. If ai is zero, the i-th column is all black. If ai is one, then the i-th column is all white.
["YES", "NO", "YES", "NO", "NO"]
#include<stdio.h> int main() { int t=1; //cin>>t; while(t--){ int n; scanf("%d",&n); int a[n]; for(int i=0;i<n;i++){ scanf("%d",&a[i]); } for(int len=1;len<=n;len++){ if(n%len!=0) continue; int i=0,j=0; int turn=a[0]; while(i<n){ if(a[j]!=turn) break; j++; if(j-...
A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros and ones, where 0 means that the corresponding column is all white, and 1 means...
If the photo can be a photo of zebra, print "YES" (without quotes). Otherwise, print "NO". You can print each letter in any case (upper or lower).
C
75a00d8a614fd0bcb8504b0268a121e0
474f095476fce4cf51f2459078ae1f82
GNU C11
standard output
256 megabytes
train_001.jsonl
[]
1521300900
["9\n0 0 0 1 1 1 0 0 0", "7\n0 0 0 1 1 1 1", "5\n1 1 1 1 1", "8\n1 1 1 0 0 0 1 1", "9\n1 1 0 1 1 0 1 1 0"]
NoteThe first two examples are described in the statements.In the third example all pixels are white, so the photo can be a photo of zebra.In the fourth example the width of the first stripe is equal to three (white color), the width of the second stripe is equal to three (black), and the width of the third stripe is e...
PASSED
1,700
standard input
1 second
The first line contains a single integer n (1 ≀ n ≀ 100 000) β€” the width of the photo. The second line contains a sequence of integers a1, a2, ..., an (0 ≀ ai ≀ 1) β€” the description of the photo. If ai is zero, the i-th column is all black. If ai is one, then the i-th column is all white.
["YES", "NO", "YES", "NO", "NO"]
#include <stdio.h> int n, a[100002], nr, ans[100002], db; int main() { scanf("%d",&n);//cin >> n; for(int i = 1; i <= n; i++) scanf("%d",&a[i]);//cin >> a[i]; a[0] = -1; a[n + 1] = -1; nr = -1; db = 0; for(int i = 1; i <= n + 1; i++){ if(a[i] != a[i - 1]){ nr = nr + 1; ans[nr]...
A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros and ones, where 0 means that the corresponding column is all white, and 1 means...
If the photo can be a photo of zebra, print "YES" (without quotes). Otherwise, print "NO". You can print each letter in any case (upper or lower).
C
75a00d8a614fd0bcb8504b0268a121e0
7f6c0c91c5d82e0a2d393c14f7268888
GNU C11
standard output
256 megabytes
train_001.jsonl
[]
1521300900
["9\n0 0 0 1 1 1 0 0 0", "7\n0 0 0 1 1 1 1", "5\n1 1 1 1 1", "8\n1 1 1 0 0 0 1 1", "9\n1 1 0 1 1 0 1 1 0"]
NoteThe first two examples are described in the statements.In the third example all pixels are white, so the photo can be a photo of zebra.In the fourth example the width of the first stripe is equal to three (white color), the width of the second stripe is equal to three (black), and the width of the third stripe is e...
PASSED
1,700
standard input
1 second
The first line contains a single integer n (1 ≀ n ≀ 100 000) β€” the width of the photo. The second line contains a sequence of integers a1, a2, ..., an (0 ≀ ai ≀ 1) β€” the description of the photo. If ai is zero, the i-th column is all black. If ai is one, then the i-th column is all white.
["YES", "NO", "YES", "NO", "NO"]
#include <stdio.h> int a[100005]; int main(){ int i; int n; scanf("%d", &n); for (i=0;i<n;i++) scanf("%d", &a[i]); int c[100005][2], mxi=0; int cur=1; for (i=1;i<n;i++){ if (a[i]==a[i-1]) cur++; else{ c[mxi][0]=cur; c[mxi][1]=a[i-1]; ...
A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros and ones, where 0 means that the corresponding column is all white, and 1 means...
If the photo can be a photo of zebra, print "YES" (without quotes). Otherwise, print "NO". You can print each letter in any case (upper or lower).
C
75a00d8a614fd0bcb8504b0268a121e0
7bf91b565ef7a0cf03918d9b018df7ee
GNU C11
standard output
256 megabytes
train_001.jsonl
[]
1521300900
["9\n0 0 0 1 1 1 0 0 0", "7\n0 0 0 1 1 1 1", "5\n1 1 1 1 1", "8\n1 1 1 0 0 0 1 1", "9\n1 1 0 1 1 0 1 1 0"]
NoteThe first two examples are described in the statements.In the third example all pixels are white, so the photo can be a photo of zebra.In the fourth example the width of the first stripe is equal to three (white color), the width of the second stripe is equal to three (black), and the width of the third stripe is e...
PASSED
1,700
standard input
1 second
The first line contains a single integer n (1 ≀ n ≀ 100 000) β€” the width of the photo. The second line contains a sequence of integers a1, a2, ..., an (0 ≀ ai ≀ 1) β€” the description of the photo. If ai is zero, the i-th column is all black. If ai is one, then the i-th column is all white.
["YES", "NO", "YES", "NO", "NO"]
#include <stdlib.h> #include <stdio.h> int main() { int n; scanf("%d", &n); int a[n]; for(int i = 0; i < n; i++) scanf("%d", &a[i]); int cur = a[0], counter = 0; for(int i = 0; i < n; i++) if(a[i] != cur) break; else counter++; if(n ...
A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros and ones, where 0 means that the corresponding column is all white, and 1 means...
If the photo can be a photo of zebra, print "YES" (without quotes). Otherwise, print "NO". You can print each letter in any case (upper or lower).
C
75a00d8a614fd0bcb8504b0268a121e0
e523caba684e9b5999e0e157d403c34c
GNU C11
standard output
256 megabytes
train_001.jsonl
[]
1521300900
["9\n0 0 0 1 1 1 0 0 0", "7\n0 0 0 1 1 1 1", "5\n1 1 1 1 1", "8\n1 1 1 0 0 0 1 1", "9\n1 1 0 1 1 0 1 1 0"]
NoteThe first two examples are described in the statements.In the third example all pixels are white, so the photo can be a photo of zebra.In the fourth example the width of the first stripe is equal to three (white color), the width of the second stripe is equal to three (black), and the width of the third stripe is e...
PASSED
1,700
standard input
1 second
The first line contains a single integer n (1 ≀ n ≀ 100 000) β€” the width of the photo. The second line contains a sequence of integers a1, a2, ..., an (0 ≀ ai ≀ 1) β€” the description of the photo. If ai is zero, the i-th column is all black. If ai is one, then the i-th column is all white.
["YES", "NO", "YES", "NO", "NO"]
#include <stdio.h> int main() { int all[100001]; int n; scanf("%d", &n); for (int i=0; i<n; i++){ scanf("%d", &all[i]); } int first = 1; int z = 1; int line; int count = 0; for (int i=0; i<n-1; i++){ if ((all[i] != all[i+1])){ if (first == 1){ ...
A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros and ones, where 0 means that the corresponding column is all white, and 1 means...
If the photo can be a photo of zebra, print "YES" (without quotes). Otherwise, print "NO". You can print each letter in any case (upper or lower).
C
75a00d8a614fd0bcb8504b0268a121e0
c1e97054fbe6ccc0d212913107f00251
GNU C11
standard output
256 megabytes
train_001.jsonl
[]
1521300900
["9\n0 0 0 1 1 1 0 0 0", "7\n0 0 0 1 1 1 1", "5\n1 1 1 1 1", "8\n1 1 1 0 0 0 1 1", "9\n1 1 0 1 1 0 1 1 0"]
NoteThe first two examples are described in the statements.In the third example all pixels are white, so the photo can be a photo of zebra.In the fourth example the width of the first stripe is equal to three (white color), the width of the second stripe is equal to three (black), and the width of the third stripe is e...
PASSED
1,700
standard input
1 second
The first line contains a single integer n (1 ≀ n ≀ 100 000) β€” the width of the photo. The second line contains a sequence of integers a1, a2, ..., an (0 ≀ ai ≀ 1) β€” the description of the photo. If ai is zero, the i-th column is all black. If ai is one, then the i-th column is all white.
["YES", "NO", "YES", "NO", "NO"]
#include <stdio.h> #include <stdlib.h> int main() { int digits; scanf("%d\n", &digits); int length = digits*2; char* str; str = calloc(sizeof(char), length); fgets(str, digits*2, stdin); int comboFound = 0; int currCombo = 1; int targetCombo = 1; char lastChar; lastChar = s...
A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros and ones, where 0 means that the corresponding column is all white, and 1 means...
If the photo can be a photo of zebra, print "YES" (without quotes). Otherwise, print "NO". You can print each letter in any case (upper or lower).
C
75a00d8a614fd0bcb8504b0268a121e0
c48091d3ef88adaa07bc3e7eaaa2ef6c
GNU C11
standard output
256 megabytes
train_001.jsonl
[]
1521300900
["9\n0 0 0 1 1 1 0 0 0", "7\n0 0 0 1 1 1 1", "5\n1 1 1 1 1", "8\n1 1 1 0 0 0 1 1", "9\n1 1 0 1 1 0 1 1 0"]
NoteThe first two examples are described in the statements.In the third example all pixels are white, so the photo can be a photo of zebra.In the fourth example the width of the first stripe is equal to three (white color), the width of the second stripe is equal to three (black), and the width of the third stripe is e...
PASSED
1,700
standard input
1 second
The first line contains a single integer n (1 ≀ n ≀ 100 000) β€” the width of the photo. The second line contains a sequence of integers a1, a2, ..., an (0 ≀ ai ≀ 1) β€” the description of the photo. If ai is zero, the i-th column is all black. If ai is one, then the i-th column is all white.
["YES", "NO", "YES", "NO", "NO"]
#include <stdio.h> int a[100001], used[100001]; int main () { int n; scanf("%d", &n); for(int i = 1; i <= n; i++) { scanf("%d", &a[i]); } int first = a[1], j = 1; for(int i = 1; i <= n; i++) { if(a[i] == first) used[j]++; else first...
A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros and ones, where 0 means that the corresponding column is all white, and 1 means...
If the photo can be a photo of zebra, print "YES" (without quotes). Otherwise, print "NO". You can print each letter in any case (upper or lower).
C
75a00d8a614fd0bcb8504b0268a121e0
0a20afdd0eaa5dccaf4ca085298c5bab
GNU C11
standard output
256 megabytes
train_001.jsonl
[]
1521300900
["9\n0 0 0 1 1 1 0 0 0", "7\n0 0 0 1 1 1 1", "5\n1 1 1 1 1", "8\n1 1 1 0 0 0 1 1", "9\n1 1 0 1 1 0 1 1 0"]
NoteThe first two examples are described in the statements.In the third example all pixels are white, so the photo can be a photo of zebra.In the fourth example the width of the first stripe is equal to three (white color), the width of the second stripe is equal to three (black), and the width of the third stripe is e...
PASSED
1,700
standard input
1 second
The first line contains a single integer n (1 ≀ n ≀ 100 000) β€” the width of the photo. The second line contains a sequence of integers a1, a2, ..., an (0 ≀ ai ≀ 1) β€” the description of the photo. If ai is zero, the i-th column is all black. If ai is one, then the i-th column is all white.
["YES", "NO", "YES", "NO", "NO"]
#include<stdio.h> int main(){ int n,cnt,i,num,prev,max=0; cnt=1; scanf("%d %d",&n,&prev); n--; while(n--){ scanf("%d",&num); if(prev==num){ cnt++; } else{ if(max==0){ max=cnt; cnt=1; prev=num; ...
A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of n zeros and ones, where 0 means that the corresponding column is all white, and 1 means...
If the photo can be a photo of zebra, print "YES" (without quotes). Otherwise, print "NO". You can print each letter in any case (upper or lower).
C
75a00d8a614fd0bcb8504b0268a121e0
2244513ddc9f6525b042a391b64df40a
GNU C11
standard output
256 megabytes
train_001.jsonl
[]
1521300900
["9\n0 0 0 1 1 1 0 0 0", "7\n0 0 0 1 1 1 1", "5\n1 1 1 1 1", "8\n1 1 1 0 0 0 1 1", "9\n1 1 0 1 1 0 1 1 0"]
NoteThe first two examples are described in the statements.In the third example all pixels are white, so the photo can be a photo of zebra.In the fourth example the width of the first stripe is equal to three (white color), the width of the second stripe is equal to three (black), and the width of the third stripe is e...
PASSED
1,700
standard input
1 second
The first line contains a single integer n (1 ≀ n ≀ 100 000) β€” the width of the photo. The second line contains a sequence of integers a1, a2, ..., an (0 ≀ ai ≀ 1) β€” the description of the photo. If ai is zero, the i-th column is all black. If ai is one, then the i-th column is all white.
["YES", "NO", "YES", "NO", "NO"]
#include <stdio.h> #include <stddef.h> #include <locale.h> #define MAXN 100010 int main() { int n, i, j, k; scanf("%d", &n); int a[MAXN]; for (i = 0; i < n; i++) scanf("%d", &a[i]); int solved = 0; for (i = 1; i <= n; i++) { if (n % i != 0) continue; int valid = 1; if (a[0] == 0) { for (j = 0; ...
You have a string $$$s$$$ of length $$$n$$$ consisting of only characters &gt; and &lt;. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character &gt;, the character that comes right after it is deleted (if the characte...
For each test case print one line. For $$$i$$$-th test case print the minimum number of characters to be deleted from string $$$s$$$ so that it becomes good.
C
0ba97bcfb5f539c848f2cd097b34ff33
3346566721736a09fa95e6bd2464513b
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1553267100
["3\n2\n&lt;&gt;\n3\n&gt;&lt;&lt;\n1\n&gt;"]
NoteIn the first test case we can delete any character in string &lt;&gt;.In the second test case we don't need to delete any characters. The string &gt; &lt; &lt; is good, because we can perform the following sequence of operations: &gt; &lt; &lt; $$$\rightarrow$$$ &lt; &lt; $$$\rightarrow$$$ &lt;.
PASSED
1,200
standard input
1 second
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) – the number of test cases. Each test case is represented by two lines. The first line of $$$i$$$-th test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) – the length of string $$$s$$$. The second line of $$$i$$$-th test case contains string ...
["1\n0\n0"]
#include "stdio.h" #include "stdlib.h" int t, n, start_dist, end_dist; char s[101]; int main() { scanf("%d", &t); // printf("t = %d\n", t); for (int i = 0; i < t; i++) { scanf("%d", &n); // printf("n = %d\n", n); scanf("%s", s); // printf("s = %s\n", s); start_dist = 0; end_dist = 0; ...
You have a string $$$s$$$ of length $$$n$$$ consisting of only characters &gt; and &lt;. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character &gt;, the character that comes right after it is deleted (if the characte...
For each test case print one line. For $$$i$$$-th test case print the minimum number of characters to be deleted from string $$$s$$$ so that it becomes good.
C
0ba97bcfb5f539c848f2cd097b34ff33
1086f3504f410f1c0f0d7abee61960fb
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1553267100
["3\n2\n&lt;&gt;\n3\n&gt;&lt;&lt;\n1\n&gt;"]
NoteIn the first test case we can delete any character in string &lt;&gt;.In the second test case we don't need to delete any characters. The string &gt; &lt; &lt; is good, because we can perform the following sequence of operations: &gt; &lt; &lt; $$$\rightarrow$$$ &lt; &lt; $$$\rightarrow$$$ &lt;.
PASSED
1,200
standard input
1 second
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) – the number of test cases. Each test case is represented by two lines. The first line of $$$i$$$-th test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) – the length of string $$$s$$$. The second line of $$$i$$$-th test case contains string ...
["1\n0\n0"]
#include<stdio.h> #include<string.h> int main() { int t; scanf("%d",&t); while(t--) { int n; scanf("%d",&n); char s[n+1]; scanf(" %[^\n]",s); int len=(int)strlen(s),flag=0,flag_prim=0; if(s[0]=='>' || s[len-1]=='<') { flag=0; } ...
You have a string $$$s$$$ of length $$$n$$$ consisting of only characters &gt; and &lt;. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character &gt;, the character that comes right after it is deleted (if the characte...
For each test case print one line. For $$$i$$$-th test case print the minimum number of characters to be deleted from string $$$s$$$ so that it becomes good.
C
0ba97bcfb5f539c848f2cd097b34ff33
127ef08b2f96e425ac54c84fb6eb54a9
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1553267100
["3\n2\n&lt;&gt;\n3\n&gt;&lt;&lt;\n1\n&gt;"]
NoteIn the first test case we can delete any character in string &lt;&gt;.In the second test case we don't need to delete any characters. The string &gt; &lt; &lt; is good, because we can perform the following sequence of operations: &gt; &lt; &lt; $$$\rightarrow$$$ &lt; &lt; $$$\rightarrow$$$ &lt;.
PASSED
1,200
standard input
1 second
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) – the number of test cases. Each test case is represented by two lines. The first line of $$$i$$$-th test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) – the length of string $$$s$$$. The second line of $$$i$$$-th test case contains string ...
["1\n0\n0"]
#include <stdio.h> int main(int argc, char const *argv[]) { int t; scanf("%d", &t); while (t--) { int n, ans; scanf("%d", &n); char str[n + 1]; scanf(" %s", str); for (int i = 0; i <= n / 2; i++) if (str[i] == '>' || str[n - i - 1] == '<') { ans = i; break; } ...
You have a string $$$s$$$ of length $$$n$$$ consisting of only characters &gt; and &lt;. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character &gt;, the character that comes right after it is deleted (if the characte...
For each test case print one line. For $$$i$$$-th test case print the minimum number of characters to be deleted from string $$$s$$$ so that it becomes good.
C
0ba97bcfb5f539c848f2cd097b34ff33
937996f1c3844c8de9cf731c50caaf07
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1553267100
["3\n2\n&lt;&gt;\n3\n&gt;&lt;&lt;\n1\n&gt;"]
NoteIn the first test case we can delete any character in string &lt;&gt;.In the second test case we don't need to delete any characters. The string &gt; &lt; &lt; is good, because we can perform the following sequence of operations: &gt; &lt; &lt; $$$\rightarrow$$$ &lt; &lt; $$$\rightarrow$$$ &lt;.
PASSED
1,200
standard input
1 second
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) – the number of test cases. Each test case is represented by two lines. The first line of $$$i$$$-th test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) – the length of string $$$s$$$. The second line of $$$i$$$-th test case contains string ...
["1\n0\n0"]
#include<stdio.h> int t, n, ss,ee; char s[101]; int main() { scanf("%d", &t); while (t--) { scanf("%d", &n); scanf("%s", s); ss=ee=0; for (int i = 0; i < n; i++) { if (s[i] == '>') { ss = i; break; } } for (int i = n-1; i >=0; i--) { if (s[i] == '<') { ee = i; break; } } if (!ss ...
You have a string $$$s$$$ of length $$$n$$$ consisting of only characters &gt; and &lt;. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character &gt;, the character that comes right after it is deleted (if the characte...
For each test case print one line. For $$$i$$$-th test case print the minimum number of characters to be deleted from string $$$s$$$ so that it becomes good.
C
0ba97bcfb5f539c848f2cd097b34ff33
a3c63dce625af39a629e0814dfda8f88
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1553267100
["3\n2\n&lt;&gt;\n3\n&gt;&lt;&lt;\n1\n&gt;"]
NoteIn the first test case we can delete any character in string &lt;&gt;.In the second test case we don't need to delete any characters. The string &gt; &lt; &lt; is good, because we can perform the following sequence of operations: &gt; &lt; &lt; $$$\rightarrow$$$ &lt; &lt; $$$\rightarrow$$$ &lt;.
PASSED
1,200
standard input
1 second
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) – the number of test cases. Each test case is represented by two lines. The first line of $$$i$$$-th test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) – the length of string $$$s$$$. The second line of $$$i$$$-th test case contains string ...
["1\n0\n0"]
#include<stdio.h> int main() { int t; scanf("%d", &t); for(int i=0; i<t; i++) { int n=0, j, k; scanf("%d", &n); char s[n+1]; scanf("%s", s); if((s[0] == '<') && (s[n-1] == '>')) { for(j=0; j<n; j++) { if(s[j]=='<') continue; else break; } for(k=0; k<n; k++) { if(s[n-1-k]=='>')...
You have a string $$$s$$$ of length $$$n$$$ consisting of only characters &gt; and &lt;. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character &gt;, the character that comes right after it is deleted (if the characte...
For each test case print one line. For $$$i$$$-th test case print the minimum number of characters to be deleted from string $$$s$$$ so that it becomes good.
C
0ba97bcfb5f539c848f2cd097b34ff33
1d71c25672f90e2c4a939edf30cc5048
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1553267100
["3\n2\n&lt;&gt;\n3\n&gt;&lt;&lt;\n1\n&gt;"]
NoteIn the first test case we can delete any character in string &lt;&gt;.In the second test case we don't need to delete any characters. The string &gt; &lt; &lt; is good, because we can perform the following sequence of operations: &gt; &lt; &lt; $$$\rightarrow$$$ &lt; &lt; $$$\rightarrow$$$ &lt;.
PASSED
1,200
standard input
1 second
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) – the number of test cases. Each test case is represented by two lines. The first line of $$$i$$$-th test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) – the length of string $$$s$$$. The second line of $$$i$$$-th test case contains string ...
["1\n0\n0"]
#include <stdio.h> #include <stdlib.h> #include <string.h> char str[1000000]; int main(){ int i,j,k,l,t,n,x,y,count,a,b; char c; scanf("%d",&t); while(t--){ a=0;b=0; scanf("%d",&n); scanf("%s",str); for(i=0;i<n;i++){ if(str[i]=='>') break; else a++; } for(i=n-1;i>=0;i--){ if(str[i]=='<') ...
You have a string $$$s$$$ of length $$$n$$$ consisting of only characters &gt; and &lt;. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character &gt;, the character that comes right after it is deleted (if the characte...
For each test case print one line. For $$$i$$$-th test case print the minimum number of characters to be deleted from string $$$s$$$ so that it becomes good.
C
0ba97bcfb5f539c848f2cd097b34ff33
2cfd08e0798148446800f199f74a3b56
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1553267100
["3\n2\n&lt;&gt;\n3\n&gt;&lt;&lt;\n1\n&gt;"]
NoteIn the first test case we can delete any character in string &lt;&gt;.In the second test case we don't need to delete any characters. The string &gt; &lt; &lt; is good, because we can perform the following sequence of operations: &gt; &lt; &lt; $$$\rightarrow$$$ &lt; &lt; $$$\rightarrow$$$ &lt;.
PASSED
1,200
standard input
1 second
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) – the number of test cases. Each test case is represented by two lines. The first line of $$$i$$$-th test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) – the length of string $$$s$$$. The second line of $$$i$$$-th test case contains string ...
["1\n0\n0"]
#include<stdio.h> #define MIN(X, Y) (((X) < (Y)) ? (X) : (Y)) int main() { int t, n; char s[100]; scanf("%d",&t); while(t--) { scanf("%d %s",&n,s); int res = n - 1; for(int i = 0; i < n; i++) if(s[i] == '>' || s[n - 1 - i] == '<') res = MIN(res, i); printf("%d\n",res); ...
You have a string $$$s$$$ of length $$$n$$$ consisting of only characters &gt; and &lt;. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character &gt;, the character that comes right after it is deleted (if the characte...
For each test case print one line. For $$$i$$$-th test case print the minimum number of characters to be deleted from string $$$s$$$ so that it becomes good.
C
0ba97bcfb5f539c848f2cd097b34ff33
1a0a8451662addf906adb7f662cdd14a
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1553267100
["3\n2\n&lt;&gt;\n3\n&gt;&lt;&lt;\n1\n&gt;"]
NoteIn the first test case we can delete any character in string &lt;&gt;.In the second test case we don't need to delete any characters. The string &gt; &lt; &lt; is good, because we can perform the following sequence of operations: &gt; &lt; &lt; $$$\rightarrow$$$ &lt; &lt; $$$\rightarrow$$$ &lt;.
PASSED
1,200
standard input
1 second
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) – the number of test cases. Each test case is represented by two lines. The first line of $$$i$$$-th test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) – the length of string $$$s$$$. The second line of $$$i$$$-th test case contains string ...
["1\n0\n0"]
#include<stdio.h> #define MIN(X, Y) ((X < Y) ? X : Y) int main() { int t, n; char s[100]; scanf("%d",&t); while(t--) { scanf("%d %s",&n,s); /* n -> length of string s s -> string with characters "<" or ">" */ int min_char_deleted = n - 1; // let min_char_deleted...
You have a string $$$s$$$ of length $$$n$$$ consisting of only characters &gt; and &lt;. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character &gt;, the character that comes right after it is deleted (if the characte...
For each test case print one line. For $$$i$$$-th test case print the minimum number of characters to be deleted from string $$$s$$$ so that it becomes good.
C
0ba97bcfb5f539c848f2cd097b34ff33
43326b57985068d01d4c1b089a8b8463
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1553267100
["3\n2\n&lt;&gt;\n3\n&gt;&lt;&lt;\n1\n&gt;"]
NoteIn the first test case we can delete any character in string &lt;&gt;.In the second test case we don't need to delete any characters. The string &gt; &lt; &lt; is good, because we can perform the following sequence of operations: &gt; &lt; &lt; $$$\rightarrow$$$ &lt; &lt; $$$\rightarrow$$$ &lt;.
PASSED
1,200
standard input
1 second
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) – the number of test cases. Each test case is represented by two lines. The first line of $$$i$$$-th test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) – the length of string $$$s$$$. The second line of $$$i$$$-th test case contains string ...
["1\n0\n0"]
#include<stdio.h> #define MIN(X, Y) (((X) < (Y)) ? (X) : (Y)) int main() { int t, n; char s[100]; scanf("%d",&t); while(t--) { scanf("%d %s",&n,s); int res = n - 1; for(int i = 0; i < n; i++) if(s[i] == '>' || s[n - 1 - i] == '<') res = MIN(res, i); printf("%d\n",res); }...
You have a string $$$s$$$ of length $$$n$$$ consisting of only characters &gt; and &lt;. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character &gt;, the character that comes right after it is deleted (if the characte...
For each test case print one line. For $$$i$$$-th test case print the minimum number of characters to be deleted from string $$$s$$$ so that it becomes good.
C
0ba97bcfb5f539c848f2cd097b34ff33
b706b31f6d16cc6e121e56d049edc681
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1553267100
["3\n2\n&lt;&gt;\n3\n&gt;&lt;&lt;\n1\n&gt;"]
NoteIn the first test case we can delete any character in string &lt;&gt;.In the second test case we don't need to delete any characters. The string &gt; &lt; &lt; is good, because we can perform the following sequence of operations: &gt; &lt; &lt; $$$\rightarrow$$$ &lt; &lt; $$$\rightarrow$$$ &lt;.
PASSED
1,200
standard input
1 second
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) – the number of test cases. Each test case is represented by two lines. The first line of $$$i$$$-th test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) – the length of string $$$s$$$. The second line of $$$i$$$-th test case contains string ...
["1\n0\n0"]
#include<stdio.h> #define MIN(X, Y) ((X < Y) ? X : Y) int main() { int t, n;//the test case and the length of the string s (t=1,n=2) char s[100];// we declare the string s;(s="<>") scanf("%d",&t);// we input the number of test cases while(t--) { scanf("%d %s",&n,s); /* n -> length of string s ...
You have a string $$$s$$$ of length $$$n$$$ consisting of only characters &gt; and &lt;. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character &gt;, the character that comes right after it is deleted (if the characte...
For each test case print one line. For $$$i$$$-th test case print the minimum number of characters to be deleted from string $$$s$$$ so that it becomes good.
C
0ba97bcfb5f539c848f2cd097b34ff33
53adf2cc1e263068fb31dde7e69d6b36
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1553267100
["3\n2\n&lt;&gt;\n3\n&gt;&lt;&lt;\n1\n&gt;"]
NoteIn the first test case we can delete any character in string &lt;&gt;.In the second test case we don't need to delete any characters. The string &gt; &lt; &lt; is good, because we can perform the following sequence of operations: &gt; &lt; &lt; $$$\rightarrow$$$ &lt; &lt; $$$\rightarrow$$$ &lt;.
PASSED
1,200
standard input
1 second
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) – the number of test cases. Each test case is represented by two lines. The first line of $$$i$$$-th test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) – the length of string $$$s$$$. The second line of $$$i$$$-th test case contains string ...
["1\n0\n0"]
#include<stdio.h> int min(int a,int b) { return a<b?a:b; } int main() { int n; scanf("%d",&n); while(n--) { int m; scanf("%d",&m); getchar(); char a[1000]={'\0'}; for(int i=0;i<m;i++) { scanf("%c",&a[i]); } int flag1=0; for(int i=0;i<m;i++) { if(a[i]=='>') { flag1=i; break; ...
You have a string $$$s$$$ of length $$$n$$$ consisting of only characters &gt; and &lt;. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character &gt;, the character that comes right after it is deleted (if the characte...
For each test case print one line. For $$$i$$$-th test case print the minimum number of characters to be deleted from string $$$s$$$ so that it becomes good.
C
0ba97bcfb5f539c848f2cd097b34ff33
679e26747c6695f6b3de10184e51c857
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1553267100
["3\n2\n&lt;&gt;\n3\n&gt;&lt;&lt;\n1\n&gt;"]
NoteIn the first test case we can delete any character in string &lt;&gt;.In the second test case we don't need to delete any characters. The string &gt; &lt; &lt; is good, because we can perform the following sequence of operations: &gt; &lt; &lt; $$$\rightarrow$$$ &lt; &lt; $$$\rightarrow$$$ &lt;.
PASSED
1,200
standard input
1 second
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) – the number of test cases. Each test case is represented by two lines. The first line of $$$i$$$-th test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) – the length of string $$$s$$$. The second line of $$$i$$$-th test case contains string ...
["1\n0\n0"]
#include<stdio.h> int main() { int t,n,k,l,i; scanf("%d",&t); while(t--) { scanf("%d",&n); char s[n]; k=100; l=100; scanf("%s",&s); for(i=0;i<n;i++) { if(s[i]=='>') { k=i; break; }...
You have a string $$$s$$$ of length $$$n$$$ consisting of only characters &gt; and &lt;. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character &gt;, the character that comes right after it is deleted (if the characte...
For each test case print one line. For $$$i$$$-th test case print the minimum number of characters to be deleted from string $$$s$$$ so that it becomes good.
C
0ba97bcfb5f539c848f2cd097b34ff33
0c2b8afcef40dbcd81c669a634698437
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1553267100
["3\n2\n&lt;&gt;\n3\n&gt;&lt;&lt;\n1\n&gt;"]
NoteIn the first test case we can delete any character in string &lt;&gt;.In the second test case we don't need to delete any characters. The string &gt; &lt; &lt; is good, because we can perform the following sequence of operations: &gt; &lt; &lt; $$$\rightarrow$$$ &lt; &lt; $$$\rightarrow$$$ &lt;.
PASSED
1,200
standard input
1 second
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) – the number of test cases. Each test case is represented by two lines. The first line of $$$i$$$-th test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) – the length of string $$$s$$$. The second line of $$$i$$$-th test case contains string ...
["1\n0\n0"]
#include<stdio.h> #include<string.h> int main() { int t, n, i, l, r; char a[105]; scanf("%d", &t); while(t--) { scanf("%d", &n); scanf("%s", a); l = 0; r = n - 1; while(a[l] != '>' && l < n) { l++; } while(a[r] != '<' && r ...
You have a string $$$s$$$ of length $$$n$$$ consisting of only characters &gt; and &lt;. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character &gt;, the character that comes right after it is deleted (if the characte...
For each test case print one line. For $$$i$$$-th test case print the minimum number of characters to be deleted from string $$$s$$$ so that it becomes good.
C
0ba97bcfb5f539c848f2cd097b34ff33
b696adddb514f71a9c628c156062631e
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1553267100
["3\n2\n&lt;&gt;\n3\n&gt;&lt;&lt;\n1\n&gt;"]
NoteIn the first test case we can delete any character in string &lt;&gt;.In the second test case we don't need to delete any characters. The string &gt; &lt; &lt; is good, because we can perform the following sequence of operations: &gt; &lt; &lt; $$$\rightarrow$$$ &lt; &lt; $$$\rightarrow$$$ &lt;.
PASSED
1,200
standard input
1 second
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) – the number of test cases. Each test case is represented by two lines. The first line of $$$i$$$-th test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) – the length of string $$$s$$$. The second line of $$$i$$$-th test case contains string ...
["1\n0\n0"]
#include<stdio.h> #include<string.h> enum { maxn = 105 }; char s[maxn]; int main() { int kase; scanf("%d", &kase); while(kase--) { int len; scanf("%d", &len); memset(s, 0, sizeof(s)); fgets(s, maxn, stdin); // purge '\n' fgets(s, maxn, stdin); if (s[0] == s[len-1] || ...
You have a string $$$s$$$ of length $$$n$$$ consisting of only characters &gt; and &lt;. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character &gt;, the character that comes right after it is deleted (if the characte...
For each test case print one line. For $$$i$$$-th test case print the minimum number of characters to be deleted from string $$$s$$$ so that it becomes good.
C
0ba97bcfb5f539c848f2cd097b34ff33
ea92369266e776f7e97692f9b700701d
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1553267100
["3\n2\n&lt;&gt;\n3\n&gt;&lt;&lt;\n1\n&gt;"]
NoteIn the first test case we can delete any character in string &lt;&gt;.In the second test case we don't need to delete any characters. The string &gt; &lt; &lt; is good, because we can perform the following sequence of operations: &gt; &lt; &lt; $$$\rightarrow$$$ &lt; &lt; $$$\rightarrow$$$ &lt;.
PASSED
1,200
standard input
1 second
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) – the number of test cases. Each test case is represented by two lines. The first line of $$$i$$$-th test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) – the length of string $$$s$$$. The second line of $$$i$$$-th test case contains string ...
["1\n0\n0"]
#include <stdio.h> char s[101]; int main() { int t; scanf("%d", &t); while(t-->0) { int n; scanf("%d", &n); scanf("%s", s); int k1=0, k2=0; for(k1=0; k1<n && s[k1] == '<'; ++k1); for(k2=0; k2<n && s[n-1-k2] == '>'; ++k2); printf("%d\n", (k1 < k2 ? k1...
You have a string $$$s$$$ of length $$$n$$$ consisting of only characters &gt; and &lt;. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character &gt;, the character that comes right after it is deleted (if the characte...
For each test case print one line. For $$$i$$$-th test case print the minimum number of characters to be deleted from string $$$s$$$ so that it becomes good.
C
0ba97bcfb5f539c848f2cd097b34ff33
35df997394e39314ed3b89fee4598b08
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1553267100
["3\n2\n&lt;&gt;\n3\n&gt;&lt;&lt;\n1\n&gt;"]
NoteIn the first test case we can delete any character in string &lt;&gt;.In the second test case we don't need to delete any characters. The string &gt; &lt; &lt; is good, because we can perform the following sequence of operations: &gt; &lt; &lt; $$$\rightarrow$$$ &lt; &lt; $$$\rightarrow$$$ &lt;.
PASSED
1,200
standard input
1 second
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) – the number of test cases. Each test case is represented by two lines. The first line of $$$i$$$-th test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) – the length of string $$$s$$$. The second line of $$$i$$$-th test case contains string ...
["1\n0\n0"]
#include<stdio.h> int main() { int i,j,count=0,k,count1=0; scanf("%d",&j); for(i=1;i<=j;i++) { int a; scanf("%d ",&a); char b[a]; gets(b); b[a]='\0'; for(k=0;k<a;k++) { if(b[k]=='>') { break; } else { count++; } } for(k=a-1;k>=0...
You have a string $$$s$$$ of length $$$n$$$ consisting of only characters &gt; and &lt;. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character &gt;, the character that comes right after it is deleted (if the characte...
For each test case print one line. For $$$i$$$-th test case print the minimum number of characters to be deleted from string $$$s$$$ so that it becomes good.
C
0ba97bcfb5f539c848f2cd097b34ff33
675dff88e81028bb9b7279e6cb6e6654
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1553267100
["3\n2\n&lt;&gt;\n3\n&gt;&lt;&lt;\n1\n&gt;"]
NoteIn the first test case we can delete any character in string &lt;&gt;.In the second test case we don't need to delete any characters. The string &gt; &lt; &lt; is good, because we can perform the following sequence of operations: &gt; &lt; &lt; $$$\rightarrow$$$ &lt; &lt; $$$\rightarrow$$$ &lt;.
PASSED
1,200
standard input
1 second
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) – the number of test cases. Each test case is represented by two lines. The first line of $$$i$$$-th test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) – the length of string $$$s$$$. The second line of $$$i$$$-th test case contains string ...
["1\n0\n0"]
#include<stdio.h> #define min(a,b) (a>b ? b:a) int main() { int first_right,last_left; int t,i; char line[1000]; int count; scanf("%d",&t); while(t--) { scanf("%d",&count); first_right=count-1; last_left=0; scanf("%s",line); //printf("the line is %s\n",line); for(i=0;i<count;i++) { if(l...
You have a string $$$s$$$ of length $$$n$$$ consisting of only characters &gt; and &lt;. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character &gt;, the character that comes right after it is deleted (if the characte...
For each test case print one line. For $$$i$$$-th test case print the minimum number of characters to be deleted from string $$$s$$$ so that it becomes good.
C
0ba97bcfb5f539c848f2cd097b34ff33
6fd7a6cd6039343eba8883efb2b29356
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1553267100
["3\n2\n&lt;&gt;\n3\n&gt;&lt;&lt;\n1\n&gt;"]
NoteIn the first test case we can delete any character in string &lt;&gt;.In the second test case we don't need to delete any characters. The string &gt; &lt; &lt; is good, because we can perform the following sequence of operations: &gt; &lt; &lt; $$$\rightarrow$$$ &lt; &lt; $$$\rightarrow$$$ &lt;.
PASSED
1,200
standard input
1 second
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) – the number of test cases. Each test case is represented by two lines. The first line of $$$i$$$-th test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) – the length of string $$$s$$$. The second line of $$$i$$$-th test case contains string ...
["1\n0\n0"]
#include<stdio.h> #include<string.h> int main() { int t, n, i, num, left, right; char s[105]; scanf ( "%d", &t ); for ( i = 0; i < t; i++ ) { left = right = num = 0; scanf ( "%d %s", &n, s ); if ( s[0] != '<' && s[n-1] != '>' ) ; else { left = right = 0; while ( s[left] == '<' ) left++; ...
You have a string $$$s$$$ of length $$$n$$$ consisting of only characters &gt; and &lt;. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character &gt;, the character that comes right after it is deleted (if the characte...
For each test case print one line. For $$$i$$$-th test case print the minimum number of characters to be deleted from string $$$s$$$ so that it becomes good.
C
0ba97bcfb5f539c848f2cd097b34ff33
cbb91e1c0784260dee0fe6c09dbcb0c8
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1553267100
["3\n2\n&lt;&gt;\n3\n&gt;&lt;&lt;\n1\n&gt;"]
NoteIn the first test case we can delete any character in string &lt;&gt;.In the second test case we don't need to delete any characters. The string &gt; &lt; &lt; is good, because we can perform the following sequence of operations: &gt; &lt; &lt; $$$\rightarrow$$$ &lt; &lt; $$$\rightarrow$$$ &lt;.
PASSED
1,200
standard input
1 second
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) – the number of test cases. Each test case is represented by two lines. The first line of $$$i$$$-th test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) – the length of string $$$s$$$. The second line of $$$i$$$-th test case contains string ...
["1\n0\n0"]
#include<stdio.h> #include<string.h> int main() { int test; scanf("%d",&test); int num; char s[10000]={}; for(int i=0;i<test;i++) { scanf("%d",&num); scanf(" %s",s); int a=0,b=num-1; int found1=0,found2=0; for(int i=0,j=num-1;i<num;i++,j--) { ...
You have a string $$$s$$$ of length $$$n$$$ consisting of only characters &gt; and &lt;. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character &gt;, the character that comes right after it is deleted (if the characte...
For each test case print one line. For $$$i$$$-th test case print the minimum number of characters to be deleted from string $$$s$$$ so that it becomes good.
C
0ba97bcfb5f539c848f2cd097b34ff33
e9cb6c051cf27655e4c22a18e8fd80bc
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1553267100
["3\n2\n&lt;&gt;\n3\n&gt;&lt;&lt;\n1\n&gt;"]
NoteIn the first test case we can delete any character in string &lt;&gt;.In the second test case we don't need to delete any characters. The string &gt; &lt; &lt; is good, because we can perform the following sequence of operations: &gt; &lt; &lt; $$$\rightarrow$$$ &lt; &lt; $$$\rightarrow$$$ &lt;.
PASSED
1,200
standard input
1 second
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) – the number of test cases. Each test case is represented by two lines. The first line of $$$i$$$-th test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) – the length of string $$$s$$$. The second line of $$$i$$$-th test case contains string ...
["1\n0\n0"]
#include<stdio.h> char ch[105]; int a[105]; int ans=0; int main() { int n,i,j,p,q; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&a[i]); getchar(); for(j=0,p=0,q=0;j<a[i];j++) { scanf("%c",&ch[j]); } j--; while(ch[j]=='>'){ p++; j--; } j=0; while(ch[j]=='<'){ q++; j++; } ans=p; ...
You have a string $$$s$$$ of length $$$n$$$ consisting of only characters &gt; and &lt;. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character &gt;, the character that comes right after it is deleted (if the characte...
For each test case print one line. For $$$i$$$-th test case print the minimum number of characters to be deleted from string $$$s$$$ so that it becomes good.
C
0ba97bcfb5f539c848f2cd097b34ff33
fda9f84150d06637d04fb0061a72dd45
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "implementation", "strings" ]
1553267100
["3\n2\n&lt;&gt;\n3\n&gt;&lt;&lt;\n1\n&gt;"]
NoteIn the first test case we can delete any character in string &lt;&gt;.In the second test case we don't need to delete any characters. The string &gt; &lt; &lt; is good, because we can perform the following sequence of operations: &gt; &lt; &lt; $$$\rightarrow$$$ &lt; &lt; $$$\rightarrow$$$ &lt;.
PASSED
1,200
standard input
1 second
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) – the number of test cases. Each test case is represented by two lines. The first line of $$$i$$$-th test case contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) – the length of string $$$s$$$. The second line of $$$i$$$-th test case contains string ...
["1\n0\n0"]
#include<stdio.h> int a[200]; int main(){ int t,n,i=0,x,y; char s[200]; scanf("%d",&t); for(i=0;i<t;i++){ scanf("%d",&n); scanf("%s",s); x=y=0; if(s[0]=='<'&&s[n-1]=='>'){ while(s[x]=='<') x++; while(s[n-1-y]=='>') y++; a[i]=(x>y)? y:x; } } for(i=0;i<t;i++){ printf("%d\n",a[i]); } return 0;...