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 sequencelengths 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Emuskald needs a fence around his farm, but he is too lazy to build it himself. So he purchased a fence-building robot.He wants the fence to be a regular polygon. The robot builds the fence along a single path, but it can only make fence corners at a single angle a.Will the robot be able to build the fence Emuskald wan... | For each test, output on a single line "YES" (without quotes), if the robot can build a fence Emuskald wants, and "NO" (without quotes), if it is impossible. | C | 9037f487a426ead347baa803955b2c00 | 20f39ec42c4d09a1257b2b609ac28a1f | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"geometry",
"math"
] | 1359732600 | ["3\n30\n60\n90"] | NoteIn the first test case, it is impossible to build the fence, since there is no regular polygon with angle .In the second test case, the fence is a regular triangle, and in the last test case — a square. | PASSED | 1,100 | standard input | 2 seconds | The first line of input contains an integer t (0 < t < 180) — the number of tests. Each of the following t lines contains a single integer a (0 < a < 180) — the angle the robot can make corners at measured in degrees. | ["NO\nYES\nYES"] | #include<stdio.h>
int main()
{ int t,i,a;
scanf("%d",&t);
for(i=0;i<t;i++)
{ scanf("%d",&a);
if((360%(180-a))==0)
printf("YES\n");
else
printf("NO\n");
}
}
| |
Emuskald needs a fence around his farm, but he is too lazy to build it himself. So he purchased a fence-building robot.He wants the fence to be a regular polygon. The robot builds the fence along a single path, but it can only make fence corners at a single angle a.Will the robot be able to build the fence Emuskald wan... | For each test, output on a single line "YES" (without quotes), if the robot can build a fence Emuskald wants, and "NO" (without quotes), if it is impossible. | C | 9037f487a426ead347baa803955b2c00 | be0fd919e682aa44b4652a52e7fbc38b | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"geometry",
"math"
] | 1359732600 | ["3\n30\n60\n90"] | NoteIn the first test case, it is impossible to build the fence, since there is no regular polygon with angle .In the second test case, the fence is a regular triangle, and in the last test case — a square. | PASSED | 1,100 | standard input | 2 seconds | The first line of input contains an integer t (0 < t < 180) — the number of tests. Each of the following t lines contains a single integer a (0 < a < 180) — the angle the robot can make corners at measured in degrees. | ["NO\nYES\nYES"] | #include <stdio.h>
int main()
{
int n,k,a[200],i;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
k=360%(180-a[i]);
if(k==0&&a[i]>=60)
{
printf("YES\n");
}
else
{
printf("NO\n");
}
}
return 0;
} | |
Emuskald needs a fence around his farm, but he is too lazy to build it himself. So he purchased a fence-building robot.He wants the fence to be a regular polygon. The robot builds the fence along a single path, but it can only make fence corners at a single angle a.Will the robot be able to build the fence Emuskald wan... | For each test, output on a single line "YES" (without quotes), if the robot can build a fence Emuskald wants, and "NO" (without quotes), if it is impossible. | C | 9037f487a426ead347baa803955b2c00 | 1b764051e88fc95e39776ccf65e2f9ce | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"geometry",
"math"
] | 1359732600 | ["3\n30\n60\n90"] | NoteIn the first test case, it is impossible to build the fence, since there is no regular polygon with angle .In the second test case, the fence is a regular triangle, and in the last test case — a square. | PASSED | 1,100 | standard input | 2 seconds | The first line of input contains an integer t (0 < t < 180) — the number of tests. Each of the following t lines contains a single integer a (0 < a < 180) — the angle the robot can make corners at measured in degrees. | ["NO\nYES\nYES"] | main()
{
int T;
scanf("%d",&T);
while(T--)
{
int ang;
scanf("%d",&ang);
if(360%(180-ang)==0)
printf("YES\n");
else
printf("NO\n");
}
return 0;
}
| |
Unfortunately, Vasya can only sum pairs of integers (a, b), such that for any decimal place at least one number has digit 0 in this place. For example, Vasya can sum numbers 505 and 50, but he cannot sum 1 and 4.Vasya has a set of k distinct non-negative integers d1, d2, ..., dk.Vasya wants to choose some integers from... | In the first line print a single integer n the maximum number of the chosen integers. In the second line print n distinct non-negative integers — the required integers. If there are multiple solutions, print any of them. You can print the numbers in any order. | C | 6b7d6f5c07b313c57d52db6a48d3eeef | 24b91e716ce27e08681332d0d4717313 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms",
"implementation",
"brute force"
] | 1368968400 | ["4\n100 10 1 0", "3\n2 70 3"] | null | PASSED | 1,600 | standard input | 2 seconds | The first input line contains integer k (1 ≤ k ≤ 100) — the number of integers. The second line contains k distinct space-separated integers d1, d2, ..., dk (0 ≤ di ≤ 100). | ["4\n0 1 10 100", "2\n2 70"] | #include<stdio.h>
#define fr(i,n) for(i=0;i<n;i++)
#define Fr(i,m,n) for(i=m;i<n;i++)
int a[103],ans[103];
int main()
{
int n=0,x,k,i,flag=0;
scanf("%d",&k);
fr(i,k)
{scanf("%d",&x);
a[x]=1;
}
if(a[100]==1)
ans[n++]=100;
for(i=10;i<91;i+=10)
{
if(a[i]==1)
{ a... | |
Unfortunately, Vasya can only sum pairs of integers (a, b), such that for any decimal place at least one number has digit 0 in this place. For example, Vasya can sum numbers 505 and 50, but he cannot sum 1 and 4.Vasya has a set of k distinct non-negative integers d1, d2, ..., dk.Vasya wants to choose some integers from... | In the first line print a single integer n the maximum number of the chosen integers. In the second line print n distinct non-negative integers — the required integers. If there are multiple solutions, print any of them. You can print the numbers in any order. | C | 6b7d6f5c07b313c57d52db6a48d3eeef | 3cea4acbfacb4c22114d2394fb480b71 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms",
"implementation",
"brute force"
] | 1368968400 | ["4\n100 10 1 0", "3\n2 70 3"] | null | PASSED | 1,600 | standard input | 2 seconds | The first input line contains integer k (1 ≤ k ≤ 100) — the number of integers. The second line contains k distinct space-separated integers d1, d2, ..., dk (0 ≤ di ≤ 100). | ["4\n0 1 10 100", "2\n2 70"] | #include<stdio.h>
#include<string.h>
char a[105][5];
int hun=0,zero=0;
void pf(void)
{
if(hun)
{
printf("100 ");
}
if(zero)
{
printf("0");
}
}
int main()
{
int n,i,eve=130,ten=130,one=130;
int cont=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%s",a[i]);
if(a[i][0]=='1'&&a[i][2]=='0')
{
hun=1;
... | |
Unfortunately, Vasya can only sum pairs of integers (a, b), such that for any decimal place at least one number has digit 0 in this place. For example, Vasya can sum numbers 505 and 50, but he cannot sum 1 and 4.Vasya has a set of k distinct non-negative integers d1, d2, ..., dk.Vasya wants to choose some integers from... | In the first line print a single integer n the maximum number of the chosen integers. In the second line print n distinct non-negative integers — the required integers. If there are multiple solutions, print any of them. You can print the numbers in any order. | C | 6b7d6f5c07b313c57d52db6a48d3eeef | 15f14f3a036ecf887cbbc58470315180 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms",
"implementation",
"brute force"
] | 1368968400 | ["4\n100 10 1 0", "3\n2 70 3"] | null | PASSED | 1,600 | standard input | 2 seconds | The first input line contains integer k (1 ≤ k ≤ 100) — the number of integers. The second line contains k distinct space-separated integers d1, d2, ..., dk (0 ≤ di ≤ 100). | ["4\n0 1 10 100", "2\n2 70"] | #include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#define max(a,b) ((a)>(b))?(a):(b)
#define min(a,b) ((a)<(b))?(a):(b)
#define si(n) scanf("%d",&n)
#define ss(s) scanf("%s",s)
#define sort(a,n) qsort(a,n,sizeof(int),compare)
#define pi(n) printf("%d ",n)
#define ps(s) printf("%s",s)
#define loop... | |
Unfortunately, Vasya can only sum pairs of integers (a, b), such that for any decimal place at least one number has digit 0 in this place. For example, Vasya can sum numbers 505 and 50, but he cannot sum 1 and 4.Vasya has a set of k distinct non-negative integers d1, d2, ..., dk.Vasya wants to choose some integers from... | In the first line print a single integer n the maximum number of the chosen integers. In the second line print n distinct non-negative integers — the required integers. If there are multiple solutions, print any of them. You can print the numbers in any order. | C | 6b7d6f5c07b313c57d52db6a48d3eeef | e2ba11d15f7a17dd60e7e963d37ed459 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms",
"implementation",
"brute force"
] | 1368968400 | ["4\n100 10 1 0", "3\n2 70 3"] | null | PASSED | 1,600 | standard input | 2 seconds | The first input line contains integer k (1 ≤ k ≤ 100) — the number of integers. The second line contains k distinct space-separated integers d1, d2, ..., dk (0 ≤ di ≤ 100). | ["4\n0 1 10 100", "2\n2 70"] | #include<stdio.h>
#include<string.h>
int aray[103], hold1[101], hold2[101];
int res[102];
int main()
{
int n ,i, j, k,l=0, three=0, two=0, one=0, zero=0, p;
scanf("%d", &n);
k=0;
for(i=0;i<101;i++){
res[i]=-2;
}
for(i=0;i<n;i++){
scanf("%d", &aray[i]);
if(aray[i]==100){
... | |
Unfortunately, Vasya can only sum pairs of integers (a, b), such that for any decimal place at least one number has digit 0 in this place. For example, Vasya can sum numbers 505 and 50, but he cannot sum 1 and 4.Vasya has a set of k distinct non-negative integers d1, d2, ..., dk.Vasya wants to choose some integers from... | In the first line print a single integer n the maximum number of the chosen integers. In the second line print n distinct non-negative integers — the required integers. If there are multiple solutions, print any of them. You can print the numbers in any order. | C | 6b7d6f5c07b313c57d52db6a48d3eeef | be79ad48a413e2eac16cf9e90f3f777e | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms",
"implementation",
"brute force"
] | 1368968400 | ["4\n100 10 1 0", "3\n2 70 3"] | null | PASSED | 1,600 | standard input | 2 seconds | The first input line contains integer k (1 ≤ k ≤ 100) — the number of integers. The second line contains k distinct space-separated integers d1, d2, ..., dk (0 ≤ di ≤ 100). | ["4\n0 1 10 100", "2\n2 70"] |
#include<stdio.h>
int main()
{
int k,ar[100],t=0,i,a[100],m=0,n=0,o=0,p=0,q=0,b,c,d,e;
scanf("%d\n",&k);
while(k--)
{
scanf("%d",&ar[t++]);
}
for(i=0;i<t;i++)
{
if(ar[i]==0)
{
a[m++]=ar[i];
}
else if(ar[i]==100 && n==0)
... | |
Unfortunately, Vasya can only sum pairs of integers (a, b), such that for any decimal place at least one number has digit 0 in this place. For example, Vasya can sum numbers 505 and 50, but he cannot sum 1 and 4.Vasya has a set of k distinct non-negative integers d1, d2, ..., dk.Vasya wants to choose some integers from... | In the first line print a single integer n the maximum number of the chosen integers. In the second line print n distinct non-negative integers — the required integers. If there are multiple solutions, print any of them. You can print the numbers in any order. | C | 6b7d6f5c07b313c57d52db6a48d3eeef | 60745c38f2a9657eb96664b9b0d11e44 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms",
"implementation",
"brute force"
] | 1368968400 | ["4\n100 10 1 0", "3\n2 70 3"] | null | PASSED | 1,600 | standard input | 2 seconds | The first input line contains integer k (1 ≤ k ≤ 100) — the number of integers. The second line contains k distinct space-separated integers d1, d2, ..., dk (0 ≤ di ≤ 100). | ["4\n0 1 10 100", "2\n2 70"] | #include<stdio.h>
int main()
{
int n,i,j=0,k=0,l=0,count=0,m=0,a=0,b=0,c=0;
scanf("%d",&n);
int arr[n],arr1[n];
for(i=0;i<n;i++)
scanf("%d",&arr[i]);
for(i=0;i<n;i++)
{
if(arr[i]==100)
{
if(a==0)
{
count++;
a=1;
arr1[j]=100;
j++;
}
}
else if(arr[i]%10==0&&arr[i]!=100&&arr[i]!=0)
... | |
Unfortunately, Vasya can only sum pairs of integers (a, b), such that for any decimal place at least one number has digit 0 in this place. For example, Vasya can sum numbers 505 and 50, but he cannot sum 1 and 4.Vasya has a set of k distinct non-negative integers d1, d2, ..., dk.Vasya wants to choose some integers from... | In the first line print a single integer n the maximum number of the chosen integers. In the second line print n distinct non-negative integers — the required integers. If there are multiple solutions, print any of them. You can print the numbers in any order. | C | 6b7d6f5c07b313c57d52db6a48d3eeef | 708e4aa10db7fa5c89cd66b8fa416a3c | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms",
"implementation",
"brute force"
] | 1368968400 | ["4\n100 10 1 0", "3\n2 70 3"] | null | PASSED | 1,600 | standard input | 2 seconds | The first input line contains integer k (1 ≤ k ≤ 100) — the number of integers. The second line contains k distinct space-separated integers d1, d2, ..., dk (0 ≤ di ≤ 100). | ["4\n0 1 10 100", "2\n2 70"] | #include<stdio.h>
#include<string.h>
int vis[110],b[110];
int main(){
int N,t;
while(scanf("%d",&N)!=EOF){
memset(vis,0,sizeof(vis));
int i,j,ans=0,ca;
for(i=0;i<N;i++){
scanf("%d",&t);ca=t;
vis[t]++;}
int ok1=0,ok2=0,ok3=0,t1,t2,t3,k=0;
for(i=1;i<10;i++) if(vis[i]) {ok1=1;t1=i;break;}
for(i=10;i<100;i+=10) if(vis[i]) ... | |
Unfortunately, Vasya can only sum pairs of integers (a, b), such that for any decimal place at least one number has digit 0 in this place. For example, Vasya can sum numbers 505 and 50, but he cannot sum 1 and 4.Vasya has a set of k distinct non-negative integers d1, d2, ..., dk.Vasya wants to choose some integers from... | In the first line print a single integer n the maximum number of the chosen integers. In the second line print n distinct non-negative integers — the required integers. If there are multiple solutions, print any of them. You can print the numbers in any order. | C | 6b7d6f5c07b313c57d52db6a48d3eeef | dfb898701f7f67c383cf4195e8400763 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms",
"implementation",
"brute force"
] | 1368968400 | ["4\n100 10 1 0", "3\n2 70 3"] | null | PASSED | 1,600 | standard input | 2 seconds | The first input line contains integer k (1 ≤ k ≤ 100) — the number of integers. The second line contains k distinct space-separated integers d1, d2, ..., dk (0 ≤ di ≤ 100). | ["4\n0 1 10 100", "2\n2 70"] | #include <stdio.h>
int main() {
int n;
int z=0,
lt=0,
lh1=0,
lh2=0,
h=0;
int lts[9],
lh1s[9],
lh2s[80];
int i;
int res[5];
scanf("%d\n",&n);
for(i = 0; i<n; i++) {
int d;
scanf("%d",&d);
if(d==0) {
z++;
} else if(d<10) {
lts[lt++] = d;
} else if... | |
Unfortunately, Vasya can only sum pairs of integers (a, b), such that for any decimal place at least one number has digit 0 in this place. For example, Vasya can sum numbers 505 and 50, but he cannot sum 1 and 4.Vasya has a set of k distinct non-negative integers d1, d2, ..., dk.Vasya wants to choose some integers from... | In the first line print a single integer n the maximum number of the chosen integers. In the second line print n distinct non-negative integers — the required integers. If there are multiple solutions, print any of them. You can print the numbers in any order. | C | 6b7d6f5c07b313c57d52db6a48d3eeef | d1e49613e9a6607948fe75e2498b1fe1 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms",
"implementation",
"brute force"
] | 1368968400 | ["4\n100 10 1 0", "3\n2 70 3"] | null | PASSED | 1,600 | standard input | 2 seconds | The first input line contains integer k (1 ≤ k ≤ 100) — the number of integers. The second line contains k distinct space-separated integers d1, d2, ..., dk (0 ≤ di ≤ 100). | ["4\n0 1 10 100", "2\n2 70"] | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct node
{
int a;
int b;
int c;
};
int main()
{
int n,i,flag=0,k=0,j,r,m,l=0,x,i1,min=0;
struct node pr[1000];
char s[1000];
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%s",s);
r=0;
flag=0;
x... | |
Unfortunately, Vasya can only sum pairs of integers (a, b), such that for any decimal place at least one number has digit 0 in this place. For example, Vasya can sum numbers 505 and 50, but he cannot sum 1 and 4.Vasya has a set of k distinct non-negative integers d1, d2, ..., dk.Vasya wants to choose some integers from... | In the first line print a single integer n the maximum number of the chosen integers. In the second line print n distinct non-negative integers — the required integers. If there are multiple solutions, print any of them. You can print the numbers in any order. | C | 6b7d6f5c07b313c57d52db6a48d3eeef | 491784cb8e299934342c9f828f2fc0d2 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms",
"implementation",
"brute force"
] | 1368968400 | ["4\n100 10 1 0", "3\n2 70 3"] | null | PASSED | 1,600 | standard input | 2 seconds | The first input line contains integer k (1 ≤ k ≤ 100) — the number of integers. The second line contains k distinct space-separated integers d1, d2, ..., dk (0 ≤ di ≤ 100). | ["4\n0 1 10 100", "2\n2 70"] | #include<stdio.h>
#include<stdlib.h>
int main()
{
int n;
scanf("%d",&n);
int x;
int y=0;
int ar[10]={0};
int i=0;
int n2=n;
int a=0,b=0,c=0,d=0;
int arr[109]={0};
int u=0;;
while(n>0)
{
scanf("%d",&x);
arr[u]=x;
u++;
if(x==100 && a==0)
{
ar[i]=x;
a++;
y++;
i++;
}
if(b==0)
if(x==... | |
Unfortunately, Vasya can only sum pairs of integers (a, b), such that for any decimal place at least one number has digit 0 in this place. For example, Vasya can sum numbers 505 and 50, but he cannot sum 1 and 4.Vasya has a set of k distinct non-negative integers d1, d2, ..., dk.Vasya wants to choose some integers from... | In the first line print a single integer n the maximum number of the chosen integers. In the second line print n distinct non-negative integers — the required integers. If there are multiple solutions, print any of them. You can print the numbers in any order. | C | 6b7d6f5c07b313c57d52db6a48d3eeef | bc4af20b4cf2270aa5c1083305528961 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms",
"implementation",
"brute force"
] | 1368968400 | ["4\n100 10 1 0", "3\n2 70 3"] | null | PASSED | 1,600 | standard input | 2 seconds | The first input line contains integer k (1 ≤ k ≤ 100) — the number of integers. The second line contains k distinct space-separated integers d1, d2, ..., dk (0 ≤ di ≤ 100). | ["4\n0 1 10 100", "2\n2 70"] | int n,a,b,c,d,e;
main()
{
int i,j,k;
while(~scanf("%d",&n))
{
a=b=c=d=e=-1;
while(n--)
{
scanf("%d",&i);
if(i==0) a=0;
else if(i<10) b=i;
else if(i<100&&i%10==0) c=i;
else if(i<100) d=i;
else e=i;
}
n=0;
if(a!=-1) n++;
if(b!=-1) n++;
if(c!=-1) n++;
if(b==-1&&c==-1&&d!=-1) n++;
... | |
Unfortunately, Vasya can only sum pairs of integers (a, b), such that for any decimal place at least one number has digit 0 in this place. For example, Vasya can sum numbers 505 and 50, but he cannot sum 1 and 4.Vasya has a set of k distinct non-negative integers d1, d2, ..., dk.Vasya wants to choose some integers from... | In the first line print a single integer n the maximum number of the chosen integers. In the second line print n distinct non-negative integers — the required integers. If there are multiple solutions, print any of them. You can print the numbers in any order. | C | 6b7d6f5c07b313c57d52db6a48d3eeef | 1ff2c83066c6ffa48e433ff960716370 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms",
"implementation",
"brute force"
] | 1368968400 | ["4\n100 10 1 0", "3\n2 70 3"] | null | PASSED | 1,600 | standard input | 2 seconds | The first input line contains integer k (1 ≤ k ≤ 100) — the number of integers. The second line contains k distinct space-separated integers d1, d2, ..., dk (0 ≤ di ≤ 100). | ["4\n0 1 10 100", "2\n2 70"] | #include<stdio.h>
int main(){
int p=-5,k,a[105],i,x=-5,y=-5,z=-5,counter=0,flag=0;
scanf("%d",&k);
for(i=0;i<k;i++)
scanf("%d",&a[i]);
if(k==1){
printf("1\n");
printf("%d",a[0]);
flag=1;}
for(i=0;i<k;i++){
if(a[i]==0){
counter++;
p=i;
break;}}
for(i=0;i<k;i++){
if(a[i]>=1&&a[i]<=9){
counter++;
x=i;
break;}}
for(i=0... | |
There is an easy way to obtain a new task from an old one called "Inverse the problem": we give an output of the original task, and ask to generate an input, such that solution to the original problem will produce the output we provided. The hard task of Topcoder Open 2014 Round 2C, InverseRMQ, is a good example.Now le... | If there exists such a tree, output "YES", otherwise output "NO". | C | a5363163c1c2dfed91947a582ac28bda | 6da13f79bdd179e1f15fe91bf62c9f18 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"dsu",
"dfs and similar",
"trees",
"shortest paths"
] | 1411918500 | ["3\n0 2 7\n2 0 9\n7 9 0", "3\n1 2 7\n2 0 9\n7 9 0", "3\n0 2 2\n7 0 9\n7 9 0", "3\n0 1 1\n1 0 1\n1 1 0", "2\n0 0\n0 0"] | NoteIn the first example, the required tree exists. It has one edge between nodes 1 and 2 with weight 2, another edge between nodes 1 and 3 with weight 7.In the second example, it is impossible because d1, 1 should be 0, but it is 1.In the third example, it is impossible because d1, 2 should equal d2, 1. | PASSED | 1,900 | standard input | 2 seconds | The first line contains an integer n (1 ≤ n ≤ 2000) — the number of nodes in that graph. Then next n lines each contains n integers di, j (0 ≤ di, j ≤ 109) — the distance between node i and node j. | ["YES", "NO", "NO", "NO", "NO"] | /* practice with Dukkha */
#include <stdio.h>
#define N 2000
int dd[N][N];
int aa[N];
int partition(int l, int r) {
int i, j, p, q, a, b, c, u, v, tmp;
if (r == l)
return 1;
a = aa[l], b = -1, j = -1;
for (i = l + 1; i <= r; i++) {
c = aa[i];
if (b == -1 || dd[a][b] > dd[a][c]) {
j = i;
b = c;
}
... | |
You are playing a game where your character should overcome different obstacles. The current problem is to come down from a cliff. The cliff has height $$$h$$$, and there is a moving platform on each height $$$x$$$ from $$$1$$$ to $$$h$$$.Each platform is either hidden inside the cliff or moved out. At first, there are... | For each query print one integer — the minimum number of magic crystals you have to spend to safely come down on the ground level (with height $$$0$$$). | C | d0c50562764f2008045fe57e5da5de1c | 33ddc916be4d64d917b8edebbf32eb5c | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"greedy",
"math"
] | 1570545300 | ["4\n3 2\n3 1\n8 6\n8 7 6 5 3 2\n9 6\n9 8 5 4 3 1\n1 1\n1"] | null | PASSED | 1,600 | standard input | 2 seconds | The first line contains one integer $$$q$$$ ($$$1 \le q \le 100$$$) — the number of queries. Each query contains two lines and is independent of all other queries. The first line of each query contains two integers $$$h$$$ and $$$n$$$ ($$$1 \le h \le 10^9$$$, $$$1 \le n \le \min(h, 2 \cdot 10^5)$$$) — the height of the... | ["0\n1\n2\n0"] | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[])
{
int q;
int h, n;
int *p;
scanf("%d", &q);
for(int j = 0; j < q; ++j) {
scanf("%d%d", &h, &n);;
p = calloc(n + 1, sizeof(*p));
for(... | |
You are playing a game where your character should overcome different obstacles. The current problem is to come down from a cliff. The cliff has height $$$h$$$, and there is a moving platform on each height $$$x$$$ from $$$1$$$ to $$$h$$$.Each platform is either hidden inside the cliff or moved out. At first, there are... | For each query print one integer — the minimum number of magic crystals you have to spend to safely come down on the ground level (with height $$$0$$$). | C | d0c50562764f2008045fe57e5da5de1c | 813254676e1bd165a0f2109d8db802af | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"greedy",
"math"
] | 1570545300 | ["4\n3 2\n3 1\n8 6\n8 7 6 5 3 2\n9 6\n9 8 5 4 3 1\n1 1\n1"] | null | PASSED | 1,600 | standard input | 2 seconds | The first line contains one integer $$$q$$$ ($$$1 \le q \le 100$$$) — the number of queries. Each query contains two lines and is independent of all other queries. The first line of each query contains two integers $$$h$$$ and $$$n$$$ ($$$1 \le h \le 10^9$$$, $$$1 \le n \le \min(h, 2 \cdot 10^5)$$$) — the height of the... | ["0\n1\n2\n0"] | #include <stdio.h>
int P[200002];
int main()
{
int i;
int Q;
int h, n;
char F;
int R;
scanf("%d", &Q);
while (Q--)
{
scanf("%d %d", &h, &n);
for (i = 0; i < n; i++)
{
scanf("%d", &P[i]);
}
P[n] = 0;
P[n + 1] = 0;
F = 0;
... | |
You are playing a game where your character should overcome different obstacles. The current problem is to come down from a cliff. The cliff has height $$$h$$$, and there is a moving platform on each height $$$x$$$ from $$$1$$$ to $$$h$$$.Each platform is either hidden inside the cliff or moved out. At first, there are... | For each query print one integer — the minimum number of magic crystals you have to spend to safely come down on the ground level (with height $$$0$$$). | C | d0c50562764f2008045fe57e5da5de1c | 8d5f1de9387d0eb719228c6e1203b549 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"greedy",
"math"
] | 1570545300 | ["4\n3 2\n3 1\n8 6\n8 7 6 5 3 2\n9 6\n9 8 5 4 3 1\n1 1\n1"] | null | PASSED | 1,600 | standard input | 2 seconds | The first line contains one integer $$$q$$$ ($$$1 \le q \le 100$$$) — the number of queries. Each query contains two lines and is independent of all other queries. The first line of each query contains two integers $$$h$$$ and $$$n$$$ ($$$1 \le h \le 10^9$$$, $$$1 \le n \le \min(h, 2 \cdot 10^5)$$$) — the height of the... | ["0\n1\n2\n0"] | #include <stdio.h>
int outPlatforms[200001];
int main() {
int q;
scanf("%d", &q);
while (q--) {
int h, n;
scanf("%d %d", &h, &n);
int count1;
for (count1 = 0; count1 < n; count1++) {
scanf("%d", &outPlatforms[count1]);
}
outPlatforms[n] = 0;
int counter = 0;
for (count1 = 1; count1 < n; coun... | |
You are playing a game where your character should overcome different obstacles. The current problem is to come down from a cliff. The cliff has height $$$h$$$, and there is a moving platform on each height $$$x$$$ from $$$1$$$ to $$$h$$$.Each platform is either hidden inside the cliff or moved out. At first, there are... | For each query print one integer — the minimum number of magic crystals you have to spend to safely come down on the ground level (with height $$$0$$$). | C | d0c50562764f2008045fe57e5da5de1c | d4d1cbed80ca38c2139494ca3f9099e6 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"greedy",
"math"
] | 1570545300 | ["4\n3 2\n3 1\n8 6\n8 7 6 5 3 2\n9 6\n9 8 5 4 3 1\n1 1\n1"] | null | PASSED | 1,600 | standard input | 2 seconds | The first line contains one integer $$$q$$$ ($$$1 \le q \le 100$$$) — the number of queries. Each query contains two lines and is independent of all other queries. The first line of each query contains two integers $$$h$$$ and $$$n$$$ ($$$1 \le h \le 10^9$$$, $$$1 \le n \le \min(h, 2 \cdot 10^5)$$$) — the height of the... | ["0\n1\n2\n0"] | /* practice with Dukkha */
#include <stdio.h>
int main() {
int q;
scanf("%d", &q);
while (q--) {
int h, n, i, h_, p, cnt;
scanf("%d%d%d", &h_, &n, &h_), h_++;
cnt = 0, p = 0;
for (i = 1; i < n; i++) {
scanf("%d", &h);
if (h_ - h > 1) {
if (p == 1)
cnt++;
else
p = 1;
} else
p... | |
You are playing a game where your character should overcome different obstacles. The current problem is to come down from a cliff. The cliff has height $$$h$$$, and there is a moving platform on each height $$$x$$$ from $$$1$$$ to $$$h$$$.Each platform is either hidden inside the cliff or moved out. At first, there are... | For each query print one integer — the minimum number of magic crystals you have to spend to safely come down on the ground level (with height $$$0$$$). | C | d0c50562764f2008045fe57e5da5de1c | 520ca54570ac9658147dba8a6e091622 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"greedy",
"math"
] | 1570545300 | ["4\n3 2\n3 1\n8 6\n8 7 6 5 3 2\n9 6\n9 8 5 4 3 1\n1 1\n1"] | null | PASSED | 1,600 | standard input | 2 seconds | The first line contains one integer $$$q$$$ ($$$1 \le q \le 100$$$) — the number of queries. Each query contains two lines and is independent of all other queries. The first line of each query contains two integers $$$h$$$ and $$$n$$$ ($$$1 \le h \le 10^9$$$, $$$1 \le n \le \min(h, 2 \cdot 10^5)$$$) — the height of the... | ["0\n1\n2\n0"] | int q,h,n,c,d,x;main(){for(scanf("%d",&q);q--;){scanf("%d%d",&h,&n);for(c=1,d=0;n--;){scanf("%d",&x);if(h-x>1)d+=c,c=0;c^=1;h=x;}printf("%d ",d+c*(x>1));}} | |
You are playing a game where your character should overcome different obstacles. The current problem is to come down from a cliff. The cliff has height $$$h$$$, and there is a moving platform on each height $$$x$$$ from $$$1$$$ to $$$h$$$.Each platform is either hidden inside the cliff or moved out. At first, there are... | For each query print one integer — the minimum number of magic crystals you have to spend to safely come down on the ground level (with height $$$0$$$). | C | d0c50562764f2008045fe57e5da5de1c | 64b3ccaf6fc09079860cdafacc6c705c | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"greedy",
"math"
] | 1570545300 | ["4\n3 2\n3 1\n8 6\n8 7 6 5 3 2\n9 6\n9 8 5 4 3 1\n1 1\n1"] | null | PASSED | 1,600 | standard input | 2 seconds | The first line contains one integer $$$q$$$ ($$$1 \le q \le 100$$$) — the number of queries. Each query contains two lines and is independent of all other queries. The first line of each query contains two integers $$$h$$$ and $$$n$$$ ($$$1 \le h \le 10^9$$$, $$$1 \le n \le \min(h, 2 \cdot 10^5)$$$) — the height of the... | ["0\n1\n2\n0"] | #include <stdio.h>
struct _g_data
{
int size, bot;
} typedef gd;
int list[200005];
gd group[200005];
int main(void)
{
int q = 0;
scanf("%d", &q);
while (q--)
{
int h = 0, n = 0, gcnt = 0, result = 0;
scanf("%d%d", &h, &n);
for (int i = 0, x; i < n; i++)
{
scanf("%d", &list[i]);
}
list[n] = 0;... | |
You are playing a game where your character should overcome different obstacles. The current problem is to come down from a cliff. The cliff has height $$$h$$$, and there is a moving platform on each height $$$x$$$ from $$$1$$$ to $$$h$$$.Each platform is either hidden inside the cliff or moved out. At first, there are... | For each query print one integer — the minimum number of magic crystals you have to spend to safely come down on the ground level (with height $$$0$$$). | C | d0c50562764f2008045fe57e5da5de1c | 6a9064854e457a0e5e7e5f8795d21d89 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"greedy",
"math"
] | 1570545300 | ["4\n3 2\n3 1\n8 6\n8 7 6 5 3 2\n9 6\n9 8 5 4 3 1\n1 1\n1"] | null | PASSED | 1,600 | standard input | 2 seconds | The first line contains one integer $$$q$$$ ($$$1 \le q \le 100$$$) — the number of queries. Each query contains two lines and is independent of all other queries. The first line of each query contains two integers $$$h$$$ and $$$n$$$ ($$$1 \le h \le 10^9$$$, $$$1 \le n \le \min(h, 2 \cdot 10^5)$$$) — the height of the... | ["0\n1\n2\n0"] | #include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int h,n;
scanf("%d%d",&h,&n);
int ar[200001];
int i;
for(i=0;i<n;i++)
scanf("%d",&ar[i]);
int count=0;
int curr = h;
int index = 1;
if(n==1)
{
printf("0\n");
continue;
}
while(curr>=3)
{
if(ar[index]!=curr-1)
... | |
You are playing a game where your character should overcome different obstacles. The current problem is to come down from a cliff. The cliff has height $$$h$$$, and there is a moving platform on each height $$$x$$$ from $$$1$$$ to $$$h$$$.Each platform is either hidden inside the cliff or moved out. At first, there are... | For each query print one integer — the minimum number of magic crystals you have to spend to safely come down on the ground level (with height $$$0$$$). | C | d0c50562764f2008045fe57e5da5de1c | 28c3199c8a5e28a3d6f4bb149aa0a4c6 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"greedy",
"math"
] | 1570545300 | ["4\n3 2\n3 1\n8 6\n8 7 6 5 3 2\n9 6\n9 8 5 4 3 1\n1 1\n1"] | null | PASSED | 1,600 | standard input | 2 seconds | The first line contains one integer $$$q$$$ ($$$1 \le q \le 100$$$) — the number of queries. Each query contains two lines and is independent of all other queries. The first line of each query contains two integers $$$h$$$ and $$$n$$$ ($$$1 \le h \le 10^9$$$, $$$1 \le n \le \min(h, 2 \cdot 10^5)$$$) — the height of the... | ["0\n1\n2\n0"] | #include<stdio.h>
int arr[200005], h, n;
int main(){
int q;
scanf("%d", &q);
while(q--){
int i;
scanf("%d %d", &h, &n);
for(i = 0;i < n;i++)scanf("%d", arr + i);
int ans = 0;
i = 0;
while(i < n - 2){
if(arr[i + 1] == arr[i + 2] + 1)i += 2;
else{
i++;ans++;
}
}
... | |
The GCD table G of size n × n for an array of positive integers a of length n is defined by formula Let us remind you that the greatest common divisor (GCD) of two positive integers x and y is the greatest integer that is divisor of both x and y, it is denoted as . For example, for array a = {4, 3, 6, 2} of length 4 ... | In the single line print n positive integers — the elements of array a. If there are multiple possible solutions, you are allowed to print any of them. | C | 71dc07f0ea8962f23457af1d6509aeee | 74da107a2fc552c47785974e8aba34b7 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms",
"number theory"
] | 1443890700 | ["4\n2 1 2 3 4 3 2 6 1 1 2 2 1 2 3 2", "1\n42", "2\n1 1 1 1"] | null | PASSED | 1,700 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 500) — the length of array a. The second line contains n2 space-separated numbers — the elements of the GCD table of G for array a. All the numbers in the table are positive integers, not exceeding 109. Note that the elements are given in an arbitrary order. It is guaranteed t... | ["4 3 6 2", "42", "1 1"] | #include <stdio.h>
#include <stdlib.h>
#define MAX 555555
int a[MAX];
int used[MAX];
int alr[MAX];
int rem[MAX];
int gcd(int x, int y) {
return x == 0 ? y : gcd(y % x, x);
}
int cmp(const void *a, const void * b) {
return *((int*) a) - *((int*) b);
}
int main() {
int n, i;
scanf("%d", &n);
... | |
The GCD table G of size n × n for an array of positive integers a of length n is defined by formula Let us remind you that the greatest common divisor (GCD) of two positive integers x and y is the greatest integer that is divisor of both x and y, it is denoted as . For example, for array a = {4, 3, 6, 2} of length 4 ... | In the single line print n positive integers — the elements of array a. If there are multiple possible solutions, you are allowed to print any of them. | C | 71dc07f0ea8962f23457af1d6509aeee | 09285a4234e5e759f5227dfe596c61e5 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms",
"number theory"
] | 1443890700 | ["4\n2 1 2 3 4 3 2 6 1 1 2 2 1 2 3 2", "1\n42", "2\n1 1 1 1"] | null | PASSED | 1,700 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 500) — the length of array a. The second line contains n2 space-separated numbers — the elements of the GCD table of G for array a. All the numbers in the table are positive integers, not exceeding 109. Note that the elements are given in an arbitrary order. It is guaranteed t... | ["4 3 6 2", "42", "1 1"] | #include<stdio.h>
#include<stdlib.h>
typedef unsigned u;
int F(const void*x,const void*y){return*(int*)x-*(int*)y;}
typedef struct S
{
u val;
struct S *lc,*rc;
}v;
v* alloc()
{
v *x;
x=(v*)malloc(sizeof(v));
x->lc=x->rc=NULL;
x->val=0;return x;
}
v *p,*q;
u tes(u n)
{
for(q=p;n;n>>=1)
{
if(n&1){if(q->lc==NULL... | |
The GCD table G of size n × n for an array of positive integers a of length n is defined by formula Let us remind you that the greatest common divisor (GCD) of two positive integers x and y is the greatest integer that is divisor of both x and y, it is denoted as . For example, for array a = {4, 3, 6, 2} of length 4 ... | In the single line print n positive integers — the elements of array a. If there are multiple possible solutions, you are allowed to print any of them. | C | 71dc07f0ea8962f23457af1d6509aeee | 403669e60bc0b61cef2fff17221fe29b | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms",
"number theory"
] | 1443890700 | ["4\n2 1 2 3 4 3 2 6 1 1 2 2 1 2 3 2", "1\n42", "2\n1 1 1 1"] | null | PASSED | 1,700 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 500) — the length of array a. The second line contains n2 space-separated numbers — the elements of the GCD table of G for array a. All the numbers in the table are positive integers, not exceeding 109. Note that the elements are given in an arbitrary order. It is guaranteed t... | ["4 3 6 2", "42", "1 1"] | #include <stdio.h>
#include <stdlib.h>
#define N 500
int compare(const void *a, const void *b) {
int ia = *(int *) a;
int ib = *(int *) b;
return ib - ia;
}
int gcd(int a, int b) {
return b == 0 ? a : gcd(b, a % b);
}
int main() {
static int gg[N * N], hh[N * 2], aa[N];
static char marked[N * N];
int n, k, ... | |
The GCD table G of size n × n for an array of positive integers a of length n is defined by formula Let us remind you that the greatest common divisor (GCD) of two positive integers x and y is the greatest integer that is divisor of both x and y, it is denoted as . For example, for array a = {4, 3, 6, 2} of length 4 ... | In the single line print n positive integers — the elements of array a. If there are multiple possible solutions, you are allowed to print any of them. | C | 71dc07f0ea8962f23457af1d6509aeee | 2f8dd8292794146dcbd7e8a7077d3a4f | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms",
"number theory"
] | 1443890700 | ["4\n2 1 2 3 4 3 2 6 1 1 2 2 1 2 3 2", "1\n42", "2\n1 1 1 1"] | null | PASSED | 1,700 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 500) — the length of array a. The second line contains n2 space-separated numbers — the elements of the GCD table of G for array a. All the numbers in the table are positive integers, not exceeding 109. Note that the elements are given in an arbitrary order. It is guaranteed t... | ["4 3 6 2", "42", "1 1"] | #include <stdio.h>
#include <stdlib.h>
typedef struct {
int num;
int cnt;
} Node_t;
Node_t B[250000];
int Size;
int Ans[500];
int AnsSize;
int cmp(const void *a, const void *b)
{
return (*(Node_t *)b).num - (*(Node_t *)a).num;
}
int GCD(int a, int b)
{
int temp;
while(b) {
temp = a;
... | |
The GCD table G of size n × n for an array of positive integers a of length n is defined by formula Let us remind you that the greatest common divisor (GCD) of two positive integers x and y is the greatest integer that is divisor of both x and y, it is denoted as . For example, for array a = {4, 3, 6, 2} of length 4 ... | In the single line print n positive integers — the elements of array a. If there are multiple possible solutions, you are allowed to print any of them. | C | 71dc07f0ea8962f23457af1d6509aeee | eaa383daa26ed1782a135a09da1e0df9 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms",
"number theory"
] | 1443890700 | ["4\n2 1 2 3 4 3 2 6 1 1 2 2 1 2 3 2", "1\n42", "2\n1 1 1 1"] | null | PASSED | 1,700 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 500) — the length of array a. The second line contains n2 space-separated numbers — the elements of the GCD table of G for array a. All the numbers in the table are positive integers, not exceeding 109. Note that the elements are given in an arbitrary order. It is guaranteed t... | ["4 3 6 2", "42", "1 1"] | #include<stdio.h>
long a[251111],v[251111],cc[251111],rem[251111];
void swap(long *aaa,long *bbb)
{
long t;
t=*aaa;
*aaa=*bbb;
*bbb=t;
}
void qsort(long low,long high)
{
long i=low,j=high,mid=a[(low+high)/2];
while(i<j)
{
while(a[i]<mid)i++;
while(a[j]>mid)j--;
if(i<=... | |
The GCD table G of size n × n for an array of positive integers a of length n is defined by formula Let us remind you that the greatest common divisor (GCD) of two positive integers x and y is the greatest integer that is divisor of both x and y, it is denoted as . For example, for array a = {4, 3, 6, 2} of length 4 ... | In the single line print n positive integers — the elements of array a. If there are multiple possible solutions, you are allowed to print any of them. | C | 71dc07f0ea8962f23457af1d6509aeee | a24b7c68df09d1230ccdfe2d9cea99ba | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms",
"number theory"
] | 1443890700 | ["4\n2 1 2 3 4 3 2 6 1 1 2 2 1 2 3 2", "1\n42", "2\n1 1 1 1"] | null | PASSED | 1,700 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 500) — the length of array a. The second line contains n2 space-separated numbers — the elements of the GCD table of G for array a. All the numbers in the table are positive integers, not exceeding 109. Note that the elements are given in an arbitrary order. It is guaranteed t... | ["4 3 6 2", "42", "1 1"] | #include<stdio.h>
#include<stdlib.h>
int cmpfunc (const void * a, const void * b)
{
return ( *(int*)a - *(int*)b );
}
int gcd(int,int);
int binsear(int);
int map[250005],mlen;
int main(){
int n,*ar,i,c,j,ans[502],alen,cnt[250005],ele;
scanf("%d",&n);
ar=(int *)malloc(sizeof(int)*n*n);
for(i=0;i<n*n;i++)
sc... | |
In Aramic language words can only represent objects.Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$y... | Output one integer — the number of different objects mentioned in the given ancient Aramic script. | C | cf1eb164c4c970fd398ef9e98b4c07b1 | ffae398b3c2d4e9a319c4e4ca5a7d6c7 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1525183500 | ["5\na aa aaa ab abb", "3\namer arem mrea"] | NoteIn the first test, there are two objects mentioned. The roots that represent them are "a","ab".In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer". | PASSED | 900 | standard input | 1 second | The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$) — the number of words in the script. The second line contains $$$n$$$ words $$$s_1, s_2, \ldots, s_n$$$ — the script itself. The length of each string does not exceed $$$10^3$$$. It is guaranteed that all characters of the strings are small latin le... | ["2", "1"] | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
int n,i;
scanf("%d",&n);
char word[1000];
int *roots;
int rootLen = 0;
roots = (int *)malloc(rootLen*sizeof(int)*26);
for(i=0;i<n;i++)
{
int root[26] = {0},j,c=1;
scanf("%s",&word);
for(j=0;j<strlen(word);j++)
{
if(root[word[j]-97]... | |
In Aramic language words can only represent objects.Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$y... | Output one integer — the number of different objects mentioned in the given ancient Aramic script. | C | cf1eb164c4c970fd398ef9e98b4c07b1 | bd745773cd97747aab6b8caa03e89a37 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1525183500 | ["5\na aa aaa ab abb", "3\namer arem mrea"] | NoteIn the first test, there are two objects mentioned. The roots that represent them are "a","ab".In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer". | PASSED | 900 | standard input | 1 second | The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$) — the number of words in the script. The second line contains $$$n$$$ words $$$s_1, s_2, \ldots, s_n$$$ — the script itself. The length of each string does not exceed $$$10^3$$$. It is guaranteed that all characters of the strings are small latin le... | ["2", "1"] | #include <stdio.h>
#include <string.h>
char process_str(char string[]){
char temp;
int i, j, count = 0, len = strlen(string);
for(i = 0; i < len-1; i++){
for(j = i + 1; j < len; j++){
if(string[i] == string[j]){
string[j] = '\0';
}
}
}
for(i =... | |
In Aramic language words can only represent objects.Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$y... | Output one integer — the number of different objects mentioned in the given ancient Aramic script. | C | cf1eb164c4c970fd398ef9e98b4c07b1 | df265face5b54bb1e7d136f60ed9a0a2 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1525183500 | ["5\na aa aaa ab abb", "3\namer arem mrea"] | NoteIn the first test, there are two objects mentioned. The roots that represent them are "a","ab".In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer". | PASSED | 900 | standard input | 1 second | The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$) — the number of words in the script. The second line contains $$$n$$$ words $$$s_1, s_2, \ldots, s_n$$$ — the script itself. The length of each string does not exceed $$$10^3$$$. It is guaranteed that all characters of the strings are small latin le... | ["2", "1"] | #include<stdio.h>
int used[27][1001];
int cnt,par;
char c[1001];
int main()
{
int n;
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
scanf("%s",&c);
for(int t=0;c[t]!='\0';t++)
used[c[t]-'a'+1][i]=1;
par=0;
for(int j=0;j<i;j++)
{
int tt=1;
... | |
In Aramic language words can only represent objects.Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$y... | Output one integer — the number of different objects mentioned in the given ancient Aramic script. | C | cf1eb164c4c970fd398ef9e98b4c07b1 | 8c91dc5f3520baea890628f31bcbce5a | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1525183500 | ["5\na aa aaa ab abb", "3\namer arem mrea"] | NoteIn the first test, there are two objects mentioned. The roots that represent them are "a","ab".In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer". | PASSED | 900 | standard input | 1 second | The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$) — the number of words in the script. The second line contains $$$n$$$ words $$$s_1, s_2, \ldots, s_n$$$ — the script itself. The length of each string does not exceed $$$10^3$$$. It is guaranteed that all characters of the strings are small latin le... | ["2", "1"] | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define NO_OF_CHARS 256
#define bool int
void sort_string(char *s);
char *removeDups(char *str);
void sort_string(char *s)
{
int c, d = 0, length;
char *pointer, *result, ch;
length = strlen(s);
result = (char*)malloc(length+1);
pointer = s;... | |
In Aramic language words can only represent objects.Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$y... | Output one integer — the number of different objects mentioned in the given ancient Aramic script. | C | cf1eb164c4c970fd398ef9e98b4c07b1 | bfbc90403222250d7b92c5e28056b1a0 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1525183500 | ["5\na aa aaa ab abb", "3\namer arem mrea"] | NoteIn the first test, there are two objects mentioned. The roots that represent them are "a","ab".In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer". | PASSED | 900 | standard input | 1 second | The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$) — the number of words in the script. The second line contains $$$n$$$ words $$$s_1, s_2, \ldots, s_n$$$ — the script itself. The length of each string does not exceed $$$10^3$$$. It is guaranteed that all characters of the strings are small latin le... | ["2", "1"] | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
//code
int n;
scanf("%d",&n);
char **A=(char**)malloc(n*sizeof(char*));
char **R=(char**)malloc(n*sizeof(char*));
for(int i=0;i<n;i++) A[i]=(char*)malloc(1000*sizeof(char));
for(int i=0;i<n;i++) R[i]=(char*)malloc(27*sizeof(char));
for(i... | |
In Aramic language words can only represent objects.Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$y... | Output one integer — the number of different objects mentioned in the given ancient Aramic script. | C | cf1eb164c4c970fd398ef9e98b4c07b1 | 1f93bf245b5acebad9e1c4e1788c9c1e | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1525183500 | ["5\na aa aaa ab abb", "3\namer arem mrea"] | NoteIn the first test, there are two objects mentioned. The roots that represent them are "a","ab".In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer". | PASSED | 900 | standard input | 1 second | The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$) — the number of words in the script. The second line contains $$$n$$$ words $$$s_1, s_2, \ldots, s_n$$$ — the script itself. The length of each string does not exceed $$$10^3$$$. It is guaranteed that all characters of the strings are small latin le... | ["2", "1"] | #include<stdio.h>
#include<string.h>
int mark[1005][30];
char a[1005];
int main()
{
int n,sum=0;
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
int flag=1;
scanf("%s",a);
int l=strlen(a);
for(int j=0;j<l;j++)
mark[i][a[j]-'a']=1;
for(int j=1;j<i;j++)
{
int ok=1;
for(int g=0;g<30;g++)
if(mark[j][g]... | |
You are given two integers $$$a$$$ and $$$b$$$. Moreover, you are given a sequence $$$s_0, s_1, \dots, s_{n}$$$. All values in $$$s$$$ are integers $$$1$$$ or $$$-1$$$. It's known that sequence is $$$k$$$-periodic and $$$k$$$ divides $$$n+1$$$. In other words, for each $$$k \leq i \leq n$$$ it's satisfied that $$$s_{i}... | Output a single integer — value of given expression modulo $$$10^{9} + 9$$$. | C | 607e670403a40e4fddf389caba79607e | 7be42db86a154f0f7e706b0639b9a065 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"number theory",
"math",
"matrices"
] | 1523973900 | ["2 2 3 3\n+-+", "4 1 5 1\n-"] | NoteIn the first example:$$$(\sum \limits_{i=0}^{n} s_{i} a^{n - i} b^{i})$$$ = $$$2^{2} 3^{0} - 2^{1} 3^{1} + 2^{0} 3^{2}$$$ = 7In the second example:$$$(\sum \limits_{i=0}^{n} s_{i} a^{n - i} b^{i}) = -1^{4} 5^{0} - 1^{3} 5^{1} - 1^{2} 5^{2} - 1^{1} 5^{3} - 1^{0} 5^{4} = -781 \equiv 999999228 \pmod{10^{9} + 9}$$$. | PASSED | 1,800 | standard input | 1 second | The first line contains four integers $$$n, a, b$$$ and $$$k$$$ $$$(1 \leq n \leq 10^{9}, 1 \leq a, b \leq 10^{9}, 1 \leq k \leq 10^{5})$$$. The second line contains a sequence of length $$$k$$$ consisting of characters '+' and '-'. If the $$$i$$$-th character (0-indexed) is '+', then $$$s_{i} = 1$$$, otherwise $$$s_{... | ["7", "999999228"] | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define mod 1000000009
typedef long long int ll;
char arr[100001];
ll power(ll number,ll power)
{
ll answer=1;
while(power)
{
if(power%2)
answer=(answer*number)%mod;
number=(number*number)%mod;
power=power/2;
}
return answer;
}
int main()
{
//freope... | |
You are given an undirected graph consisting of $$$n$$$ vertices. A number is written on each vertex; the number on vertex $$$i$$$ is $$$a_i$$$. Initially there are no edges in the graph.You may add some edges to this graph, but you have to pay for them. The cost of adding an edge between vertices $$$x$$$ and $$$y$$$ i... | Print one integer — the minimum number of coins you have to pay to make the graph connected. | C | e52ec2fa5bcf5d2027d57b0694b4e15a | c55850491ec853c07e8697f1bc18e193 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"dsu",
"greedy",
"graphs"
] | 1545921300 | ["3 2\n1 3 3\n2 3 5\n2 1 1", "4 0\n1 3 3 7", "5 4\n1 2 3 4 5\n1 2 8\n1 3 10\n1 4 7\n1 5 15"] | NoteIn the first example it is possible to connect $$$1$$$ to $$$2$$$ using special offer $$$2$$$, and then $$$1$$$ to $$$3$$$ without using any offers.In next two examples the optimal answer may be achieved without using special offers. | PASSED | 1,900 | standard input | 2 seconds | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$0 \le m \le 2 \cdot 10^5$$$) — the number of vertices in the graph and the number of special offers, respectively. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^{12}$$$) — the numbers... | ["5", "16", "18"] | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#define N 200000
#define M 200000
void init_rand() {
struct timeval tv;
gettimeofday(&tv, NULL);
srand(tv.tv_sec ^ tv.tv_usec);
}
int rand_(int n) {
return (rand() * 45677LL + rand()) % n;
}
struct E {
int i, j;
long long w;
} e... | |
You are given an undirected graph consisting of $$$n$$$ vertices. A number is written on each vertex; the number on vertex $$$i$$$ is $$$a_i$$$. Initially there are no edges in the graph.You may add some edges to this graph, but you have to pay for them. The cost of adding an edge between vertices $$$x$$$ and $$$y$$$ i... | Print one integer — the minimum number of coins you have to pay to make the graph connected. | C | e52ec2fa5bcf5d2027d57b0694b4e15a | 7b7b60eecf4d520e713eba3f43a34667 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"dsu",
"greedy",
"graphs"
] | 1545921300 | ["3 2\n1 3 3\n2 3 5\n2 1 1", "4 0\n1 3 3 7", "5 4\n1 2 3 4 5\n1 2 8\n1 3 10\n1 4 7\n1 5 15"] | NoteIn the first example it is possible to connect $$$1$$$ to $$$2$$$ using special offer $$$2$$$, and then $$$1$$$ to $$$3$$$ without using any offers.In next two examples the optimal answer may be achieved without using special offers. | PASSED | 1,900 | standard input | 2 seconds | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$0 \le m \le 2 \cdot 10^5$$$) — the number of vertices in the graph and the number of special offers, respectively. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^{12}$$$) — the numbers... | ["5", "16", "18"] | #include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>
void msort_memcpy (uint8_t * restrict dst, uint8_t * restrict src, size_t size) {
while (size--) {
*dst++ = *src++;
}
}
void msort (void * const array, const size_t num, const size_t size, int (* const cmp) (const void *, const void ... | |
You are given an undirected graph consisting of $$$n$$$ vertices. A number is written on each vertex; the number on vertex $$$i$$$ is $$$a_i$$$. Initially there are no edges in the graph.You may add some edges to this graph, but you have to pay for them. The cost of adding an edge between vertices $$$x$$$ and $$$y$$$ i... | Print one integer — the minimum number of coins you have to pay to make the graph connected. | C | e52ec2fa5bcf5d2027d57b0694b4e15a | cfbcb4ef2b8c53b1b9808c6a5749d6eb | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"dsu",
"greedy",
"graphs"
] | 1545921300 | ["3 2\n1 3 3\n2 3 5\n2 1 1", "4 0\n1 3 3 7", "5 4\n1 2 3 4 5\n1 2 8\n1 3 10\n1 4 7\n1 5 15"] | NoteIn the first example it is possible to connect $$$1$$$ to $$$2$$$ using special offer $$$2$$$, and then $$$1$$$ to $$$3$$$ without using any offers.In next two examples the optimal answer may be achieved without using special offers. | PASSED | 1,900 | standard input | 2 seconds | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$0 \le m \le 2 \cdot 10^5$$$) — the number of vertices in the graph and the number of special offers, respectively. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^{12}$$$) — the numbers... | ["5", "16", "18"] | #include<stdio.h>
#include<stdlib.h>
#define N 200043
typedef struct road{
int x;
int y;
long long distance;
}road;
int p[N];
int getRoot(int x){
return ((x==p[x])?x:(p[x]=getRoot(p[x])));
}
int compare(const void *a,const void *b){
if(((road*)a)->distance-((road*)b)->distance>0)return 1;
else if(((road*)a)->... | |
Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.For a fixed interval (set of consecutive elements) of balls we can define a dominant color. It's a color occurring the biggest ... | Print n integers. The i-th of them should be equal to the number of intervals where i is a dominant color. | C | f292c099e4eac9259a5bc9e42ff6d1b5 | 78dc992fb3b646cee344269b8ee1f97d | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"data structures",
"implementation",
"brute force"
] | 1462633500 | ["4\n1 2 1 2", "3\n1 1 1"] | NoteIn the first sample, color 2 is dominant in three intervals: An interval [2, 2] contains one ball. This ball's color is 2 so it's clearly a dominant color. An interval [4, 4] contains one ball, with color 2 again. An interval [2, 4] contains two balls of color 2 and one ball of color 1. There are 7 more interval... | PASSED | 1,500 | standard input | 2 seconds | The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — the number of balls. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ n) where ti is the color of the i-th ball. | ["7 3 0 0", "6 0 0"] | /* practice with Dukkha */
#include <stdio.h>
#include <string.h>
#define N 5000
int main() {
static int aa[N], kk[N], ans[N];
int n, i, j, a, a_;
scanf("%d", &n);
for (i = 0; i < n; i++)
scanf("%d", &aa[i]), aa[i]--;
for (i = 0; i < n; i++) {
memset(kk, 0, n * sizeof *kk);
a_ = -1;
for (j = i; j < n; j... | |
Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.For a fixed interval (set of consecutive elements) of balls we can define a dominant color. It's a color occurring the biggest ... | Print n integers. The i-th of them should be equal to the number of intervals where i is a dominant color. | C | f292c099e4eac9259a5bc9e42ff6d1b5 | 821391d00c11053ca894ca76faac60f6 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"data structures",
"implementation",
"brute force"
] | 1462633500 | ["4\n1 2 1 2", "3\n1 1 1"] | NoteIn the first sample, color 2 is dominant in three intervals: An interval [2, 2] contains one ball. This ball's color is 2 so it's clearly a dominant color. An interval [4, 4] contains one ball, with color 2 again. An interval [2, 4] contains two balls of color 2 and one ball of color 1. There are 7 more interval... | PASSED | 1,500 | standard input | 2 seconds | The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — the number of balls. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ n) where ti is the color of the i-th ball. | ["7 3 0 0", "6 0 0"] | #include <stdio.h>
#include <string.h>
#define N 5000
int main() {
static int tt[N], ans[N + 1];
int n, i, t;
scanf("%d", &n);
for (i = 0; i < n; i++)
scanf("%d", &tt[i]);
for (i = 0; i < n; i++) {
static int kk[N + 1];
int j;
memset(kk, 0, (n + 1) * sizeof *kk);
t = -1;
for (j = i; j < n; j++) {
... | |
Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.For a fixed interval (set of consecutive elements) of balls we can define a dominant color. It's a color occurring the biggest ... | Print n integers. The i-th of them should be equal to the number of intervals where i is a dominant color. | C | f292c099e4eac9259a5bc9e42ff6d1b5 | f2317a2e837c80af8a1f4e65f0c5d717 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"data structures",
"implementation",
"brute force"
] | 1462633500 | ["4\n1 2 1 2", "3\n1 1 1"] | NoteIn the first sample, color 2 is dominant in three intervals: An interval [2, 2] contains one ball. This ball's color is 2 so it's clearly a dominant color. An interval [4, 4] contains one ball, with color 2 again. An interval [2, 4] contains two balls of color 2 and one ball of color 1. There are 7 more interval... | PASSED | 1,500 | standard input | 2 seconds | The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — the number of balls. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ n) where ti is the color of the i-th ball. | ["7 3 0 0", "6 0 0"] | #include <stdio.h>
#include <string.h>
#define N 5000
int main() {
static int tt[N], ans[N + 1];
int n, i, t;
scanf("%d", &n);
for (i = 0; i < n; i++)
scanf("%d", &tt[i]);
for (i = 0; i < n; i++) {
static int kk[N + 1];
int j;
memset(kk, 0, (n + 1) * sizeof *kk);
t = -1;
for (j = i; j < n; j++) {
... | |
Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.For a fixed interval (set of consecutive elements) of balls we can define a dominant color. It's a color occurring the biggest ... | Print n integers. The i-th of them should be equal to the number of intervals where i is a dominant color. | C | f292c099e4eac9259a5bc9e42ff6d1b5 | bb722cea8f9fd7e87708819d25f95d78 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"data structures",
"implementation",
"brute force"
] | 1462633500 | ["4\n1 2 1 2", "3\n1 1 1"] | NoteIn the first sample, color 2 is dominant in three intervals: An interval [2, 2] contains one ball. This ball's color is 2 so it's clearly a dominant color. An interval [4, 4] contains one ball, with color 2 again. An interval [2, 4] contains two balls of color 2 and one ball of color 1. There are 7 more interval... | PASSED | 1,500 | standard input | 2 seconds | The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — the number of balls. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ n) where ti is the color of the i-th ball. | ["7 3 0 0", "6 0 0"] | #include<stdio.h>
typedef unsigned u;
u N[5555],S[5555],A[5555],x;
int main()
{
u n,i=-1,j,k,d;
for(scanf("%u",&n);++i<n;)scanf("%u",N+i);
for(i=-1;++i<n;)
{
for(x=0,d=j=-1;++j<=n;)S[j]=0;
for(j=i-1;++j<n;++A[d])
{
if((k=++S[N[j]])>x){x=k;d=N[j];}
else if(k==x&&N[j]<d)d=N[j];
}
}
for(i=0;++i<=n;)pri... | |
Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.For a fixed interval (set of consecutive elements) of balls we can define a dominant color. It's a color occurring the biggest ... | Print n integers. The i-th of them should be equal to the number of intervals where i is a dominant color. | C | f292c099e4eac9259a5bc9e42ff6d1b5 | 7dadc8e1e5c914ffb812c48999bb3ce5 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"data structures",
"implementation",
"brute force"
] | 1462633500 | ["4\n1 2 1 2", "3\n1 1 1"] | NoteIn the first sample, color 2 is dominant in three intervals: An interval [2, 2] contains one ball. This ball's color is 2 so it's clearly a dominant color. An interval [4, 4] contains one ball, with color 2 again. An interval [2, 4] contains two balls of color 2 and one ball of color 1. There are 7 more interval... | PASSED | 1,500 | standard input | 2 seconds | The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — the number of balls. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ n) where ti is the color of the i-th ball. | ["7 3 0 0", "6 0 0"] | #include<stdio.h>
int m[5010],d[5010][5010]={};
int main(){
int n,i,j,a,c[5010]={};
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&a);
m[j]=a;
for(j=0;j<=i;j++){
d[j][a]++;
if(d[j][a]>d[j][m[j]]||d[j][a]==d[j][m[j]]&&m[j]>a)m[j]=a;
c[m[j]]++;
}
}
for(i=1;i<n;i++)printf("%d ",c... | |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (n + 1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (i > 0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | 0b219838c670ace5c420c913f617ce09 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers h1, h2, ..., hn (1 ≤ hi ≤ 105) representing the heights of the pylons. | ["4", "4"] | #include<stdio.h>
int main(){
int i,n,l=0 ;
scanf("%d", &n);
int arr[n+1];
arr[0] = 0;
for(i=1;i<n+1;i++){
scanf("%d", &arr[i]);
if(arr[i] > l)
l=arr[i];
}
printf("%d", l);
return 0;
}
| |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (n + 1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (i > 0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | 6a8286d5fb7fa71aff039f3362c0b166 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers h1, h2, ..., hn (1 ≤ hi ≤ 105) representing the heights of the pylons. | ["4", "4"] | #include <stdio.h>
int main() {
int n,x,max=0;
scanf("%d",&n);
for (int i=0;i<n;i++,max=x>max?x:max)
scanf("%d",&x);
printf("%d\n",max);
return 0;
} | |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (n + 1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (i > 0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | 494a24a3ae8c39c7d3d251359cfa0403 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers h1, h2, ..., hn (1 ≤ hi ≤ 105) representing the heights of the pylons. | ["4", "4"] | #include<stdio.h>
int main()
{
int a,i;
scanf("%d",&a);
int b=0;
for(i=0;i<a;i++)
{
int q;
scanf("%d",&q);
if(q>b) b=q;
}
printf("%d\n",b);
return 0;
} | |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (n + 1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (i > 0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | 543891f2bdc6b172efe6fe41b3c85bb6 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers h1, h2, ..., hn (1 ≤ hi ≤ 105) representing the heights of the pylons. | ["4", "4"] | #include<stdio.h>
int a[1000001];
int main()
{
int n,m,i,j,ans=0;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&a[i]);
if(ans<a[i])
ans+=(a[i]-ans);
}
printf("%d",ans);
return 0;
}
| |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (n + 1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (i > 0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | be2c5aaebe108cde001fbb1da4859c1c | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers h1, h2, ..., hn (1 ≤ hi ≤ 105) representing the heights of the pylons. | ["4", "4"] | #include<stdio.h>
int a[1000001];
int main()
{
int n,m,i,j,ans=0;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&a[i]);
if(ans<a[i])
ans=a[i];
}
printf("%d",ans);
return 0;
}
| |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (n + 1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (i > 0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | 6f9d73d699129618e745876bfb9d0520 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers h1, h2, ..., hn (1 ≤ hi ≤ 105) representing the heights of the pylons. | ["4", "4"] | #include<stdio.h>
int main()
{
int n,i,j;
scanf("%d",&n);
int a[n+1];
a[0]=0;long long total=0,sum=0;
for(i=1;i<=n;i++)
scanf("%d",&a[i]);
for(i=1;i<=n;i++)
a[i-1]=a[i-1]-a[i];
for(i=0;i<n;i++)
{
if((sum+a[i])<0)
{
total+=-1*(sum+a... | |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (n + 1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (i > 0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | 3c65d5d20de7333947ea31a238bbd5e0 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers h1, h2, ..., hn (1 ≤ hi ≤ 105) representing the heights of the pylons. | ["4", "4"] | #include <stdio.h>
int main(){
int i,n,cost=0,energy=0;
scanf("%d", &n);
int pylons[n + 1];
pylons[0] = 0;
for(i = 1; i <= n; i++){
scanf("%d", &pylons[i]);
}
for(i = 0; i < n; i++){
if(pylons[i + 1] < pylons[i]){
energy = energy + pylons[i] - pylons[i + 1];
} else if(pylons[i + 1] - pylons[i] > energy... | |
Caisa solved the problem with the sugar and now he is on the way back to home. Caisa is playing a mobile game during his path. There are (n + 1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (i > 0) has height hi. The goal of the game is to reach n-th pylo... | Print a single number representing the minimum number of dollars paid by Caisa. | C | d03ad531630cbecc43f8da53b02d842e | 6adb58f12aa03db49e09e98c18e4c845 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"brute force",
"math"
] | 1409383800 | ["5\n3 4 3 2 4", "3\n4 4 4"] | NoteIn the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon. | PASSED | 1,100 | standard input | 1 second | The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers h1, h2, ..., hn (1 ≤ hi ≤ 105) representing the heights of the pylons. | ["4", "4"] | r;main(n,x){
for(scanf("%d",&n);n--;r=r>x?r:x)scanf("%d",&x);
printf("%d\n",r);
exit(0);} | |
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi... | Print the index of the day when Polycarp will celebrate the equator. | C | 241157c465fe5dd96acd514010904321 | 4cfb5402003e54d55411c6e0c1036b25 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1523370900 | ["4\n1 3 2 1", "6\n2 2 2 2 2 2"] | NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ... | PASSED | 1,300 | standard input | 2 seconds | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$... | ["2", "3"] | #include<stdio.h>
int main()
{
long long int sum1=0,sum2=0,x,i,j,n,a[200010];
scanf("%lld",&n);
for(i=0;i<n;i++){
scanf("%lld",&a[i]);
}
for(i=0;i<n;i++){
sum1+=a[i];
}
if(sum1%2==0)
{
x=sum1/2;
}
else
{
x=sum1/2;
x++;
}
for(i=0... | |
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi... | Print the index of the day when Polycarp will celebrate the equator. | C | 241157c465fe5dd96acd514010904321 | ad98a50ed487d1d77ffc6eb3eb1bbe1b | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1523370900 | ["4\n1 3 2 1", "6\n2 2 2 2 2 2"] | NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ... | PASSED | 1,300 | standard input | 2 seconds | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$... | ["2", "3"] | #include<stdio.h>
#include<math.h>
int main(){
int n,i,a[200000];
long long int c=0,d=0,x;
scanf("%d",&n);
for(i=1;i<=n;i++){
scanf("%d",&a[i]);
c+=(long long int)a[i];
}
for(i=1;i<=n;i++){
d+=(long long int)a[i];
x=ceil((double)c/2);
if(d>=x) break;
}
printf("%d",i);
return 0;
}
| |
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi... | Print the index of the day when Polycarp will celebrate the equator. | C | 241157c465fe5dd96acd514010904321 | ba440488e047a19a3806717aa5bdd1e8 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1523370900 | ["4\n1 3 2 1", "6\n2 2 2 2 2 2"] | NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ... | PASSED | 1,300 | standard input | 2 seconds | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$... | ["2", "3"] | #include<stdio.h>
#include<math.h>
int main()
{
int i,n,sum=0,x=0;
int equator;
scanf("%d",&n);
int a[n];
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
sum=sum+a[i];
}
equator =ceil(sum/2.0);
for(i=0;i<n;i++)
{
x=x+a[i];
if(x>=equator)
{
... | |
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi... | Print the index of the day when Polycarp will celebrate the equator. | C | 241157c465fe5dd96acd514010904321 | afcfc06d1586f52fefe23573ac757821 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1523370900 | ["4\n1 3 2 1", "6\n2 2 2 2 2 2"] | NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ... | PASSED | 1,300 | standard input | 2 seconds | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$... | ["2", "3"] | #include<stdio.h>
int main()
{
int n,i,s=0,a[200020],su=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
s+=a[i];
}
if(s%2!=0)
s=s+1;
su=0;
for(i=0;i<n;i++)
{
su+=a[i];
if(su>=s/2)
break;
}
printf("%d",i+1);
}
| |
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi... | Print the index of the day when Polycarp will celebrate the equator. | C | 241157c465fe5dd96acd514010904321 | 9b038355d50162bc82d3b19fe84a8e13 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1523370900 | ["4\n1 3 2 1", "6\n2 2 2 2 2 2"] | NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ... | PASSED | 1,300 | standard input | 2 seconds | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$... | ["2", "3"] | #include<stdio.h>
int main()
{
long int n;
scanf("%ld",&n);
long int a[n],sum1=0,sum2=0,i;
long int p=0;
for(i=0;i<n;i++)
{
scanf("%ld",&a[i]);
sum1=sum1+a[i];
}
p=(sum1/2);
if(n>1){
if(sum1%2==0){
for(i=0;i<n;i++)
{
sum2=sum2+a[i];
... | |
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi... | Print the index of the day when Polycarp will celebrate the equator. | C | 241157c465fe5dd96acd514010904321 | ff5fcb3e12abd11663d8906f79502119 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1523370900 | ["4\n1 3 2 1", "6\n2 2 2 2 2 2"] | NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ... | PASSED | 1,300 | standard input | 2 seconds | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$... | ["2", "3"] | #include<stdio.h>
int main()
{
int n,i,sum=0,b=0;
float j;
scanf("%d",&n);
int a[n];
for(i=0;i<n;i++){
scanf("%d",&a[i]);
sum=sum+a[i];
}
for(i=0;i<n;i++){
b=b+a[i];
if(b>=sum/2.0){
break;
}
}
printf("%d\n",i+1);
return 0;
}
| |
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi... | Print the index of the day when Polycarp will celebrate the equator. | C | 241157c465fe5dd96acd514010904321 | bdfbbe975b36530d2d7833336cb6e3b9 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1523370900 | ["4\n1 3 2 1", "6\n2 2 2 2 2 2"] | NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ... | PASSED | 1,300 | standard input | 2 seconds | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$... | ["2", "3"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int numberOfProblem;
scanf("%d",&numberOfProblem);
int problem[numberOfProblem];
int sumOfProblem=0;
for(int i = 0 ; i < numberOfProblem ; i ++)
{
scanf("%d",&problem[i]);
sumOfProblem+=problem[i];
}
if (sumOfProblem%2=... | |
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi... | Print the index of the day when Polycarp will celebrate the equator. | C | 241157c465fe5dd96acd514010904321 | f67b4f2846f397dfa1d61d20e81661dc | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1523370900 | ["4\n1 3 2 1", "6\n2 2 2 2 2 2"] | NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ... | PASSED | 1,300 | standard input | 2 seconds | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$... | ["2", "3"] | #include <stdio.h>
int main() {
int n;
scanf("%d", &n);
int arr[n];
unsigned long long int sum=0;
for (int i=0;i<n;i++) {
scanf("%d", &arr[i]);
sum+=arr[i];
}
unsigned long long int half=0, idx=0;
if (sum%2==1) sum=sum/2+1;
else sum=sum/2;
while (half<sum) {
half+=arr[idx++];
}
printf("%d\n", idx);
... | |
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi... | Print the index of the day when Polycarp will celebrate the equator. | C | 241157c465fe5dd96acd514010904321 | 4b92e49adcb47dcc7118fb79ce8dc0eb | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1523370900 | ["4\n1 3 2 1", "6\n2 2 2 2 2 2"] | NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ... | PASSED | 1,300 | standard input | 2 seconds | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$... | ["2", "3"] | #include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
int a[n],i,sum=0,j=0;
for(i=1;i<=n;i++)
{
scanf("%d",&a[i]);
sum=sum+a[i];
}
for(i=1;i<=n;i++)
{
j=j+a[i];
if(j*2>=sum)
{
printf("%d",i);
break;
}
}
}
| |
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi... | Print the index of the day when Polycarp will celebrate the equator. | C | 241157c465fe5dd96acd514010904321 | abddc212e0c8234a075ca60d05789ce8 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1523370900 | ["4\n1 3 2 1", "6\n2 2 2 2 2 2"] | NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ... | PASSED | 1,300 | standard input | 2 seconds | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$... | ["2", "3"] | // WTFPL - Copyright (C) 2018
// 962A - Equator
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
int kind_of_search(long int *arr, int size, long int needle)
{
int L = 0;
int R = size;
while (L < R) {
int mid = L + (R - L) / 2;
if (needle <= arr[mid])
R = mid;
else
L = mid + 1;
}
return L;
}
... | |
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi... | Print the index of the day when Polycarp will celebrate the equator. | C | 241157c465fe5dd96acd514010904321 | e89b511772c7b64ed37698ba01d4ee2e | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1523370900 | ["4\n1 3 2 1", "6\n2 2 2 2 2 2"] | NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ... | PASSED | 1,300 | standard input | 2 seconds | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$... | ["2", "3"] | #include<stdio.h>
int main()
{
int n,i,a[200000],s=0,k=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
s+=a[i];
}
if(s%2==0)
{
s/=2;
}
else
{
s++;
s/=2;
}
for(i=0;i<n;i++)
{
k+=a[i];
if(k>=s)
{
printf("%d",i+1);
return 0;
}
}
} | |
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi... | Print the index of the day when Polycarp will celebrate the equator. | C | 241157c465fe5dd96acd514010904321 | 553186ce2c3a6ea4ae6ea91ab1272d10 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1523370900 | ["4\n1 3 2 1", "6\n2 2 2 2 2 2"] | NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ... | PASSED | 1,300 | standard input | 2 seconds | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$... | ["2", "3"] | #include <stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
long long cmpfunc (const void * a, const void * b) {
return ( *(long long*)a - *(long long*)b );
}
int main(void){
long long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,x,m,l,max,k,sum2,min,f,r,o,sum1,sum=0,y,b,count1, a[1000000];
scanf("%l... | |
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first.On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He wi... | Print the index of the day when Polycarp will celebrate the equator. | C | 241157c465fe5dd96acd514010904321 | e50e394ff78ccf56dfbf40c4f0b9f8fa | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1523370900 | ["4\n1 3 2 1", "6\n2 2 2 2 2 2"] | NoteIn the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve $$$4$$$ out of $$$7$$$ scheduled problems on four days of the training.In the second example Polycarp will celebrate the equator on the evening of the third day, because up to ... | PASSED | 1,300 | standard input | 2 seconds | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 200\,000$$$) — the number of days to prepare for the programming contests. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10\,000$$$), where $$$a_i$$$ equals to the number of problems, which Polycarp will solve on the $$$... | ["2", "3"] | #include <stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
int compre( void *a, void *b){
return strlen(a)-strlen(b);
}
int main(void){
long long int test,i,j,n,count,flag,flag2,b1,l,p,i1,i2,m,u,r,q,d,x,max,max2,min,f,sum1,sum,a[2000000],b,c;
scanf("%lld",&n);
sum=0;
for(i=0;i<n;i++){
sca... |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 20