prob_desc_description stringlengths 63 3.8k | prob_desc_output_spec stringlengths 17 1.47k ⌀ | lang_cluster stringclasses 2
values | src_uid stringlengths 32 32 | code_uid stringlengths 32 32 | lang stringclasses 7
values | prob_desc_output_to stringclasses 3
values | prob_desc_memory_limit stringclasses 19
values | file_name stringclasses 111
values | tags listlengths 0 11 | prob_desc_created_at stringlengths 10 10 | prob_desc_sample_inputs stringlengths 2 802 | prob_desc_notes stringlengths 4 3k ⌀ | exec_outcome stringclasses 1
value | difficulty int64 -1 3.5k ⌀ | prob_desc_input_from stringclasses 3
values | prob_desc_time_limit stringclasses 27
values | prob_desc_input_spec stringlengths 28 2.42k ⌀ | prob_desc_sample_outputs stringlengths 2 796 | source_code stringlengths 42 65.5k | hidden_unit_tests stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
In Berland recently a new collection of toys went on sale. This collection consists of 109 types of toys, numbered with integers from 1 to 109. A toy from the new collection of the i-th type costs i bourles.Tania has managed to collect n different types of toys a1, a2, ..., an from the new collection. Today is Tanya's ... | In the first line print a single integer k — the number of different types of toys that Tanya should choose so that the number of different types of toys in her collection is maximum possible. Of course, the total cost of the selected toys should not exceed m. In the second line print k distinct space-separated integer... | C | 0318d4d5ea3425bf6506edeb1026f597 | 7d1e489d8e5c1f9bff95514d1f60585e | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"greedy"
] | 1459353900 | ["3 7\n1 3 4", "4 14\n4 6 12 8"] | NoteIn the first sample mom should buy two toys: one toy of the 2-nd type and one toy of the 5-th type. At any other purchase for 7 bourles (assuming that the toys of types 1, 3 and 4 have already been bought), it is impossible to buy two and more toys. | PASSED | 1,200 | standard input | 1 second | The first line contains two integers n (1 ≤ n ≤ 100 000) and m (1 ≤ m ≤ 109) — the number of types of toys that Tanya already has and the number of bourles that her mom is willing to spend on buying new toys. The next line contains n distinct integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the types of toys that Tanya alread... | ["2\n2 5", "4\n7 2 3 1"] | /* AUTHOR:AKASH JAIN
* USERNAME:akash19jain
* DATE:13/07/2019
*/
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#define MOD 1000000007
int cmp(const void * a,const void * b);
int main()
{
long long t=1,i=0;
//scanf("%lld",&t);
while(t--)
{
... | |
In Berland recently a new collection of toys went on sale. This collection consists of 109 types of toys, numbered with integers from 1 to 109. A toy from the new collection of the i-th type costs i bourles.Tania has managed to collect n different types of toys a1, a2, ..., an from the new collection. Today is Tanya's ... | In the first line print a single integer k — the number of different types of toys that Tanya should choose so that the number of different types of toys in her collection is maximum possible. Of course, the total cost of the selected toys should not exceed m. In the second line print k distinct space-separated integer... | C | 0318d4d5ea3425bf6506edeb1026f597 | 1fbe3ff702d407ab178022b4e73778a7 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"greedy"
] | 1459353900 | ["3 7\n1 3 4", "4 14\n4 6 12 8"] | NoteIn the first sample mom should buy two toys: one toy of the 2-nd type and one toy of the 5-th type. At any other purchase for 7 bourles (assuming that the toys of types 1, 3 and 4 have already been bought), it is impossible to buy two and more toys. | PASSED | 1,200 | standard input | 1 second | The first line contains two integers n (1 ≤ n ≤ 100 000) and m (1 ≤ m ≤ 109) — the number of types of toys that Tanya already has and the number of bourles that her mom is willing to spend on buying new toys. The next line contains n distinct integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the types of toys that Tanya alread... | ["2\n2 5", "4\n7 2 3 1"] | #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,x,m,l,max,k,sum2,min,y,f,r,o,sum1,sum=0,count1,a[1000000],c[1000000];
sc... | |
In Berland recently a new collection of toys went on sale. This collection consists of 109 types of toys, numbered with integers from 1 to 109. A toy from the new collection of the i-th type costs i bourles.Tania has managed to collect n different types of toys a1, a2, ..., an from the new collection. Today is Tanya's ... | In the first line print a single integer k — the number of different types of toys that Tanya should choose so that the number of different types of toys in her collection is maximum possible. Of course, the total cost of the selected toys should not exceed m. In the second line print k distinct space-separated integer... | C | 0318d4d5ea3425bf6506edeb1026f597 | efee39263fc46fa1b816a1e0fb7eb30d | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"greedy"
] | 1459353900 | ["3 7\n1 3 4", "4 14\n4 6 12 8"] | NoteIn the first sample mom should buy two toys: one toy of the 2-nd type and one toy of the 5-th type. At any other purchase for 7 bourles (assuming that the toys of types 1, 3 and 4 have already been bought), it is impossible to buy two and more toys. | PASSED | 1,200 | standard input | 1 second | The first line contains two integers n (1 ≤ n ≤ 100 000) and m (1 ≤ m ≤ 109) — the number of types of toys that Tanya already has and the number of bourles that her mom is willing to spend on buying new toys. The next line contains n distinct integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the types of toys that Tanya alread... | ["2\n2 5", "4\n7 2 3 1"] | #include <stdio.h>
int n,m,a[1000009],b[1000009],j,i;
main(){
for(scanf("%d %d",&n,&m);n--;){scanf("%d",&i);if(i<1000009)a[i]=1;}
for(i=1;i<=1000000;i++){if(!a[i]&&m-i>=0){m-=i;b[j++]=i;}if(m==0)break;}
printf("%d\n",j);for(i=0;i<j;i++)printf("%d ",b[i]);
return 0;} | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | 044395121b0c2da4955a0c17049e1932 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | #include<stdio.h>
#include<math.h>
#include<stdlib.h>
int main()
{
int n,i,fail=0,j;
char s[302],d,nd;
scanf("%d",&n);
getchar();
for(i=0;i<n;i++){
gets(s);
if(i==0){
d=s[0];
nd=s[1];
if(d==nd)
fail=1;
}
if(s[i]!=d ... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | 01f219033c6f0a0a3b6d0da40351ef31 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | #include<stdio.h>
int main()
{
int n,i,j;
scanf("%d",&n);
char A[n+1][n+1];
for( i = 0; i < n; i++)
{
for( j = 0; j < n; j++)
{
scanf(" %c",&A[i][j]);
}
}
char ch = A[0][0];
char ch2 = A[0][1];
if(ch == ch2)
{
printf("NO");
exit(0);
}
for( i = 0; i < n; i++)
{
if( A[i][i] != A[i][n-1-i] || ... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | d897dd4130613cd27e59801c7e5e6501 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | #include<stdio.h>
#include<conio.h>
#include<string.h>
int main()
{
int n,i,j,l,m=0;
char a,b;
scanf("%d",&n);
char S[n][n];
for(i=0;i<n;i++)
{
scanf("%s",&S[i]);
}
a=S[0][0];
b=S[0][1];
if(a==b)
{
m=1;
}
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | 993d0abd76a61ba099622d879b568397 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
unsigned n;
scanf("%u\n", &n);
char mtx[n][n];
for (unsigned i = 0; i < n; i++)
{
for (unsigned j = 0; j < n; j++)
scanf("%c", &mtx[i][j]);
scanf("\n");
}
char mem = mtx[0][1], mem2 = mtx[0][0];
... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | 2f76c3c7c218650680c339ee9c0d7b6e | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | #include<stdio.h>
#include<string.h>
int main ()
{
int n,dia,side,i,j;
dia=side=0;
scanf("%d",&n);
char ara[n][n],d,s;
for(i=0; i<n; i++)
scanf("%s",&ara[i]);
d=ara[0][0];
s=ara[0][1];
for(i=0; i<n; i++)
{
for(j=0; j<n; j++)
{
if(i==j || n-1-i==j)
... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | cecb54a448b21dc4b8141cfcd65f5277 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | #include<stdio.h>
#include<stdlib.h>
int main()
{
int n=0,flag=0;
scanf("%d",&n);
char *a[n];
for(int i=0;i<n;i++)
{
a[i]=(char*)malloc((sizeof(char)*n)+1);
scanf("%s",a[i]);
}
char d=a[0][0],r=a[0][1];
if(d==r)
{
printf("NO\n");
exit(0);
}
for... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | f0ada03d063de9d665ade43f09c780e2 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | #include <stdio.h>
int main()
{
FILE *input = fopen("404A.in", "r");
unsigned short side_length;
scanf("%hu", &side_length);
char paper[side_length][side_length + 1];
unsigned short i, j;
for(i = 0; i < side_length; i++)
scanf("%s", paper[i]);
char x = paper[0][0], filler = paper[0][1];
if(x == filler)
... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | 9a4e3b0556333af5bcebc99ad610845d | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | #include<stdio.h>
#include<string.h>
int main()
{
int n,a,b,i,j,count=0;
scanf("%d",&n);
char s[n+5];
for(i=0;i<n;i++)
{
scanf("%s",&s);
if(i==0)
{
a=s[0];
b=s[1];
}
if(a==b)
count=1;
else
{
j=0;
whi... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | c8dc9dfdcdde60be6cb8c7f030c9f27a | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | #include <stdio.h>
int main()
{
int n;
scanf("%d",&n);
char s[300];
int e1=n-1;
char flag1;
char flag2;
int i;
for(i=0;i<n;i++)
{
scanf("%s",s);
if(i==0)
{
flag1=s[1];
flag2=s[0];
if(flag1==flag2)
{
... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | f6854f8e80efca4f61012e17d6c8c30f | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | #include <stdio.h>
int main()
{
int n;
scanf("%d",&n);
char s[300];
int f1=0;
int e1=n-1;
char flag1;
char flag2;
int i;
for(i=0;i<n;i++)
{
scanf("%s",s);
if(i==0)
{
flag1=s[1];
flag2=s[0];
if(flag1==flag2)
... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | e9701ff9a2d6080d9ae03f8c45fa7460 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | #include<stdio.h>
int main(){
int m,k,n,i,s,j,a=0;
char b='1',c,set[1000][1000];
scanf("%d",&n);
getchar();
s=n;
k=s;
for(i=0;i<n;i++){
for(j=0;j<n;j++){
scanf("%c",&set[i][j]);
// printf("%c",set[i][j]);
if(i==0 && j==1)
b=set[i][j];
if(i==0 && j==0)
c=set[i][j];
i... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | cc6fb373ea574a5615d2177170d1a98b | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | #include<stdio.h>
int main()
{
int n,i,j,flag;
scanf("%d",&n);
char arr[n][n];
for(i=0;i<n;i++)
{
scanf("%s",arr[i]);}
if(arr[0][0]==arr[0][1])
{ printf("NO");return 0;}
for(i=0;i<n;i++)
{
if(arr[i][i]!=arr[i][n-i-1])
{printf("NO");... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | bf968242395ae01742851424adbf5c7f | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | #include <stdio.h>
int main(void){
int n;
scanf("%d", &n);
char table[300][300] = {'0'};
for(int i=0; i<n; ++i){
scanf("\n%s", table[i]);
}
char x = table[0][0];
char y = table[0][1];
if(x == y){
printf("NO");
return 0;
}
for(int i=0; i<n; ++i){
f... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | 9ea7546972860bd12c8df1ef0173ba4e | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | #include <stdio.h>
#include <string.h>
int verifier(char *line, int l, char x, char o) {
int n = strlen(line);
for(int i = 0; i < n; i++) {
if((i == l || i == n - 1 - l) && line[i] != x) {
return 0;
}
else if((i != l && i != n - 1 - l) && line[i] != o) {
return 0;
}
}
return 1;
}
int main() {
int n... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | 8875e17c6d4bccdcb3f336f50d792aac | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | #include<stdio.h>
int main()
{
int n,i,j,flag=0,k=0;
char data[302][302];
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
scanf(" %c",&data[i][j]);
}
}
data[0][0]=data[1][1];
data[n+1][n+1]=data[1][2];
for(i=1;i<=n;i++)
{
for(j=... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | ceeffdcb8588e9260c7ede15c1ded8d2 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | #include<stdio.h>
int main()
{
int n,i,j;
char c[300][300];
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%s",c[i]);
for(i=0;i<n;i++)
for(j=0;j<n;j++)
{
if((((i+j)==(n-1)||i==j)&&c[i][j]==c[0][0]||i!=j&&(i+j)!=(n-1)&&c[i][j]==c[0][1])&&c[0][0]!=c[0][1])
{}
else
{
printf("NO");
return 0;
}
... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | 7dac3f963cc01e9d9bf9b46f2083b707 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | #include<stdio.h>
int main(){
int n,f=1;
scanf("%d",&n);
char str[n];
char c,d;
scanf("%s",str);
c=str[0];
d=str[1];
if(c!=d)
f=1;
else f=0;
if(f)
{
for(int i=0;i<n-1;i++)
{
for(int j=0;j<n;j++)
{
if(j==i||j==(n-i-1))
{
if(s... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | 838d9a372a305d86825dce2bf4608da8 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | #include<stdio.h>
char m[310][310],cx,cr;
int n;
int main()
{
scanf("%d",&n);
int i=0,j;for(;i<n;i++)scanf("%s",m[i]);
cx=m[0][0];cr=m[0][1];
if(cx==cr){printf("NO");return 0;}
for(i=0;i<n;i++)for(j=0;j<n;j++)
{
if(i==j||(i+j==n-1))
{
if(cx!=m[i][j]){printf("NO");return 0;}
}
else if(cr!=m[i][j]){print... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | 4813b62f4e71306a8bb0686e24539192 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | #include<stdio.h>
int main(){
int n;
scanf("%d", &n);
char a[n][n];
int i, j;
for(i = 0; i < n; i++)
scanf("%s", a[i]);
char x = a[0][0], y = a[0][1];
if(x == y){
printf("NO\n");
return 0;
}
for(i = 0; i < n; i++){
for(j = 0; j < n; j++){
i... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | 7afd2d74437fef23c050ab63a214859d | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | #include<stdio.h>
int main()
{
int n,i,j;
scanf("%d",&n);
char a[n][n];
for(i=0;i<n;i++)scanf("%s",a[i]);
int flag=0;
if(a[0][0]==a[0][1]){
printf("NO");
return 0;
}
for(i=0;i<n;i++){
for(j=0;j<n;j++){
if(i==j||(i+j)==(n-1)){
if(a[i][j]... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | 28e0fd20578b6cb1a0c89dbdb990e907 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | #include <string.h>
#include <stdio.h>
int main()
{
int n;
scanf("%d",&n);
char ch[n][n];
int i,j,k,l;
for(i=0;i<n;i++)
{
scanf("%s",ch[i]);
}
char q=ch[0][1];
char g=ch[0][0];
k=0,l=0;
int o=0;
for(i=0;i<n;i++)
{
for(... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | 9edb9c67a2dc51f977eb881df0414a20 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
long long int cmpfunc( const void *a, const void *b) {
return *(long long int*)a - *(long long int *)b;
}
int main()
{
long long int test,d,n,x,i,sum=0,count=0,j,flag=0,p,y,max=0,o,g,r,k,sum1=0,m;
char a[400][400];
scanf("%lld",&n);
long long int d1[26]={0},mx[... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | ba65f2a26f3845dbe86527270b0f2901 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | #include <stdio.h>
int main()
{
int n,i,j;
scanf("%d", &n);
int count[26]={0};
char matrix[300][300];
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
scanf(" %c", &matrix[i][j]);
// printf("%d %d", i ,j);
count[matrix[i][j]-'a']++;
}
}
int index=0;
int track[1100000];
for(i=0;i<26;i++)
{ //printf("%d\n",... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | c857b8219aac621278875aff47b1cb0f | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | #include <stdio.h>
int main(){
char a[301][301],ch1,ch2;
int n,i,j,ind=1;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%s\n",a[i]);
ch1 = a[0][0];
ch2 = a[0][1];
if(ch1 == ch2) ind=0;
else{
for(i=0;i<n;i++){
for(j=0;j<n;j++){
if(i==j || i+j==n-1){
if(a[i][j]!=ch1){
ind = 0;
i = n;
break;
... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | 2965f32cf54749af2964d79dda505e6e | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | #include <stdio.h>
int main(void)
{
int n;
scanf("%d ", &n);
char d, nd, inp;
scanf("%c %c ", &d, &nd);
if (d == nd){
printf("NO\n");
return 0;
}
for (int j = 2; j < n; j++){
scanf("%c ", &inp);
if (j == n-1){
if (inp != d){
printf("NO\n");
return 0;
}
}... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | 6334020c35f81b583c15a2c3325e97eb | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | #include<stdio.h>
#include<math.h>
//void fun(long long int a,char ara[][301],long long int i,long long int j)
//{
// long long int k,l,m,n;
// i=0;
// j=0;
// for(k=1;k<=a;k++)
// {
// for(l=1;l<=a;l++)
// {
// if(ara[k][l]==ara[1][1])
// {
// i++;
// }
// else if(ara[k][l]==ara[1][2])
// {
// j++;
... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | 1809d26b280a2488bd1f8ec00191e4f4 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | #include<stdio.h>
int main()
{
int n,a=0,i,j;
scanf("%d",&n);
char s[n][n],lx,lo;
for(i=0;i<n;i++)
scanf("%s",&s[i]);
lx=s[0][0];
lo=s[0][1];
if(lx==lo)
printf("NO");
else
{
for(i=0,j=0;i<n;j++,i++)
{
if(s[i][j]!=lx)
{
a=1;
printf("NO");
break;
}
else if(i!=n/2)
s[i][j]=l... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | 667efad13b21cee855737cd437640cde | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | #include <stdio.h>
int main() {
static char cc[300][301];
int n, i, j;
char x, y;
scanf("%d", &n);
for (i = 0; i < n; i++)
scanf("%s", cc[i]);
x = cc[0][0], y = cc[0][1];
if (x == y)
printf("NO\n");
else {
for (i = 0; i < n; i++)
for (j = 0; j < n; j++) {
int isx = i == j || i == n - 1 - j;
... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | ff101dd1b5b7473286320a67f90bb2f8 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | /* https://codeforces.com/contest/404/submission/20325305 (rainboy) */
#include <stdio.h>
int main() {
static char cc[300][301];
int n, i, j;
char x, y;
scanf("%d", &n);
for (i = 0; i < n; i++)
scanf("%s", cc[i]);
x = cc[0][0], y = cc[0][1];
if (x == y)
printf("NO\n");
else {
for (i = 0; i < n; i++)
... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | 8400ef8e8ce452ad6d7b9c10531b8128 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | #include <stdio.h>
#define N 300
int main() {
static char cc[N][N + 1];
int n, i, j, cnt;
char a, b;
scanf("%d", &n);
for (i = 0; i < n; i++)
scanf("%s", cc[i]);
a = ' ';
for (i = 0; i < n; i++) {
char x, y;
int z;
z = i <= n / 2 ? i : n - 1 - i;
x = cc[i][z];
y = cc[i][n - 1 - z];
if (x != y |... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | aa3b6c0c378572d9c78ea7539c5d1082 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | #include<stdio.h>
#include<string.h>
int main(){
int n;
scanf("%d",&n);
int i,j,k,m=0;
char arr[n][n],d,e;
for(i=0;i<n;i++){
scanf("%s",&arr[i]);
}
j=0;
d=arr[0][1];
e=arr[0][0];
for(i=0;i<n;i++){
if(arr[i][j] != arr[i][n-1-j]){
printf("NO");
return 0;
}
if(arr[i][j] != e){
printf("NO");
... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | bdf3bf8d3e6ed6263b2386de2eebad5e | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
int n,i,j;
scanf("%d",&n);
char a[n][301];
int flag=0;
int count=0;
for(i=0;i<n;i++)
{
scanf("%s",a[i]);
}
char arr[n];
int c=0;
int w;
w=n;
char ch=a[0][0];
for(i=0;i<n;i++)
{
... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | d47968e809a8a2eea6689cdd42f04366 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | #include<stdio.h>
int main()
{
int n,i,j;
char str[305][305];
scanf("%d",&n);
getchar();
for(i=0;i<n;i++)
{for(j=0;j<n;j++)
scanf("%c",&str[i][j]);
getchar();
}
char x=str[0][0], t= str[0][1];
if(x==t) printf("NO\n");
else{
int r=1;
for(i=0,j=0; ... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | f646771174132443d6c7749521185e82 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | //
// Created by user on 2/28/2018.
//
#include<stdio.h>
int main()
{
int n,i,j;
scanf("%d", &n);
char text[n][n+1];
for(i=0;i<n;i++){
scanf("%s", &text[i][0]);
}
char diag_letter = text[0][0];
char other_letter = text[0][1];
int is_x = 1;
if(diag_letter == other_letter)
... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | b1311c41913f1892036926c9de0bafae | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | #include<stdio.h>
#include<stdlib.h>
int main(n)
{scanf("%d",&n);
char s[n+1][n+1],a,b;
int i,j,t;
for(i=0;i<n;i++)
scanf("%s",&s[i][0]);
a=s[0][0];
b=s[0][1];
if(a==b)
{
printf("NO");
exit(0);
}
n=n-1;
for(i=0;i<=n;i++)
{
t=i;
for(j=0;j<=n;j++)
{
if(j==t || j==n-t)
{
if(s[i][j]!=a)
{
printf("NO");
exit(0);
}
}
else... | |
Omkar is building a waterslide in his water park, and he needs your help to ensure that he does it as efficiently as possible.Omkar currently has $$$n$$$ supports arranged in a line, the $$$i$$$-th of which has height $$$a_i$$$. Omkar wants to build his waterslide from the right to the left, so his supports must be non... | For each test case, output a single integer — the minimum number of operations Omkar needs to perform to make his supports able to support his waterslide. | C | 0bd06900e42db9f83cdd43c24da6686e | 8da0b1ca9a118d4918e0b908fdfaa3c3 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"greedy"
] | 1597588500 | ["3\n4\n5 3 2 5\n5\n1 2 3 5 3\n3\n1 1 1"] | NoteThe subarray with which Omkar performs the operation is bolded.In the first test case:First operation:$$$[5, 3, \textbf{2}, 5] \to [5, 3, \textbf{3}, 5]$$$Second operation:$$$[5, \textbf{3}, \textbf{3}, 5] \to [5, \textbf{4}, \textbf{4}, 5]$$$Third operation:$$$[5, \textbf{4}, \textbf{4}, 5] \to [5, \textbf{5}, \te... | PASSED | 1,200 | standard input | 2 seconds | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \leq t \leq 100$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of supports Omkar has. The second line of each t... | ["3\n2\n0"] | #include<stdio.h>
#include<stdlib.h>
int main()
{
long long int t,n,a[200005],s[200005],i,d[200005],ans,val,temp,max;
scanf("%lld",&t);
while(t--)
{
scanf("%lld",&n);
for(i=0;i<n;i++)
{
s[i]=0;
d[i]=0;
scanf("%lld",&a[i]);
}
ma... | |
Omkar is building a waterslide in his water park, and he needs your help to ensure that he does it as efficiently as possible.Omkar currently has $$$n$$$ supports arranged in a line, the $$$i$$$-th of which has height $$$a_i$$$. Omkar wants to build his waterslide from the right to the left, so his supports must be non... | For each test case, output a single integer — the minimum number of operations Omkar needs to perform to make his supports able to support his waterslide. | C | 0bd06900e42db9f83cdd43c24da6686e | 0cb70d1a3446d2a3b09c1e69c3c39d8b | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"greedy"
] | 1597588500 | ["3\n4\n5 3 2 5\n5\n1 2 3 5 3\n3\n1 1 1"] | NoteThe subarray with which Omkar performs the operation is bolded.In the first test case:First operation:$$$[5, 3, \textbf{2}, 5] \to [5, 3, \textbf{3}, 5]$$$Second operation:$$$[5, \textbf{3}, \textbf{3}, 5] \to [5, \textbf{4}, \textbf{4}, 5]$$$Third operation:$$$[5, \textbf{4}, \textbf{4}, 5] \to [5, \textbf{5}, \te... | PASSED | 1,200 | standard input | 2 seconds | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \leq t \leq 100$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of supports Omkar has. The second line of each t... | ["3\n2\n0"] | #include<stdio.h>
int main(){
long long int time,n,i,j,num,count;
scanf("%lld",&time);
for(int k=0;k<time;k++){
scanf("%lld",&n);
long long int a[n];
for(j=0;j<n;j++){
scanf("%lld",&a[j]);
}
i=0;j=1;count=0;
while(j<n){
if(a[i]<=a[j]){
i++;j++;
}else{
count=count+(a[i]-a[j]);
j... | |
Omkar is building a waterslide in his water park, and he needs your help to ensure that he does it as efficiently as possible.Omkar currently has $$$n$$$ supports arranged in a line, the $$$i$$$-th of which has height $$$a_i$$$. Omkar wants to build his waterslide from the right to the left, so his supports must be non... | For each test case, output a single integer — the minimum number of operations Omkar needs to perform to make his supports able to support his waterslide. | C | 0bd06900e42db9f83cdd43c24da6686e | 126a1528b1d9669f9e88a7c753113ce2 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"greedy"
] | 1597588500 | ["3\n4\n5 3 2 5\n5\n1 2 3 5 3\n3\n1 1 1"] | NoteThe subarray with which Omkar performs the operation is bolded.In the first test case:First operation:$$$[5, 3, \textbf{2}, 5] \to [5, 3, \textbf{3}, 5]$$$Second operation:$$$[5, \textbf{3}, \textbf{3}, 5] \to [5, \textbf{4}, \textbf{4}, 5]$$$Third operation:$$$[5, \textbf{4}, \textbf{4}, 5] \to [5, \textbf{5}, \te... | PASSED | 1,200 | standard input | 2 seconds | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \leq t \leq 100$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of supports Omkar has. The second line of each t... | ["3\n2\n0"] | #include<stdio.h>
#include<conio.h>
#include<string.h>
#include<math.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
long long int a,b,n,m,x,y,z,i,j,k=0,l;
scanf("%lld",&n);
long long int A[n];
scanf("%lld",&A[0]);
for(i=1;i<n;i++)
{
scanf(... | |
Omkar is building a waterslide in his water park, and he needs your help to ensure that he does it as efficiently as possible.Omkar currently has $$$n$$$ supports arranged in a line, the $$$i$$$-th of which has height $$$a_i$$$. Omkar wants to build his waterslide from the right to the left, so his supports must be non... | For each test case, output a single integer — the minimum number of operations Omkar needs to perform to make his supports able to support his waterslide. | C | 0bd06900e42db9f83cdd43c24da6686e | c543f5eaa9d3434e8bb64859b56e4538 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"greedy"
] | 1597588500 | ["3\n4\n5 3 2 5\n5\n1 2 3 5 3\n3\n1 1 1"] | NoteThe subarray with which Omkar performs the operation is bolded.In the first test case:First operation:$$$[5, 3, \textbf{2}, 5] \to [5, 3, \textbf{3}, 5]$$$Second operation:$$$[5, \textbf{3}, \textbf{3}, 5] \to [5, \textbf{4}, \textbf{4}, 5]$$$Third operation:$$$[5, \textbf{4}, \textbf{4}, 5] \to [5, \textbf{5}, \te... | PASSED | 1,200 | standard input | 2 seconds | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \leq t \leq 100$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of supports Omkar has. The second line of each t... | ["3\n2\n0"] | #include <stdio.h>
#include <stdlib.h>
#define N 200000
// int cmpfunc (const void * a, const void * b) {
// return ( *(int*)a - *(int*)b );
// }
// qsort(values, 5, sizeof(int), cmpfunc);
int main() {
int t,n,i;
int aa[N+1];
scanf("%d", &t);
while(t--){
scanf("%d", &n);
for (i=0;i<n;i++)
scanf("%d... | |
Omkar is building a waterslide in his water park, and he needs your help to ensure that he does it as efficiently as possible.Omkar currently has $$$n$$$ supports arranged in a line, the $$$i$$$-th of which has height $$$a_i$$$. Omkar wants to build his waterslide from the right to the left, so his supports must be non... | For each test case, output a single integer — the minimum number of operations Omkar needs to perform to make his supports able to support his waterslide. | C | 0bd06900e42db9f83cdd43c24da6686e | e61e99bdf3b7799685875aaf8ff56064 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"greedy"
] | 1597588500 | ["3\n4\n5 3 2 5\n5\n1 2 3 5 3\n3\n1 1 1"] | NoteThe subarray with which Omkar performs the operation is bolded.In the first test case:First operation:$$$[5, 3, \textbf{2}, 5] \to [5, 3, \textbf{3}, 5]$$$Second operation:$$$[5, \textbf{3}, \textbf{3}, 5] \to [5, \textbf{4}, \textbf{4}, 5]$$$Third operation:$$$[5, \textbf{4}, \textbf{4}, 5] \to [5, \textbf{5}, \te... | PASSED | 1,200 | standard input | 2 seconds | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \leq t \leq 100$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of supports Omkar has. The second line of each t... | ["3\n2\n0"] | #include <string.h>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
int main(){
int i;
int n;
int j;
int s;
int a[200000];
int p;
long long int c;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&s);
int b[200000] = { 0 };
for(j=0;j<s;j++){
scanf("%d",&a[j]);
}
p = a[0];
for(j=0... | |
Omkar is building a waterslide in his water park, and he needs your help to ensure that he does it as efficiently as possible.Omkar currently has $$$n$$$ supports arranged in a line, the $$$i$$$-th of which has height $$$a_i$$$. Omkar wants to build his waterslide from the right to the left, so his supports must be non... | For each test case, output a single integer — the minimum number of operations Omkar needs to perform to make his supports able to support his waterslide. | C | 0bd06900e42db9f83cdd43c24da6686e | 32f63cd2210b42b6a91104df83d660e7 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"greedy"
] | 1597588500 | ["3\n4\n5 3 2 5\n5\n1 2 3 5 3\n3\n1 1 1"] | NoteThe subarray with which Omkar performs the operation is bolded.In the first test case:First operation:$$$[5, 3, \textbf{2}, 5] \to [5, 3, \textbf{3}, 5]$$$Second operation:$$$[5, \textbf{3}, \textbf{3}, 5] \to [5, \textbf{4}, \textbf{4}, 5]$$$Third operation:$$$[5, \textbf{4}, \textbf{4}, 5] \to [5, \textbf{5}, \te... | PASSED | 1,200 | standard input | 2 seconds | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \leq t \leq 100$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of supports Omkar has. The second line of each t... | ["3\n2\n0"] | #include<stdio.h>
int main()
{
long long int T,X,N,x,y,s,i,j,m,n;
scanf("%lld", &N);
for(i=1; i<=N; i++)
{
scanf("%lld", &T);
long long int A[T],B[T],C[T];
for(j=0; j<T; j++)
{
scanf("%lld", &A[j]);
}
x=0;
y=0;
s=0;
... | |
Omkar is building a waterslide in his water park, and he needs your help to ensure that he does it as efficiently as possible.Omkar currently has $$$n$$$ supports arranged in a line, the $$$i$$$-th of which has height $$$a_i$$$. Omkar wants to build his waterslide from the right to the left, so his supports must be non... | For each test case, output a single integer — the minimum number of operations Omkar needs to perform to make his supports able to support his waterslide. | C | 0bd06900e42db9f83cdd43c24da6686e | 919da8712901d5a6cb15eb258587acbb | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"greedy"
] | 1597588500 | ["3\n4\n5 3 2 5\n5\n1 2 3 5 3\n3\n1 1 1"] | NoteThe subarray with which Omkar performs the operation is bolded.In the first test case:First operation:$$$[5, 3, \textbf{2}, 5] \to [5, 3, \textbf{3}, 5]$$$Second operation:$$$[5, \textbf{3}, \textbf{3}, 5] \to [5, \textbf{4}, \textbf{4}, 5]$$$Third operation:$$$[5, \textbf{4}, \textbf{4}, 5] \to [5, \textbf{5}, \te... | PASSED | 1,200 | standard input | 2 seconds | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \leq t \leq 100$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of supports Omkar has. The second line of each t... | ["3\n2\n0"] | #include<stdio.h>
int main()
{
long long int T,X,N,x,y,s,i,j,m,n;
scanf("%lld", &N);
for(i=1; i<=N; i++)
{
scanf("%lld", &T);
long long int A[T],B[T],C[T];
for(j=0; j<T; j++)
{
scanf("%lld", &A[j]);
}
x=0;
y=0;
s=0;
... | |
Omkar is building a waterslide in his water park, and he needs your help to ensure that he does it as efficiently as possible.Omkar currently has $$$n$$$ supports arranged in a line, the $$$i$$$-th of which has height $$$a_i$$$. Omkar wants to build his waterslide from the right to the left, so his supports must be non... | For each test case, output a single integer — the minimum number of operations Omkar needs to perform to make his supports able to support his waterslide. | C | 0bd06900e42db9f83cdd43c24da6686e | 5460fd58617d7ff71602d191d95668e6 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"greedy"
] | 1597588500 | ["3\n4\n5 3 2 5\n5\n1 2 3 5 3\n3\n1 1 1"] | NoteThe subarray with which Omkar performs the operation is bolded.In the first test case:First operation:$$$[5, 3, \textbf{2}, 5] \to [5, 3, \textbf{3}, 5]$$$Second operation:$$$[5, \textbf{3}, \textbf{3}, 5] \to [5, \textbf{4}, \textbf{4}, 5]$$$Third operation:$$$[5, \textbf{4}, \textbf{4}, 5] \to [5, \textbf{5}, \te... | PASSED | 1,200 | standard input | 2 seconds | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \leq t \leq 100$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of supports Omkar has. The second line of each t... | ["3\n2\n0"] |
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
int main(int argc, char * argv[]) {
int t, n;
fscanf(stdin, "%d", &t);
while (t--) {
fscanf(stdin, "%d", &n);
uint64_t tot = 0;
int prev = 0;
for (int i = 0; i < n; i++) {
int num;
... | |
Omkar is building a waterslide in his water park, and he needs your help to ensure that he does it as efficiently as possible.Omkar currently has $$$n$$$ supports arranged in a line, the $$$i$$$-th of which has height $$$a_i$$$. Omkar wants to build his waterslide from the right to the left, so his supports must be non... | For each test case, output a single integer — the minimum number of operations Omkar needs to perform to make his supports able to support his waterslide. | C | 0bd06900e42db9f83cdd43c24da6686e | a1b8c27bf8c3a5e0c495257bb27ae2b0 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"greedy"
] | 1597588500 | ["3\n4\n5 3 2 5\n5\n1 2 3 5 3\n3\n1 1 1"] | NoteThe subarray with which Omkar performs the operation is bolded.In the first test case:First operation:$$$[5, 3, \textbf{2}, 5] \to [5, 3, \textbf{3}, 5]$$$Second operation:$$$[5, \textbf{3}, \textbf{3}, 5] \to [5, \textbf{4}, \textbf{4}, 5]$$$Third operation:$$$[5, \textbf{4}, \textbf{4}, 5] \to [5, \textbf{5}, \te... | PASSED | 1,200 | standard input | 2 seconds | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \leq t \leq 100$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of supports Omkar has. The second line of each t... | ["3\n2\n0"] |
#include <stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
int main()
{
int t;
scanf("%d",&t);
while(t--){
int n;
scanf("%d",&n);
int a[n];
long long c=0;
for(int i=0;i<n;i++){
scanf("%d",&a[i]);
}
for(int i=n-1;i>0;i--){
... | |
Omkar is building a waterslide in his water park, and he needs your help to ensure that he does it as efficiently as possible.Omkar currently has $$$n$$$ supports arranged in a line, the $$$i$$$-th of which has height $$$a_i$$$. Omkar wants to build his waterslide from the right to the left, so his supports must be non... | For each test case, output a single integer — the minimum number of operations Omkar needs to perform to make his supports able to support his waterslide. | C | 0bd06900e42db9f83cdd43c24da6686e | 21697e313280d59ad50dbf5fcf635af7 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"greedy"
] | 1597588500 | ["3\n4\n5 3 2 5\n5\n1 2 3 5 3\n3\n1 1 1"] | NoteThe subarray with which Omkar performs the operation is bolded.In the first test case:First operation:$$$[5, 3, \textbf{2}, 5] \to [5, 3, \textbf{3}, 5]$$$Second operation:$$$[5, \textbf{3}, \textbf{3}, 5] \to [5, \textbf{4}, \textbf{4}, 5]$$$Third operation:$$$[5, \textbf{4}, \textbf{4}, 5] \to [5, \textbf{5}, \te... | PASSED | 1,200 | standard input | 2 seconds | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \leq t \leq 100$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of supports Omkar has. The second line of each t... | ["3\n2\n0"] | #include<stdio.h>
int main()
{
int t, n, i;
scanf("%d", &t);
while(t--)
{
scanf("%d", &n);
int a[n+1];
long long int s=0;
for(i=0; i<n; i++)
{
scanf("%d", &a[i]);
}
for(i=n-1; i>0; i--)
{
if(a[i]<a[i-1])
{
s+=a[i-1]-a[i];
}
}
printf("%lld\n", s);
}
return 0;
} | |
Omkar is building a waterslide in his water park, and he needs your help to ensure that he does it as efficiently as possible.Omkar currently has $$$n$$$ supports arranged in a line, the $$$i$$$-th of which has height $$$a_i$$$. Omkar wants to build his waterslide from the right to the left, so his supports must be non... | For each test case, output a single integer — the minimum number of operations Omkar needs to perform to make his supports able to support his waterslide. | C | 0bd06900e42db9f83cdd43c24da6686e | 41ae620af79457b7524eb2b54bdbfdfd | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"greedy"
] | 1597588500 | ["3\n4\n5 3 2 5\n5\n1 2 3 5 3\n3\n1 1 1"] | NoteThe subarray with which Omkar performs the operation is bolded.In the first test case:First operation:$$$[5, 3, \textbf{2}, 5] \to [5, 3, \textbf{3}, 5]$$$Second operation:$$$[5, \textbf{3}, \textbf{3}, 5] \to [5, \textbf{4}, \textbf{4}, 5]$$$Third operation:$$$[5, \textbf{4}, \textbf{4}, 5] \to [5, \textbf{5}, \te... | PASSED | 1,200 | standard input | 2 seconds | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \leq t \leq 100$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of supports Omkar has. The second line of each t... | ["3\n2\n0"] | #include<stdio.h>
int main()
{
// freopen("/home/shadhin/Desktop/code/IO/input.txt", "r", stdin);
// freopen("/home/shadhin/Desktop/code/IO/output.txt", "w", stdout);
int n, i, t;
long long int res;
scanf("%d", &t);
while(t--)
{
scanf("%d", &n);
int a[n];
for(i=0;i<n;i++)
scanf("%d", &a[i]);
res=0... | |
Omkar is building a waterslide in his water park, and he needs your help to ensure that he does it as efficiently as possible.Omkar currently has $$$n$$$ supports arranged in a line, the $$$i$$$-th of which has height $$$a_i$$$. Omkar wants to build his waterslide from the right to the left, so his supports must be non... | For each test case, output a single integer — the minimum number of operations Omkar needs to perform to make his supports able to support his waterslide. | C | 0bd06900e42db9f83cdd43c24da6686e | 2e50944bc7409d2cfcbd668f659b80e8 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"greedy"
] | 1597588500 | ["3\n4\n5 3 2 5\n5\n1 2 3 5 3\n3\n1 1 1"] | NoteThe subarray with which Omkar performs the operation is bolded.In the first test case:First operation:$$$[5, 3, \textbf{2}, 5] \to [5, 3, \textbf{3}, 5]$$$Second operation:$$$[5, \textbf{3}, \textbf{3}, 5] \to [5, \textbf{4}, \textbf{4}, 5]$$$Third operation:$$$[5, \textbf{4}, \textbf{4}, 5] \to [5, \textbf{5}, \te... | PASSED | 1,200 | standard input | 2 seconds | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \leq t \leq 100$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of supports Omkar has. The second line of each t... | ["3\n2\n0"] | #include<stdio.h>
int main()
{
long long int i,j,m,n,t;
scanf("%lld",&t);
while(t--){
scanf("%lld", &n);
long long int a[n],ans=0;
for(i=0;i<n;i++)scanf("%lld", &a[i]);
for(i=0;i<n-1;i++){
if(a[i]>a[i+1])ans+=a[i]-a[i+1];
}
printf("%lld\n", ans);
}
return 0;
} | |
Omkar is building a waterslide in his water park, and he needs your help to ensure that he does it as efficiently as possible.Omkar currently has $$$n$$$ supports arranged in a line, the $$$i$$$-th of which has height $$$a_i$$$. Omkar wants to build his waterslide from the right to the left, so his supports must be non... | For each test case, output a single integer — the minimum number of operations Omkar needs to perform to make his supports able to support his waterslide. | C | 0bd06900e42db9f83cdd43c24da6686e | e7bad72b184e3c3cdba456db13c0561e | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"greedy"
] | 1597588500 | ["3\n4\n5 3 2 5\n5\n1 2 3 5 3\n3\n1 1 1"] | NoteThe subarray with which Omkar performs the operation is bolded.In the first test case:First operation:$$$[5, 3, \textbf{2}, 5] \to [5, 3, \textbf{3}, 5]$$$Second operation:$$$[5, \textbf{3}, \textbf{3}, 5] \to [5, \textbf{4}, \textbf{4}, 5]$$$Third operation:$$$[5, \textbf{4}, \textbf{4}, 5] \to [5, \textbf{5}, \te... | PASSED | 1,200 | standard input | 2 seconds | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \leq t \leq 100$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of supports Omkar has. The second line of each t... | ["3\n2\n0"] | #include<stdio.h>
int main()
{
long long int i,k ,j ,sum,n,t;
scanf("%lld",&t);
for(i=0;i<t;i++)
{ sum=0;
scanf("%lld",&n);
long long int ara[n];
for(j=0;j<n;j++)
{
scanf("%lld",&ara[j]);
}
for(j=1;j<n;j++)
{
if(ara[j]<ara... | |
Omkar is building a waterslide in his water park, and he needs your help to ensure that he does it as efficiently as possible.Omkar currently has $$$n$$$ supports arranged in a line, the $$$i$$$-th of which has height $$$a_i$$$. Omkar wants to build his waterslide from the right to the left, so his supports must be non... | For each test case, output a single integer — the minimum number of operations Omkar needs to perform to make his supports able to support his waterslide. | C | 0bd06900e42db9f83cdd43c24da6686e | deb033c7fe6d19356a001b3a66f9e3de | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"greedy"
] | 1597588500 | ["3\n4\n5 3 2 5\n5\n1 2 3 5 3\n3\n1 1 1"] | NoteThe subarray with which Omkar performs the operation is bolded.In the first test case:First operation:$$$[5, 3, \textbf{2}, 5] \to [5, 3, \textbf{3}, 5]$$$Second operation:$$$[5, \textbf{3}, \textbf{3}, 5] \to [5, \textbf{4}, \textbf{4}, 5]$$$Third operation:$$$[5, \textbf{4}, \textbf{4}, 5] \to [5, \textbf{5}, \te... | PASSED | 1,200 | standard input | 2 seconds | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \leq t \leq 100$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of supports Omkar has. The second line of each t... | ["3\n2\n0"] | #include <stdio.h>
long long max(long long a,long long b){
if(a>b)return a;
return b;
}
int main(int argc, char *argv[])
{
int tc;
scanf("%d",&tc);
while(tc--){
long long n,i,ans=0;
scanf("%lld",&n);
long long a[n];
for(i=0;i<n;i++)
scanf("%lld",&a[i]);
for(i=0;i<n-1;i++)
ans+=max(a[i]-a[i+1],0);
... | |
Omkar is building a waterslide in his water park, and he needs your help to ensure that he does it as efficiently as possible.Omkar currently has $$$n$$$ supports arranged in a line, the $$$i$$$-th of which has height $$$a_i$$$. Omkar wants to build his waterslide from the right to the left, so his supports must be non... | For each test case, output a single integer — the minimum number of operations Omkar needs to perform to make his supports able to support his waterslide. | C | 0bd06900e42db9f83cdd43c24da6686e | 0dbf82880c176586e94c8387c0e4feb5 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"greedy"
] | 1597588500 | ["3\n4\n5 3 2 5\n5\n1 2 3 5 3\n3\n1 1 1"] | NoteThe subarray with which Omkar performs the operation is bolded.In the first test case:First operation:$$$[5, 3, \textbf{2}, 5] \to [5, 3, \textbf{3}, 5]$$$Second operation:$$$[5, \textbf{3}, \textbf{3}, 5] \to [5, \textbf{4}, \textbf{4}, 5]$$$Third operation:$$$[5, \textbf{4}, \textbf{4}, 5] \to [5, \textbf{5}, \te... | PASSED | 1,200 | standard input | 2 seconds | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \leq t \leq 100$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of supports Omkar has. The second line of each t... | ["3\n2\n0"] | #include<stdio.h>
int main(){
int t,k,i;
scanf("%d",&t);
while(t--){
long long int sum=0;
scanf("%d",&k);
int a[k];
for(i=0;i<k;i++){
scanf("%lld",&a[i]);
}
for(i=1;i<k;i++){
if(a[i]<a[i-1])sum+=a[i-1]-a[i];
}
printf("%lld\n",sum);
}
} | |
Omkar is building a waterslide in his water park, and he needs your help to ensure that he does it as efficiently as possible.Omkar currently has $$$n$$$ supports arranged in a line, the $$$i$$$-th of which has height $$$a_i$$$. Omkar wants to build his waterslide from the right to the left, so his supports must be non... | For each test case, output a single integer — the minimum number of operations Omkar needs to perform to make his supports able to support his waterslide. | C | 0bd06900e42db9f83cdd43c24da6686e | fde743c5eeccdceffcc9b49838e6bf19 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"greedy"
] | 1597588500 | ["3\n4\n5 3 2 5\n5\n1 2 3 5 3\n3\n1 1 1"] | NoteThe subarray with which Omkar performs the operation is bolded.In the first test case:First operation:$$$[5, 3, \textbf{2}, 5] \to [5, 3, \textbf{3}, 5]$$$Second operation:$$$[5, \textbf{3}, \textbf{3}, 5] \to [5, \textbf{4}, \textbf{4}, 5]$$$Third operation:$$$[5, \textbf{4}, \textbf{4}, 5] \to [5, \textbf{5}, \te... | PASSED | 1,200 | standard input | 2 seconds | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \leq t \leq 100$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of supports Omkar has. The second line of each t... | ["3\n2\n0"] | #include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
long long int i,n;
scanf("%lld",&n);
long long int a[n],c=0,min;
for(i=0;i<n;i++)
{
scanf("%lld",&a[i]);
}
for(i=0;i<n-1;i++)
{
if(a[i]>a[i+1])
... | |
Omkar is building a waterslide in his water park, and he needs your help to ensure that he does it as efficiently as possible.Omkar currently has $$$n$$$ supports arranged in a line, the $$$i$$$-th of which has height $$$a_i$$$. Omkar wants to build his waterslide from the right to the left, so his supports must be non... | For each test case, output a single integer — the minimum number of operations Omkar needs to perform to make his supports able to support his waterslide. | C | 0bd06900e42db9f83cdd43c24da6686e | 762b34c3e4bf1f543019466f97d78847 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"greedy"
] | 1597588500 | ["3\n4\n5 3 2 5\n5\n1 2 3 5 3\n3\n1 1 1"] | NoteThe subarray with which Omkar performs the operation is bolded.In the first test case:First operation:$$$[5, 3, \textbf{2}, 5] \to [5, 3, \textbf{3}, 5]$$$Second operation:$$$[5, \textbf{3}, \textbf{3}, 5] \to [5, \textbf{4}, \textbf{4}, 5]$$$Third operation:$$$[5, \textbf{4}, \textbf{4}, 5] \to [5, \textbf{5}, \te... | PASSED | 1,200 | standard input | 2 seconds | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \leq t \leq 100$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of supports Omkar has. The second line of each t... | ["3\n2\n0"] | #include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t)
{
int n;
long long d=0;
long long sum=0;
scanf("%d",&n);
long long a[n];
for(long long i=0;i<n;i++)
{
scanf("%lld ",&a[i]);
}
for(int i=n-1;i>0;i-... | |
Omkar is building a waterslide in his water park, and he needs your help to ensure that he does it as efficiently as possible.Omkar currently has $$$n$$$ supports arranged in a line, the $$$i$$$-th of which has height $$$a_i$$$. Omkar wants to build his waterslide from the right to the left, so his supports must be non... | For each test case, output a single integer — the minimum number of operations Omkar needs to perform to make his supports able to support his waterslide. | C | 0bd06900e42db9f83cdd43c24da6686e | 33c715461e39d6ef68ef188b5110ca91 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"greedy"
] | 1597588500 | ["3\n4\n5 3 2 5\n5\n1 2 3 5 3\n3\n1 1 1"] | NoteThe subarray with which Omkar performs the operation is bolded.In the first test case:First operation:$$$[5, 3, \textbf{2}, 5] \to [5, 3, \textbf{3}, 5]$$$Second operation:$$$[5, \textbf{3}, \textbf{3}, 5] \to [5, \textbf{4}, \textbf{4}, 5]$$$Third operation:$$$[5, \textbf{4}, \textbf{4}, 5] \to [5, \textbf{5}, \te... | PASSED | 1,200 | standard input | 2 seconds | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \leq t \leq 100$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of supports Omkar has. The second line of each t... | ["3\n2\n0"] | #include<stdio.h>
int main(){long long int t,i,j,n,k,a[200000],c,max,sum;
scanf("%lld",&t);
for(i=0;i<t;i++)
{
scanf("%lld",&n);
for(j=0;j<n;j++)
{
scanf("%lld",&a[j]);
}
sum=0;
for(j=1;j<n;j++)
{
if(a[j]<a[j-1])
{
... | |
Omkar is building a waterslide in his water park, and he needs your help to ensure that he does it as efficiently as possible.Omkar currently has $$$n$$$ supports arranged in a line, the $$$i$$$-th of which has height $$$a_i$$$. Omkar wants to build his waterslide from the right to the left, so his supports must be non... | For each test case, output a single integer — the minimum number of operations Omkar needs to perform to make his supports able to support his waterslide. | C | 0bd06900e42db9f83cdd43c24da6686e | 186a946d7e9d28d3809ae908e0421e52 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"greedy"
] | 1597588500 | ["3\n4\n5 3 2 5\n5\n1 2 3 5 3\n3\n1 1 1"] | NoteThe subarray with which Omkar performs the operation is bolded.In the first test case:First operation:$$$[5, 3, \textbf{2}, 5] \to [5, 3, \textbf{3}, 5]$$$Second operation:$$$[5, \textbf{3}, \textbf{3}, 5] \to [5, \textbf{4}, \textbf{4}, 5]$$$Third operation:$$$[5, \textbf{4}, \textbf{4}, 5] \to [5, \textbf{5}, \te... | PASSED | 1,200 | standard input | 2 seconds | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \leq t \leq 100$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of supports Omkar has. The second line of each t... | ["3\n2\n0"] | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define ll int long long
ll mxx(ll x,ll y){return (x>=y)?x:y;}
ll mnn(int x,int y){return (x>=y)?y:x;}
int cmpfunc (const void * a, const void * b) {
return ( *(int*)a - *(int*)b );
}
const int nax = 2*1e5+10;
int pro(){
ll n;
scanf("%lld",&n);
l... | |
Omkar is building a waterslide in his water park, and he needs your help to ensure that he does it as efficiently as possible.Omkar currently has $$$n$$$ supports arranged in a line, the $$$i$$$-th of which has height $$$a_i$$$. Omkar wants to build his waterslide from the right to the left, so his supports must be non... | For each test case, output a single integer — the minimum number of operations Omkar needs to perform to make his supports able to support his waterslide. | C | 0bd06900e42db9f83cdd43c24da6686e | f5657c0e747a04c5b8cd33b8788a0d9f | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"greedy"
] | 1597588500 | ["3\n4\n5 3 2 5\n5\n1 2 3 5 3\n3\n1 1 1"] | NoteThe subarray with which Omkar performs the operation is bolded.In the first test case:First operation:$$$[5, 3, \textbf{2}, 5] \to [5, 3, \textbf{3}, 5]$$$Second operation:$$$[5, \textbf{3}, \textbf{3}, 5] \to [5, \textbf{4}, \textbf{4}, 5]$$$Third operation:$$$[5, \textbf{4}, \textbf{4}, 5] \to [5, \textbf{5}, \te... | PASSED | 1,200 | standard input | 2 seconds | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \leq t \leq 100$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of supports Omkar has. The second line of each t... | ["3\n2\n0"] | #include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int i,n;
long long sum=0;
scanf("%d",&n);
int a[n];
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=n-1;i>0;i--)
{
if(a[i-1]>a[i])
sum+=a[i-1]-a[i];
}
printf("%lld\n",sum);
}
return 0;
}
| |
Omkar is building a waterslide in his water park, and he needs your help to ensure that he does it as efficiently as possible.Omkar currently has $$$n$$$ supports arranged in a line, the $$$i$$$-th of which has height $$$a_i$$$. Omkar wants to build his waterslide from the right to the left, so his supports must be non... | For each test case, output a single integer — the minimum number of operations Omkar needs to perform to make his supports able to support his waterslide. | C | 0bd06900e42db9f83cdd43c24da6686e | a0db38a4da50e4c85c94e79b99592cf2 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"greedy"
] | 1597588500 | ["3\n4\n5 3 2 5\n5\n1 2 3 5 3\n3\n1 1 1"] | NoteThe subarray with which Omkar performs the operation is bolded.In the first test case:First operation:$$$[5, 3, \textbf{2}, 5] \to [5, 3, \textbf{3}, 5]$$$Second operation:$$$[5, \textbf{3}, \textbf{3}, 5] \to [5, \textbf{4}, \textbf{4}, 5]$$$Third operation:$$$[5, \textbf{4}, \textbf{4}, 5] \to [5, \textbf{5}, \te... | PASSED | 1,200 | standard input | 2 seconds | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \leq t \leq 100$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of supports Omkar has. The second line of each t... | ["3\n2\n0"] | #include<stdio.h>
main()
{
int t; scanf("%d",&t);
while(t--)
{
long long int n,sum=0,a,b,z; scanf("%lld",&n);
for( z=0 ; z<n ; z++)
{
if(z==0) {scanf("%lld",&a); z++;}
scanf("%lld",&b);
if((a-b)>0) sum+=a-b; a=b;
}
printf("%lld\n"... | |
ZS the Coder has drawn an undirected graph of n vertices numbered from 0 to n - 1 and m edges between them. Each edge of the graph is weighted, each weight is a positive integer.The next day, ZS the Coder realized that some of the weights were erased! So he wants to reassign positive integer weight to each of the edges... | Print "NO" (without quotes) in the only line if it's not possible to assign the weights in a required way. Otherwise, print "YES" in the first line. Next m lines should contain the edges of the resulting graph, with weights assigned to edges which weights were erased. i-th of them should contain three integers ui, vi a... | C | 732c6417f1daba8f2273a13e97a08534 | b16ee710215b262878b9529259ca5850 | GNU C | standard output | 256 megabytes | train_003.jsonl | [
"shortest paths",
"graphs"
] | 1474119900 | ["5 5 13 0 4\n0 1 5\n2 1 2\n3 2 3\n1 4 0\n4 3 4", "2 1 123456789 0 1\n0 1 0", "2 1 999999999 1 0\n0 1 1000000000"] | NoteHere's how the graph in the first sample case looks like : In the first sample case, there is only one missing edge weight. Placing the weight of 8 gives a shortest path from 0 to 4 of length 13.In the second sample case, there is only a single edge. Clearly, the only way is to replace the missing weight with 1234... | PASSED | 2,300 | standard input | 4 seconds | The first line contains five integers n, m, L, s, t (2 ≤ n ≤ 1000, 1 ≤ m ≤ 10 000, 1 ≤ L ≤ 109, 0 ≤ s, t ≤ n - 1, s ≠ t) — the number of vertices, number of edges, the desired length of shortest path, starting vertex and ending vertex respectively. Then, m lines describing the edges of the graph follow. i-th of the... | ["YES\n0 1 5\n2 1 2\n3 2 3\n1 4 8\n4 3 4", "YES\n0 1 123456789", "NO"] | #include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#define N 1000
#define M 10000
#define INF ((long long) 1e18)
struct E {
int i, j, erased;
long long w;
} *ee[M];
struct E *new_E(int i, int j, long long w) {
struct E *e = malloc(sizeof *e);
e->i = i, e->j = j, e->w = w == 0 ? 1 : w, e->erased = w == 0... | |
Alice and Bob play a game. Initially they have a string $$$s_1, s_2, \dots, s_n$$$, consisting of only characters . and X. They take alternating turns, and Alice is moving first. During each turn, the player has to select a contiguous substring consisting only of characters . and replaces each of them with X. Alice mus... | For each test case print YES if Alice can win and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer). | C | 6639e9a289fa76e3aae6f309ab26c049 | ff17aba290a65800c841b636d02344a9 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"games"
] | 1568903700 | ["3\n3 2\nXX......XX...X\n4 2\nX...X.X..X\n5 3\n.......X..X"] | NoteIn the first query Alice can select substring $$$s_3 \dots s_5$$$. After that $$$s$$$ turns into XXXXX...XX...X. After that, no matter what move Bob makes, Alice can make the move (this will be her second move), but Bob can't make his second move.In the second query Alice can not win because she cannot even make on... | PASSED | 2,500 | standard input | 3 seconds | The first line contains one integer $$$q$$$ ($$$1 \le q \le 3 \cdot 10^5$$$) — the number of queries. The first line of each query contains two integers $$$a$$$ and $$$b$$$ ($$$1 \le b < a \le 3 \cdot 10^5$$$). The second line of each query contains the string $$$s$$$ ($$$1 \le |s| \le 3 \cdot 10^5$$$), consisting o... | ["YES\nNO\nYES"] | /* practice with Dukkha */
#include <stdio.h>
#include <string.h>
#define N 300000
int main() {
int q;
scanf("%d", &q);
while (q--) {
static char cc[N + 1];
int n, a, b, i, k1, k2, k3, l, l2, yes;
scanf("%d%d%s", &a, &b, cc), n = strlen(cc);
l2 = -1;
k1 = k2 = k3 = 0;
for (i = 0, l = 0; i <= n; i++)
... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | 05c6d2e2f3009afa22eb7696152905ac | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | #include<stdio.h>
int main()
{
int n,i,j,k,b[26]={0},m=0,p=0;
scanf("%d",&n);
char a[n+1][n+1];
for(i=0;i<n;i++)
scanf("%s",a[i]);
for(i=0;i<n;i++)
for(j=0;j<n;j++){
b[a[i][j]-'a']++;
}
for(i=0;i<26;i++)
if(b[i]!=0)
m++;
if(m!=2)
... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | d60a1966b2b94373fee7156f7b9c8262 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
char a[301][301];
int main(){
int n, i, j;
char c,d;
scanf("%d", &n);
for(i = 0 ;i < n ; i ++ ){
for(j =0 ; j < n ; j++ ){
while ( scanf("%c", &a[i][j]) && !isalpha(a[i][j]));
if ( i == 0 && j == 0... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | d2c9a22fafab10aba4db22daf9240073 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | ///IMTMTO...
#include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
char s[n][n+1];
int i;
for(i=0;i<n;i++){
scanf("%s",s[i]);
}
char c=s[0][0],d=s[0][1];
for(i=0;i<n;i++){
for(int j=0;j<n;j++){
if(i==j && s[i][j]!=c){
... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | 97c43e86f903db5c3960adcb6e1be69c | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | #include<stdio.h>
#include<stdlib.h>
int main()
{
int n,i,j,flag=1;
scanf("%d",&n);
char a[n][n],c;
for(i=0;i<n;i++)
{
c = getchar();
for(j=0;j<n;j++)
{
c = getchar();
a[i][j] = c;
}
}
for(i=0;i<n;i++)
{
if((a[0][0] != a[i][i])||(a[0][0] != a[i][n-i-1]))
{
flag = 0;
break;
}
}
if(f... | |
Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the... | Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes. | C | 02a9081aed29ea92aae13950a6d48325 | 32e03b137c241c9fc8e9cf1007ca5813 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1395243000 | ["5\nxooox\noxoxo\nsoxoo\noxoxo\nxooox", "3\nwsw\nsws\nwsw", "3\nxpx\npxp\nxpe"] | null | PASSED | 1,000 | standard input | 1 second | The first line contains integer n (3 ≤ n < 300; n is odd). Each of the next n lines contains n small English letters — the description of Valera's paper. | ["NO", "YES", "NO"] | #include<stdio.h>
int main()
{
int n,q=0,r=0;
char c,d;
scanf("%d",&n);
char a[300][300];
for(int i=0;i<n;i++)
{
scanf("%s",&a[i][0]);
}
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
if(q==0)
{
c=a[0][0];
... | |
The Little Elephant has got a problem — somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.The Little Elephant doesn't want to call the police until he understands if he could have accidentally changed the array himself. He thinks that he could ha... | In a single line print "YES" (without the quotes) if the Little Elephant could have accidentally changed the array himself, and "NO" (without the quotes) otherwise. | C | 541fde3a3c40926cbd1edb6017b83e52 | 1963268d5be7c6ec426f4e59d4fa1868 | GNU C | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"sortings"
] | 1346427000 | ["2\n1 2", "3\n3 2 1", "4\n4 3 2 1"] | NoteIn the first sample the array has already been sorted, so to sort it, we need 0 swap operations, that is not more than 1. Thus, the answer is "YES".In the second sample we can sort the array if we swap elements 1 and 3, so we need 1 swap operation to sort the array. Thus, the answer is "YES".In the third sample we ... | PASSED | 1,300 | standard input | 2 seconds | The first line contains a single integer n (2 ≤ n ≤ 105) — the size of array a. The next line contains n positive integers, separated by single spaces and not exceeding 109, — array a. Note that the elements of the array are not necessarily distinct numbers. | ["YES", "YES", "NO"] | #include <stdio.h>
#include <stdlib.h>
int intercambio(int *, int);
int main()
{
int n,i, cambios;
scanf("%d",&n);
int arreglo[n];
for(i=0; i<n; i++){
scanf("%d",&arreglo[i]);
}
printf("\n");
cambios=intercambio(arreglo,n);
if(cambios>0){
printf("YES");
}else{
... | |
The Little Elephant has got a problem — somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.The Little Elephant doesn't want to call the police until he understands if he could have accidentally changed the array himself. He thinks that he could ha... | In a single line print "YES" (without the quotes) if the Little Elephant could have accidentally changed the array himself, and "NO" (without the quotes) otherwise. | C | 541fde3a3c40926cbd1edb6017b83e52 | fc0bdd56ed61a0a1c54d102de204b734 | GNU C | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"sortings"
] | 1346427000 | ["2\n1 2", "3\n3 2 1", "4\n4 3 2 1"] | NoteIn the first sample the array has already been sorted, so to sort it, we need 0 swap operations, that is not more than 1. Thus, the answer is "YES".In the second sample we can sort the array if we swap elements 1 and 3, so we need 1 swap operation to sort the array. Thus, the answer is "YES".In the third sample we ... | PASSED | 1,300 | standard input | 2 seconds | The first line contains a single integer n (2 ≤ n ≤ 105) — the size of array a. The next line contains n positive integers, separated by single spaces and not exceeding 109, — array a. Note that the elements of the array are not necessarily distinct numbers. | ["YES", "YES", "NO"] | #include<stdio.h>
#include<stdlib.h>
int func(const void *a , const void *b);
int main()
{
int a[100000];
int b[100000];
int n,i,j,aux,c;
scanf("%d",&n);
c=0;
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
b[i]=a[i];
}
if (n<=2){
printf("YES");
}else{
... | |
The Little Elephant has got a problem — somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.The Little Elephant doesn't want to call the police until he understands if he could have accidentally changed the array himself. He thinks that he could ha... | In a single line print "YES" (without the quotes) if the Little Elephant could have accidentally changed the array himself, and "NO" (without the quotes) otherwise. | C | 541fde3a3c40926cbd1edb6017b83e52 | fa0fe558c17a838e81291d2b2b736b58 | GNU C | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"sortings"
] | 1346427000 | ["2\n1 2", "3\n3 2 1", "4\n4 3 2 1"] | NoteIn the first sample the array has already been sorted, so to sort it, we need 0 swap operations, that is not more than 1. Thus, the answer is "YES".In the second sample we can sort the array if we swap elements 1 and 3, so we need 1 swap operation to sort the array. Thus, the answer is "YES".In the third sample we ... | PASSED | 1,300 | standard input | 2 seconds | The first line contains a single integer n (2 ≤ n ≤ 105) — the size of array a. The next line contains n positive integers, separated by single spaces and not exceeding 109, — array a. Note that the elements of the array are not necessarily distinct numbers. | ["YES", "YES", "NO"] | #include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
int recorrer_atras(int *array, int size);
int recorrer_adelante(int *array, int size);
void intercambiar(int *array, int pos1, int pos2);
int esta_ordenado(int *array, int size);
int sin_repetidos(int *array, int size, int *nuevo_array);
int funcion_repetidos_... | |
The Little Elephant has got a problem — somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.The Little Elephant doesn't want to call the police until he understands if he could have accidentally changed the array himself. He thinks that he could ha... | In a single line print "YES" (without the quotes) if the Little Elephant could have accidentally changed the array himself, and "NO" (without the quotes) otherwise. | C | 541fde3a3c40926cbd1edb6017b83e52 | 2b8cb6e59cc687e0b23e4070607a0c28 | GNU C | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"sortings"
] | 1346427000 | ["2\n1 2", "3\n3 2 1", "4\n4 3 2 1"] | NoteIn the first sample the array has already been sorted, so to sort it, we need 0 swap operations, that is not more than 1. Thus, the answer is "YES".In the second sample we can sort the array if we swap elements 1 and 3, so we need 1 swap operation to sort the array. Thus, the answer is "YES".In the third sample we ... | PASSED | 1,300 | standard input | 2 seconds | The first line contains a single integer n (2 ≤ n ≤ 105) — the size of array a. The next line contains n positive integers, separated by single spaces and not exceeding 109, — array a. Note that the elements of the array are not necessarily distinct numbers. | ["YES", "YES", "NO"] | #include<stdio.h>
#include<stdlib.h>
int a[100003],b[100003];
int compare(const void *a,const void *b)
{return *(int *)a - *(int *)b;}
int main()
{ int n,i,j,count=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{scanf("%d",&a[i]);
b[i]=a[i];
}
qsort(a,n,4,compare);
for(i=0;i<n;i++)
{if (a[i... | |
The Little Elephant has got a problem — somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.The Little Elephant doesn't want to call the police until he understands if he could have accidentally changed the array himself. He thinks that he could ha... | In a single line print "YES" (without the quotes) if the Little Elephant could have accidentally changed the array himself, and "NO" (without the quotes) otherwise. | C | 541fde3a3c40926cbd1edb6017b83e52 | 94b107c1fe75b2218e8a14de19ca6fe8 | GNU C | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"sortings"
] | 1346427000 | ["2\n1 2", "3\n3 2 1", "4\n4 3 2 1"] | NoteIn the first sample the array has already been sorted, so to sort it, we need 0 swap operations, that is not more than 1. Thus, the answer is "YES".In the second sample we can sort the array if we swap elements 1 and 3, so we need 1 swap operation to sort the array. Thus, the answer is "YES".In the third sample we ... | PASSED | 1,300 | standard input | 2 seconds | The first line contains a single integer n (2 ≤ n ≤ 105) — the size of array a. The next line contains n positive integers, separated by single spaces and not exceeding 109, — array a. Note that the elements of the array are not necessarily distinct numbers. | ["YES", "YES", "NO"] | #include<stdio.h>
#include<stdlib.h>
int a[100003],b[100003];
int compare(const void *a,const void *b)
{return *(int *)a - *(int *)b;}
int main()
{
int n,i,count=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
b[i]=a[i];
}
qsort(a,n,4,compare);
for(i=0;i<n;i++)
... | |
The Little Elephant has got a problem — somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.The Little Elephant doesn't want to call the police until he understands if he could have accidentally changed the array himself. He thinks that he could ha... | In a single line print "YES" (without the quotes) if the Little Elephant could have accidentally changed the array himself, and "NO" (without the quotes) otherwise. | C | 541fde3a3c40926cbd1edb6017b83e52 | b31f27ff41a57cc698fe727df414e6b8 | GNU C | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"sortings"
] | 1346427000 | ["2\n1 2", "3\n3 2 1", "4\n4 3 2 1"] | NoteIn the first sample the array has already been sorted, so to sort it, we need 0 swap operations, that is not more than 1. Thus, the answer is "YES".In the second sample we can sort the array if we swap elements 1 and 3, so we need 1 swap operation to sort the array. Thus, the answer is "YES".In the third sample we ... | PASSED | 1,300 | standard input | 2 seconds | The first line contains a single integer n (2 ≤ n ≤ 105) — the size of array a. The next line contains n positive integers, separated by single spaces and not exceeding 109, — array a. Note that the elements of the array are not necessarily distinct numbers. | ["YES", "YES", "NO"] | #include <stdio.h>
int mergesort(int A[] , int low , int high)
{
if (low < high)
{
int mid = (low + high) / 2;
mergesort(A,low , mid);
mergesort(A,mid+1,high);
merge(A , low , mid , high);
}
else{return 0;}
}
int merge(int A[] , int low , int mid , int high)
{
int tem... | |
The Little Elephant has got a problem — somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.The Little Elephant doesn't want to call the police until he understands if he could have accidentally changed the array himself. He thinks that he could ha... | In a single line print "YES" (without the quotes) if the Little Elephant could have accidentally changed the array himself, and "NO" (without the quotes) otherwise. | C | 541fde3a3c40926cbd1edb6017b83e52 | 6e8db0e66679ad4da5cb8cc007ee4c05 | GNU C | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"sortings"
] | 1346427000 | ["2\n1 2", "3\n3 2 1", "4\n4 3 2 1"] | NoteIn the first sample the array has already been sorted, so to sort it, we need 0 swap operations, that is not more than 1. Thus, the answer is "YES".In the second sample we can sort the array if we swap elements 1 and 3, so we need 1 swap operation to sort the array. Thus, the answer is "YES".In the third sample we ... | PASSED | 1,300 | standard input | 2 seconds | The first line contains a single integer n (2 ≤ n ≤ 105) — the size of array a. The next line contains n positive integers, separated by single spaces and not exceeding 109, — array a. Note that the elements of the array are not necessarily distinct numbers. | ["YES", "YES", "NO"] | #include <stdio.h>
#include <stdlib.h>
int A[100001],B[100001];
int cmp(const void *a,const void *b)
{
return *(int *)a-*(int *)b;
}
int main()
{
int N,i,Cnt;
scanf("%d",&N);
for(i=0;i<N;++i)
{
scanf("%d",&A[i]);
B[i]=A[i];
}
qsort(B,N,sizeof(int),cmp);
for(Cnt=i=0;i<N... | |
The Little Elephant has got a problem — somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.The Little Elephant doesn't want to call the police until he understands if he could have accidentally changed the array himself. He thinks that he could ha... | In a single line print "YES" (without the quotes) if the Little Elephant could have accidentally changed the array himself, and "NO" (without the quotes) otherwise. | C | 541fde3a3c40926cbd1edb6017b83e52 | bc578099ba5408a27afd08f6555e5fea | GNU C | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"sortings"
] | 1346427000 | ["2\n1 2", "3\n3 2 1", "4\n4 3 2 1"] | NoteIn the first sample the array has already been sorted, so to sort it, we need 0 swap operations, that is not more than 1. Thus, the answer is "YES".In the second sample we can sort the array if we swap elements 1 and 3, so we need 1 swap operation to sort the array. Thus, the answer is "YES".In the third sample we ... | PASSED | 1,300 | standard input | 2 seconds | The first line contains a single integer n (2 ≤ n ≤ 105) — the size of array a. The next line contains n positive integers, separated by single spaces and not exceeding 109, — array a. Note that the elements of the array are not necessarily distinct numbers. | ["YES", "YES", "NO"] | #include<stdio.h>
#include<stdlib.h>
#define SIZE 100000
void print(int *a,int n) {
int i;
for(i=0; i<n; i++) {
printf(" %d",a[i]);
}
printf("\n");
}
void sort(int* a,int length) ;
void merge_sort(int *a, int * tmp, int left, int right) ;
void merge(int * a, int * tmp, int left, int right, int ... | |
The Little Elephant has got a problem — somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.The Little Elephant doesn't want to call the police until he understands if he could have accidentally changed the array himself. He thinks that he could ha... | In a single line print "YES" (without the quotes) if the Little Elephant could have accidentally changed the array himself, and "NO" (without the quotes) otherwise. | C | 541fde3a3c40926cbd1edb6017b83e52 | d7c97e1c6ac96f5dec9de11331a26879 | GNU C | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"sortings"
] | 1346427000 | ["2\n1 2", "3\n3 2 1", "4\n4 3 2 1"] | NoteIn the first sample the array has already been sorted, so to sort it, we need 0 swap operations, that is not more than 1. Thus, the answer is "YES".In the second sample we can sort the array if we swap elements 1 and 3, so we need 1 swap operation to sort the array. Thus, the answer is "YES".In the third sample we ... | PASSED | 1,300 | standard input | 2 seconds | The first line contains a single integer n (2 ≤ n ≤ 105) — the size of array a. The next line contains n positive integers, separated by single spaces and not exceeding 109, — array a. Note that the elements of the array are not necessarily distinct numbers. | ["YES", "YES", "NO"] | #include<stdio.h>
#include<stdlib.h>
#define SIZE 100000
int compare(const void *a,const void *b){
return *((int *)a)-*((int *)b);
}
int main() {
int a[SIZE];
int b[SIZE];
int i;
int n;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
b[i]=a[i];
}
qsort(b,n,sizeof(int),compare);
int count=0;
for(i=0;... | |
The Little Elephant has got a problem — somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.The Little Elephant doesn't want to call the police until he understands if he could have accidentally changed the array himself. He thinks that he could ha... | In a single line print "YES" (without the quotes) if the Little Elephant could have accidentally changed the array himself, and "NO" (without the quotes) otherwise. | C | 541fde3a3c40926cbd1edb6017b83e52 | c67cf8210f5aee7bc2f04634f46a5306 | GNU C | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"sortings"
] | 1346427000 | ["2\n1 2", "3\n3 2 1", "4\n4 3 2 1"] | NoteIn the first sample the array has already been sorted, so to sort it, we need 0 swap operations, that is not more than 1. Thus, the answer is "YES".In the second sample we can sort the array if we swap elements 1 and 3, so we need 1 swap operation to sort the array. Thus, the answer is "YES".In the third sample we ... | PASSED | 1,300 | standard input | 2 seconds | The first line contains a single integer n (2 ≤ n ≤ 105) — the size of array a. The next line contains n positive integers, separated by single spaces and not exceeding 109, — array a. Note that the elements of the array are not necessarily distinct numbers. | ["YES", "YES", "NO"] | #include<stdio.h>
int compare (const void * a, const void * b)
{
return ( *(int*)a - *(int*)b );
}
int main()
{int n; long int a[100001],b[100001];
scanf("%d",&n);
int i,c=0;
for(i=0;i<n;i++)
{scanf("%ld",&a[i]);
b[i]=a[i];
}
qsort(b,n,sizeof(long int),compare);
for(i=0;i<n;i++)
{if(a[i]!=b[i])
c++;
}
if(... | |
The Little Elephant has got a problem — somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.The Little Elephant doesn't want to call the police until he understands if he could have accidentally changed the array himself. He thinks that he could ha... | In a single line print "YES" (without the quotes) if the Little Elephant could have accidentally changed the array himself, and "NO" (without the quotes) otherwise. | C | 541fde3a3c40926cbd1edb6017b83e52 | 8023d0040b89d4a5e427c04faab177f4 | GNU C | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"sortings"
] | 1346427000 | ["2\n1 2", "3\n3 2 1", "4\n4 3 2 1"] | NoteIn the first sample the array has already been sorted, so to sort it, we need 0 swap operations, that is not more than 1. Thus, the answer is "YES".In the second sample we can sort the array if we swap elements 1 and 3, so we need 1 swap operation to sort the array. Thus, the answer is "YES".In the third sample we ... | PASSED | 1,300 | standard input | 2 seconds | The first line contains a single integer n (2 ≤ n ≤ 105) — the size of array a. The next line contains n positive integers, separated by single spaces and not exceeding 109, — array a. Note that the elements of the array are not necessarily distinct numbers. | ["YES", "YES", "NO"] | // BY MERGE SORT
#include<stdio.h>
void merge(long int a[], long int low, long int high, long int mid);
void mergesort(long int a[], long int low, long int high)
{
long int mid;
if(low<high)
{
mid=(low+high)/2;
mergesort(a,low,mid);
mergesort(a,mid+1,high);
merge(a,low,high,mid);
}
return;
}
void me... | |
The Little Elephant has got a problem — somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.The Little Elephant doesn't want to call the police until he understands if he could have accidentally changed the array himself. He thinks that he could ha... | In a single line print "YES" (without the quotes) if the Little Elephant could have accidentally changed the array himself, and "NO" (without the quotes) otherwise. | C | 541fde3a3c40926cbd1edb6017b83e52 | 8b0fd86af6d6575058bc4c1a3a60c449 | GNU C | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"sortings"
] | 1346427000 | ["2\n1 2", "3\n3 2 1", "4\n4 3 2 1"] | NoteIn the first sample the array has already been sorted, so to sort it, we need 0 swap operations, that is not more than 1. Thus, the answer is "YES".In the second sample we can sort the array if we swap elements 1 and 3, so we need 1 swap operation to sort the array. Thus, the answer is "YES".In the third sample we ... | PASSED | 1,300 | standard input | 2 seconds | The first line contains a single integer n (2 ≤ n ≤ 105) — the size of array a. The next line contains n positive integers, separated by single spaces and not exceeding 109, — array a. Note that the elements of the array are not necessarily distinct numbers. | ["YES", "YES", "NO"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int n,i,j,k,temp,cont=0;
scanf("%d",&n);
int v[n],ord[n];
int aux[2]={0};
for(i=0;i<n-1;i++)
{
scanf("%d ",&v[i]); //lee el vector sin contar los espacios
ord[i]=v[i];
}
scanf("%d",&v[n-1]);
ord[n-1]=v[n-1];
... | |
The Little Elephant has got a problem — somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.The Little Elephant doesn't want to call the police until he understands if he could have accidentally changed the array himself. He thinks that he could ha... | In a single line print "YES" (without the quotes) if the Little Elephant could have accidentally changed the array himself, and "NO" (without the quotes) otherwise. | C | 541fde3a3c40926cbd1edb6017b83e52 | 44f63443fbd3f75bb75819e647d16fe4 | GNU C | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"sortings"
] | 1346427000 | ["2\n1 2", "3\n3 2 1", "4\n4 3 2 1"] | NoteIn the first sample the array has already been sorted, so to sort it, we need 0 swap operations, that is not more than 1. Thus, the answer is "YES".In the second sample we can sort the array if we swap elements 1 and 3, so we need 1 swap operation to sort the array. Thus, the answer is "YES".In the third sample we ... | PASSED | 1,300 | standard input | 2 seconds | The first line contains a single integer n (2 ≤ n ≤ 105) — the size of array a. The next line contains n positive integers, separated by single spaces and not exceeding 109, — array a. Note that the elements of the array are not necessarily distinct numbers. | ["YES", "YES", "NO"] | #include<stdio.h>
void divide(long int *a,long int p,long int r)
{ long int q;
if(p<r)
{
q=(p+r)/2;
divide(a,p,q);
divide(a,q+1,r);
merg(a,p,q,r);
}
}
void merg(long int *a,long int p,long int q,long int r)
{long int n1,n2,i,j,k;
n1=q-p+1;
n2=r-q;
long int *l; long int *R;
l=(long int*)malloc((n... | |
The Little Elephant has got a problem — somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.The Little Elephant doesn't want to call the police until he understands if he could have accidentally changed the array himself. He thinks that he could ha... | In a single line print "YES" (without the quotes) if the Little Elephant could have accidentally changed the array himself, and "NO" (without the quotes) otherwise. | C | 541fde3a3c40926cbd1edb6017b83e52 | a8756572302aa568c88b7174aaced0f5 | GNU C | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"sortings"
] | 1346427000 | ["2\n1 2", "3\n3 2 1", "4\n4 3 2 1"] | NoteIn the first sample the array has already been sorted, so to sort it, we need 0 swap operations, that is not more than 1. Thus, the answer is "YES".In the second sample we can sort the array if we swap elements 1 and 3, so we need 1 swap operation to sort the array. Thus, the answer is "YES".In the third sample we ... | PASSED | 1,300 | standard input | 2 seconds | The first line contains a single integer n (2 ≤ n ≤ 105) — the size of array a. The next line contains n positive integers, separated by single spaces and not exceeding 109, — array a. Note that the elements of the array are not necessarily distinct numbers. | ["YES", "YES", "NO"] | #include <stdio.h>
#include <stdlib.h>
int compara(const void *_a, const void *_b) {
int *a, *b;
a = (int *) _a;
b = (int *) _b;
return (*a - *b);
}
main()
{
int dimension, i;
scanf("%d", &dimension);
int vector[dimension], vector1[dimension];
for (i=0; i<dimension; i++){
... | |
The Little Elephant has got a problem — somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.The Little Elephant doesn't want to call the police until he understands if he could have accidentally changed the array himself. He thinks that he could ha... | In a single line print "YES" (without the quotes) if the Little Elephant could have accidentally changed the array himself, and "NO" (without the quotes) otherwise. | C | 541fde3a3c40926cbd1edb6017b83e52 | e6ea31d39415717879f959f022baed5b | GNU C | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"sortings"
] | 1346427000 | ["2\n1 2", "3\n3 2 1", "4\n4 3 2 1"] | NoteIn the first sample the array has already been sorted, so to sort it, we need 0 swap operations, that is not more than 1. Thus, the answer is "YES".In the second sample we can sort the array if we swap elements 1 and 3, so we need 1 swap operation to sort the array. Thus, the answer is "YES".In the third sample we ... | PASSED | 1,300 | standard input | 2 seconds | The first line contains a single integer n (2 ≤ n ≤ 105) — the size of array a. The next line contains n positive integers, separated by single spaces and not exceeding 109, — array a. Note that the elements of the array are not necessarily distinct numbers. | ["YES", "YES", "NO"] | #include<stdio.h>
void swap(int *p1,int *p2)
{int t;
t=*p1;
*p1=*p2;
*p2=t;}
int main()
{int n,i,j=0,t=0,a[100005]={0};
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
if(n>2)
for(i=1;i<n;i++)
{if(a[i]<a[i-1])
{if(i+1<n)
{if(a[i+1]<a[i])
{swap(&a[i+1],&a[i-1]);t++;
if(t==1)
break;
... | |
The Little Elephant has got a problem — somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.The Little Elephant doesn't want to call the police until he understands if he could have accidentally changed the array himself. He thinks that he could ha... | In a single line print "YES" (without the quotes) if the Little Elephant could have accidentally changed the array himself, and "NO" (without the quotes) otherwise. | C | 541fde3a3c40926cbd1edb6017b83e52 | 92153cf128f18e2c032014ccdade8911 | GNU C | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"sortings"
] | 1346427000 | ["2\n1 2", "3\n3 2 1", "4\n4 3 2 1"] | NoteIn the first sample the array has already been sorted, so to sort it, we need 0 swap operations, that is not more than 1. Thus, the answer is "YES".In the second sample we can sort the array if we swap elements 1 and 3, so we need 1 swap operation to sort the array. Thus, the answer is "YES".In the third sample we ... | PASSED | 1,300 | standard input | 2 seconds | The first line contains a single integer n (2 ≤ n ≤ 105) — the size of array a. The next line contains n positive integers, separated by single spaces and not exceeding 109, — array a. Note that the elements of the array are not necessarily distinct numbers. | ["YES", "YES", "NO"] | #include <stdio.h>
#include <stdlib.h>
#define SIZE 100000
int cmp (const void *a, const void *b)
{
return *(int *)a - *(int *)b;
}
int a[SIZE], b[SIZE];
int main()
{
int n, i, cnt = 0;
scanf ("%d", &n);
for (i = 0; i < n; i++) {
scanf ("%d", &a[i]);
b[i] = a[i];
}
qsort (a, n, sizeof a[0], cmp);
for... | |
The Little Elephant has got a problem — somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.The Little Elephant doesn't want to call the police until he understands if he could have accidentally changed the array himself. He thinks that he could ha... | In a single line print "YES" (without the quotes) if the Little Elephant could have accidentally changed the array himself, and "NO" (without the quotes) otherwise. | C | 541fde3a3c40926cbd1edb6017b83e52 | 0b0dea3da4231492a683bec0b35ae823 | GNU C | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"sortings"
] | 1346427000 | ["2\n1 2", "3\n3 2 1", "4\n4 3 2 1"] | NoteIn the first sample the array has already been sorted, so to sort it, we need 0 swap operations, that is not more than 1. Thus, the answer is "YES".In the second sample we can sort the array if we swap elements 1 and 3, so we need 1 swap operation to sort the array. Thus, the answer is "YES".In the third sample we ... | PASSED | 1,300 | standard input | 2 seconds | The first line contains a single integer n (2 ≤ n ≤ 105) — the size of array a. The next line contains n positive integers, separated by single spaces and not exceeding 109, — array a. Note that the elements of the array are not necessarily distinct numbers. | ["YES", "YES", "NO"] | #include <stdio.h>
#include <stdlib.h>
int cmpfunc (const void * a, const void * b)
{
return ( *(int*)a - *(int*)b );
}
int main()
{
int n,temp;
scanf("%d",&n);
int c[n];
int s[n];
int i,j,k=0;
for(i=0; i<n; i++)
{
scanf("%d", &s[i]);
c[i] = s[i];
}
qsort(c, n,... | |
The Little Elephant has got a problem — somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.The Little Elephant doesn't want to call the police until he understands if he could have accidentally changed the array himself. He thinks that he could ha... | In a single line print "YES" (without the quotes) if the Little Elephant could have accidentally changed the array himself, and "NO" (without the quotes) otherwise. | C | 541fde3a3c40926cbd1edb6017b83e52 | 8fffd5c4ea6fed095c0f5c429c2e8b08 | GNU C | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"sortings"
] | 1346427000 | ["2\n1 2", "3\n3 2 1", "4\n4 3 2 1"] | NoteIn the first sample the array has already been sorted, so to sort it, we need 0 swap operations, that is not more than 1. Thus, the answer is "YES".In the second sample we can sort the array if we swap elements 1 and 3, so we need 1 swap operation to sort the array. Thus, the answer is "YES".In the third sample we ... | PASSED | 1,300 | standard input | 2 seconds | The first line contains a single integer n (2 ≤ n ≤ 105) — the size of array a. The next line contains n positive integers, separated by single spaces and not exceeding 109, — array a. Note that the elements of the array are not necessarily distinct numbers. | ["YES", "YES", "NO"] | #include<stdio.h>
int compare (const void * a, const void * b)
{
return ( *(int*)a - *(int*)b );
}
int main()
{int n; long int a[100001],b[100001];
scanf("%d",&n);
int i,c=0;
for(i=0;i<n;i++)
{scanf("%ld",&a[i]);
b[i]=a[i];
}
qsort(b,n,sizeof(long int),compare);
for(i=0;i<n;i++)
{if(a[i]!=b[i])
c++;
}
if(... | |
A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest car and he likes it. It's known that the largest car is strictly larg... | Output three integers — sizes of father bear's car, mother bear's car and son bear's car, respectively. If there are multiple possible solutions, print any. If there is no solution, print "-1" (without quotes). | C | 56535017d012fdfcc13695dfd5b33084 | 3d84c24a444191502e48aaeaacac033d | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"brute force"
] | 1514037900 | ["50 30 10 10", "100 50 10 21"] | NoteIn first test case all conditions for cars' sizes are satisfied.In second test case there is no answer, because Masha should be able to climb into smallest car (so size of smallest car in not less than 21), but son bear should like it, so maximum possible size of it is 20. | PASSED | 1,300 | standard input | 2 seconds | You are given four integers V1, V2, V3, Vm(1 ≤ Vi ≤ 100) — sizes of father bear, mother bear, son bear and Masha, respectively. It's guaranteed that V1 > V2 > V3. | ["50\n30\n10", "-1"] | #include <stdio.h>
int main(int argc, char const *argv[])
{
int fb,mb,sb,Marsha;
int lcar,mcar,scar,scar_smallest;
scanf("%d%d%d%d",&fb,&mb,&sb,&Marsha);
lcar=fb*2;//biggest size of dad car
mcar=(lcar>(mb*2))?(mb*2):(lcar-1);//biggest size of mom car
scar=(mcar>(sb*2))?(sb*2):(mcar-1);
//m... | |
A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest car and he likes it. It's known that the largest car is strictly larg... | Output three integers — sizes of father bear's car, mother bear's car and son bear's car, respectively. If there are multiple possible solutions, print any. If there is no solution, print "-1" (without quotes). | C | 56535017d012fdfcc13695dfd5b33084 | 372d79237e772934e34e6648b2181c11 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"brute force"
] | 1514037900 | ["50 30 10 10", "100 50 10 21"] | NoteIn first test case all conditions for cars' sizes are satisfied.In second test case there is no answer, because Masha should be able to climb into smallest car (so size of smallest car in not less than 21), but son bear should like it, so maximum possible size of it is 20. | PASSED | 1,300 | standard input | 2 seconds | You are given four integers V1, V2, V3, Vm(1 ≤ Vi ≤ 100) — sizes of father bear, mother bear, son bear and Masha, respectively. It's guaranteed that V1 > V2 > V3. | ["50\n30\n10", "-1"] | #include<stdio.h>
#include<stdlib.h>
int v1, v2, v3, v4;
void work()
{
int flag = 0;
for(int a1=1; a1<=2*v1; a1++)
{
for(int a2=1; a2<a1; a2++)
{
for(int a3=1; a3<a2; a3++)
{
if(2*v1>=a1 && a1>=v1 &&
2*v2>=a2 && a2>=v2 &&
2*v3>=a3 && a3>=v3 &&
2*v4>=a3 && a3>=v4 && 2*v4<a2)
{... | |
A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest car and he likes it. It's known that the largest car is strictly larg... | Output three integers — sizes of father bear's car, mother bear's car and son bear's car, respectively. If there are multiple possible solutions, print any. If there is no solution, print "-1" (without quotes). | C | 56535017d012fdfcc13695dfd5b33084 | 266cda1f7aaee926d24290f7e5da35f2 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"brute force"
] | 1514037900 | ["50 30 10 10", "100 50 10 21"] | NoteIn first test case all conditions for cars' sizes are satisfied.In second test case there is no answer, because Masha should be able to climb into smallest car (so size of smallest car in not less than 21), but son bear should like it, so maximum possible size of it is 20. | PASSED | 1,300 | standard input | 2 seconds | You are given four integers V1, V2, V3, Vm(1 ≤ Vi ≤ 100) — sizes of father bear, mother bear, son bear and Masha, respectively. It's guaranteed that V1 > V2 > V3. | ["50\n30\n10", "-1"] | #include <stdio.h>
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)>(b)?(b):(a))
int main() {
int father, mother, son, masha;
int car1, car2, car3;
scanf("%d %d %d %d", &father, &mother, &son, &masha);
int flag = 0;
for (car3 = max(son,masha); car3 <= min(2*son,2*masha)&&flag==0; ++car3) {
... | |
A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest car and he likes it. It's known that the largest car is strictly larg... | Output three integers — sizes of father bear's car, mother bear's car and son bear's car, respectively. If there are multiple possible solutions, print any. If there is no solution, print "-1" (without quotes). | C | 56535017d012fdfcc13695dfd5b33084 | 83644f2372aeb007ba826b74d8931c25 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"brute force"
] | 1514037900 | ["50 30 10 10", "100 50 10 21"] | NoteIn first test case all conditions for cars' sizes are satisfied.In second test case there is no answer, because Masha should be able to climb into smallest car (so size of smallest car in not less than 21), but son bear should like it, so maximum possible size of it is 20. | PASSED | 1,300 | standard input | 2 seconds | You are given four integers V1, V2, V3, Vm(1 ≤ Vi ≤ 100) — sizes of father bear, mother bear, son bear and Masha, respectively. It's guaranteed that V1 > V2 > V3. | ["50\n30\n10", "-1"] | #include <stdio.h>
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)>(b)?(b):(a))
int main() {
int father, mother, son, masha;
int car1, car2, car3;
scanf("%d %d %d %d", &father, &mother, &son, &masha);
int flag = 0;
for (car3 = max(son,masha); car3 <= min(2*son,2*masha)&&flag==0; ++car3) {
... | |
A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest car and he likes it. It's known that the largest car is strictly larg... | Output three integers — sizes of father bear's car, mother bear's car and son bear's car, respectively. If there are multiple possible solutions, print any. If there is no solution, print "-1" (without quotes). | C | 56535017d012fdfcc13695dfd5b33084 | 98233c230821e0fc291fb922997aa761 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"brute force"
] | 1514037900 | ["50 30 10 10", "100 50 10 21"] | NoteIn first test case all conditions for cars' sizes are satisfied.In second test case there is no answer, because Masha should be able to climb into smallest car (so size of smallest car in not less than 21), but son bear should like it, so maximum possible size of it is 20. | PASSED | 1,300 | standard input | 2 seconds | You are given four integers V1, V2, V3, Vm(1 ≤ Vi ≤ 100) — sizes of father bear, mother bear, son bear and Masha, respectively. It's guaranteed that V1 > V2 > V3. | ["50\n30\n10", "-1"] | #include<stdio.h>
int max(int a,int b)
{
if(a>b)
return a;
else return b;
}
int min(int a,int b)
{
if(a>b)
return b;
else return a;
}
int main()
{
int v1,v2,v3,v,c1,c2,c3,f=0;
scanf("%d%d%d%d",&v1,&v2,&v3,&v);
for(c3=max(v3,v);c3<=min(2*v3,2*v)&&f==0;c3++)
for(c2=max... | |
A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest car and he likes it. It's known that the largest car is strictly larg... | Output three integers — sizes of father bear's car, mother bear's car and son bear's car, respectively. If there are multiple possible solutions, print any. If there is no solution, print "-1" (without quotes). | C | 56535017d012fdfcc13695dfd5b33084 | f48cc97aa304355b7f196ae693e3f3a4 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation",
"brute force"
] | 1514037900 | ["50 30 10 10", "100 50 10 21"] | NoteIn first test case all conditions for cars' sizes are satisfied.In second test case there is no answer, because Masha should be able to climb into smallest car (so size of smallest car in not less than 21), but son bear should like it, so maximum possible size of it is 20. | PASSED | 1,300 | standard input | 2 seconds | You are given four integers V1, V2, V3, Vm(1 ≤ Vi ≤ 100) — sizes of father bear, mother bear, son bear and Masha, respectively. It's guaranteed that V1 > V2 > V3. | ["50\n30\n10", "-1"] | #include <stdio.h>
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)>(b)?(b):(a))
int main() {
int father, mother, son, masha;
int car1, car2, car3;
scanf("%d %d %d %d", &father, &mother, &son, &masha);
int flag = 0;
for (car3 = max(son,masha); car3 <= min(2*son,2*masha)&&flag==0; ++car3) {
... | |
Jeff got 2n real numbers a1, a2, ..., a2n as a birthday present. The boy hates non-integer numbers, so he decided to slightly "adjust" the numbers he's got. Namely, Jeff consecutively executes n operations, each of them goes as follows: choose indexes i and j (i ≠ j) that haven't been chosen yet; round element ai to ... | In a single line print a single real number — the required difference with exactly three digits after the decimal point. | C | f84b7122ffc7f585fd4ac8f1b3ef977a | a326fef2c50816e81aebfe7902450615 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"dp",
"implementation",
"greedy",
"math"
] | 1380900600 | ["3\n0.000 0.500 0.750 1.000 2.000 3.000", "3\n4469.000 6526.000 4864.000 9356.383 7490.000 995.896"] | NoteIn the first test case you need to perform the operations as follows: (i = 1, j = 4), (i = 2, j = 3), (i = 5, j = 6). In this case, the difference will equal |(0 + 0.5 + 0.75 + 1 + 2 + 3) - (0 + 0 + 1 + 1 + 2 + 3)| = 0.25. | PASSED | 1,800 | standard input | 1 second | The first line contains integer n (1 ≤ n ≤ 2000). The next line contains 2n real numbers a1, a2, ..., a2n (0 ≤ ai ≤ 10000), given with exactly three digits after the decimal point. The numbers are separated by spaces. | ["0.250", "0.279"] | /* practice with Dukkha */
#include <stdio.h>
#include <stdlib.h>
int main() {
int n, i, sum, z, lower, upper, ans;
scanf("%d", &n);
sum = 0;
z = 0;
for (i = 0; i < n * 2; i++) {
double a_;
int a;
scanf("%lf", &a_);
a = (int) (a_ * 1000 + 0.5) % 1000;
sum += a;
if (a == 0)
z++;
}
lower = z >= n... | |
Let's call a non-empty sequence of positive integers a1, a2... ak coprime if the greatest common divisor of all elements of this sequence is equal to 1.Given an array a consisting of n positive integers, find the number of its coprime subsequences. Since the answer may be very large, print it modulo 109 + 7.Note that t... | Print the number of coprime subsequences of a modulo 109 + 7. | C | 2e6eafc13ff8dc91e6803deeaf2ecea5 | 3ba68c46e863387f57ce13121244f7c8 | GNU C | standard output | 256 megabytes | train_003.jsonl | [
"combinatorics",
"number theory",
"bitmasks"
] | 1493391900 | ["3\n1 2 3", "4\n1 1 1 1", "7\n1 3 5 15 3 105 35"] | NoteIn the first example coprime subsequences are: 1 1, 2 1, 3 1, 2, 3 2, 3 In the second example all subsequences are coprime. | PASSED | 2,000 | standard input | 2 seconds | The first line contains one integer number n (1 ≤ n ≤ 100000). The second line contains n integer numbers a1, a2... an (1 ≤ ai ≤ 100000). | ["5", "15", "100"] | #include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <assert.h>
#define MAX 1000010
#define MOD 1000000007
#define clr(ar) memset(ar, 0, sizeof(ar))
#define read() freopen("lol.txt", "r", stdin)
int n, ar[MAX];
char mu[MAX] = {0};
void mobius(){
int i, j;
mu[1] = 1;
for (i = 1; i < MAX; ... | |
Sonya decided that having her own hotel business is the best way of earning money because she can profit and rest wherever she wants.The country where Sonya lives is an endless line. There is a city in each integer coordinate on this line. She has $$$n$$$ hotels, where the $$$i$$$-th hotel is located in the city with c... | Print the number of cities where Sonya can build a new hotel so that the minimum distance from this hotel to all others is equal to $$$d$$$. | C | 5babbb7c5f6b494992ffa921c8e19294 | 4045b5b08e3810c3ecba4b85cd2e382c | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1530808500 | ["4 3\n-3 2 9 16", "5 2\n4 8 11 18 19"] | NoteIn the first example, there are $$$6$$$ possible cities where Sonya can build a hotel. These cities have coordinates $$$-6$$$, $$$5$$$, $$$6$$$, $$$12$$$, $$$13$$$, and $$$19$$$.In the second example, there are $$$5$$$ possible cities where Sonya can build a hotel. These cities have coordinates $$$2$$$, $$$6$$$, $$... | PASSED | 900 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$d$$$ ($$$1\leq n\leq 100$$$, $$$1\leq d\leq 10^9$$$) — the number of Sonya's hotels and the needed minimum distance from a new hotel to all others. The second line contains $$$n$$$ different integers in strictly increasing order $$$x_1, x_2, \ldots, x_n$$$ ($$$-10^9\l... | ["6", "5"] | #include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <math.h>
int N, D, cities[101 + 2];
int main()
{
scanf("%i %i", &N, &D);
for(int i = 0; i < N; i++)
{
scanf("%i", &cities[i]);
}
int count = 2;
for(int i = 0; i < N - 1; i++)
{
if(cities[i + 1] - cities[i]... | |
Sonya decided that having her own hotel business is the best way of earning money because she can profit and rest wherever she wants.The country where Sonya lives is an endless line. There is a city in each integer coordinate on this line. She has $$$n$$$ hotels, where the $$$i$$$-th hotel is located in the city with c... | Print the number of cities where Sonya can build a new hotel so that the minimum distance from this hotel to all others is equal to $$$d$$$. | C | 5babbb7c5f6b494992ffa921c8e19294 | 547ece890a179b375d0d54526fc4c721 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1530808500 | ["4 3\n-3 2 9 16", "5 2\n4 8 11 18 19"] | NoteIn the first example, there are $$$6$$$ possible cities where Sonya can build a hotel. These cities have coordinates $$$-6$$$, $$$5$$$, $$$6$$$, $$$12$$$, $$$13$$$, and $$$19$$$.In the second example, there are $$$5$$$ possible cities where Sonya can build a hotel. These cities have coordinates $$$2$$$, $$$6$$$, $$... | PASSED | 900 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$d$$$ ($$$1\leq n\leq 100$$$, $$$1\leq d\leq 10^9$$$) — the number of Sonya's hotels and the needed minimum distance from a new hotel to all others. The second line contains $$$n$$$ different integers in strictly increasing order $$$x_1, x_2, \ldots, x_n$$$ ($$$-10^9\l... | ["6", "5"] | #include<stdio.h>
int main()
{
int i,j,t,n,d,s=2,a[1000],k,g;
scanf("%d %d",&n,&d);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<n-1;i++)
{
if( a[i+1]-a[i]==2*d)
s++;
else if(a[i+1]-a[i]>2*d)
s+=2;
}
printf("%d\n",s);
return 0;
} | |
Sonya decided that having her own hotel business is the best way of earning money because she can profit and rest wherever she wants.The country where Sonya lives is an endless line. There is a city in each integer coordinate on this line. She has $$$n$$$ hotels, where the $$$i$$$-th hotel is located in the city with c... | Print the number of cities where Sonya can build a new hotel so that the minimum distance from this hotel to all others is equal to $$$d$$$. | C | 5babbb7c5f6b494992ffa921c8e19294 | 9908898997c707b572749e6eed03860c | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1530808500 | ["4 3\n-3 2 9 16", "5 2\n4 8 11 18 19"] | NoteIn the first example, there are $$$6$$$ possible cities where Sonya can build a hotel. These cities have coordinates $$$-6$$$, $$$5$$$, $$$6$$$, $$$12$$$, $$$13$$$, and $$$19$$$.In the second example, there are $$$5$$$ possible cities where Sonya can build a hotel. These cities have coordinates $$$2$$$, $$$6$$$, $$... | PASSED | 900 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$d$$$ ($$$1\leq n\leq 100$$$, $$$1\leq d\leq 10^9$$$) — the number of Sonya's hotels and the needed minimum distance from a new hotel to all others. The second line contains $$$n$$$ different integers in strictly increasing order $$$x_1, x_2, \ldots, x_n$$$ ($$$-10^9\l... | ["6", "5"] | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define MAX 111
int n,m,x,y,a,b,d,arr[MAX],ans,tmp,i;
int main(){
for(scanf("%i%i",&n,&d);i<n;i++){
scanf("%i", &arr[i]);
}
ans=2;
for(i=0;i<n-1;i++)
{
if(abs(arr[i]-arr[i+1])-2*d==0) ans++;
else if(abs(arr[i]-arr[i+1])-2... | |
Sonya decided that having her own hotel business is the best way of earning money because she can profit and rest wherever she wants.The country where Sonya lives is an endless line. There is a city in each integer coordinate on this line. She has $$$n$$$ hotels, where the $$$i$$$-th hotel is located in the city with c... | Print the number of cities where Sonya can build a new hotel so that the minimum distance from this hotel to all others is equal to $$$d$$$. | C | 5babbb7c5f6b494992ffa921c8e19294 | ef188d736002ed672a37fa6b492f63b4 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1530808500 | ["4 3\n-3 2 9 16", "5 2\n4 8 11 18 19"] | NoteIn the first example, there are $$$6$$$ possible cities where Sonya can build a hotel. These cities have coordinates $$$-6$$$, $$$5$$$, $$$6$$$, $$$12$$$, $$$13$$$, and $$$19$$$.In the second example, there are $$$5$$$ possible cities where Sonya can build a hotel. These cities have coordinates $$$2$$$, $$$6$$$, $$... | PASSED | 900 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$d$$$ ($$$1\leq n\leq 100$$$, $$$1\leq d\leq 10^9$$$) — the number of Sonya's hotels and the needed minimum distance from a new hotel to all others. The second line contains $$$n$$$ different integers in strictly increasing order $$$x_1, x_2, \ldots, x_n$$$ ($$$-10^9\l... | ["6", "5"] | #include<stdio.h>
int main()
{
long long a[105],count=2,i,j,k,x,n,d;
scanf("%lld%lld",&n,&d);
for(i=0;i<n;i++)
{
scanf("%lld",&a[i]);
}
for(i=0;i<n-1;i++)
{
if(a[i]+d<=a[i+1]-d)
count++;
if((a[i+1]-d>=a[i]+d)&&(a[i]+d!=a[i+1]-d))
count++;
}... | |
Sonya decided that having her own hotel business is the best way of earning money because she can profit and rest wherever she wants.The country where Sonya lives is an endless line. There is a city in each integer coordinate on this line. She has $$$n$$$ hotels, where the $$$i$$$-th hotel is located in the city with c... | Print the number of cities where Sonya can build a new hotel so that the minimum distance from this hotel to all others is equal to $$$d$$$. | C | 5babbb7c5f6b494992ffa921c8e19294 | 123df8cccd48ce74b1aca8f5f59d4180 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1530808500 | ["4 3\n-3 2 9 16", "5 2\n4 8 11 18 19"] | NoteIn the first example, there are $$$6$$$ possible cities where Sonya can build a hotel. These cities have coordinates $$$-6$$$, $$$5$$$, $$$6$$$, $$$12$$$, $$$13$$$, and $$$19$$$.In the second example, there are $$$5$$$ possible cities where Sonya can build a hotel. These cities have coordinates $$$2$$$, $$$6$$$, $$... | PASSED | 900 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$d$$$ ($$$1\leq n\leq 100$$$, $$$1\leq d\leq 10^9$$$) — the number of Sonya's hotels and the needed minimum distance from a new hotel to all others. The second line contains $$$n$$$ different integers in strictly increasing order $$$x_1, x_2, \ldots, x_n$$$ ($$$-10^9\l... | ["6", "5"] | #include <stdio.h>
int main(void) {
int a,i,j=0;
double b,d[120];
scanf("%d %lf",&a,&b);
for(i=0;i<a;i++)
{
scanf("%lf",&d[i]);
while(i>0)
{
if((d[i]-d[i-1])/2==b) j++;
else if((d[i]-d[i-1])/2>b) j+=2;
break;
}
}
printf("%d\n",j+2);
return 0;
}
| |
Sonya decided that having her own hotel business is the best way of earning money because she can profit and rest wherever she wants.The country where Sonya lives is an endless line. There is a city in each integer coordinate on this line. She has $$$n$$$ hotels, where the $$$i$$$-th hotel is located in the city with c... | Print the number of cities where Sonya can build a new hotel so that the minimum distance from this hotel to all others is equal to $$$d$$$. | C | 5babbb7c5f6b494992ffa921c8e19294 | 6278c98fb26a9631a3cb8bcd15a806f0 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1530808500 | ["4 3\n-3 2 9 16", "5 2\n4 8 11 18 19"] | NoteIn the first example, there are $$$6$$$ possible cities where Sonya can build a hotel. These cities have coordinates $$$-6$$$, $$$5$$$, $$$6$$$, $$$12$$$, $$$13$$$, and $$$19$$$.In the second example, there are $$$5$$$ possible cities where Sonya can build a hotel. These cities have coordinates $$$2$$$, $$$6$$$, $$... | PASSED | 900 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$d$$$ ($$$1\leq n\leq 100$$$, $$$1\leq d\leq 10^9$$$) — the number of Sonya's hotels and the needed minimum distance from a new hotel to all others. The second line contains $$$n$$$ different integers in strictly increasing order $$$x_1, x_2, \ldots, x_n$$$ ($$$-10^9\l... | ["6", "5"] | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
long long int ch[400000]= {0},cp[400000];
char kh[2000][20],arr[2000][200];
long long int a,b=0,c,d,e,i=0,j=0,k=0,l=0,tep,temp,m,n,x,y;
double z,go;
scanf("%lld%lld",&a,&c);
for(i=0; i<a; i++)
{
scanf("%lld",&b)... | |
Sonya decided that having her own hotel business is the best way of earning money because she can profit and rest wherever she wants.The country where Sonya lives is an endless line. There is a city in each integer coordinate on this line. She has $$$n$$$ hotels, where the $$$i$$$-th hotel is located in the city with c... | Print the number of cities where Sonya can build a new hotel so that the minimum distance from this hotel to all others is equal to $$$d$$$. | C | 5babbb7c5f6b494992ffa921c8e19294 | 084221b34117d7e6ca69df0ac8d9e794 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1530808500 | ["4 3\n-3 2 9 16", "5 2\n4 8 11 18 19"] | NoteIn the first example, there are $$$6$$$ possible cities where Sonya can build a hotel. These cities have coordinates $$$-6$$$, $$$5$$$, $$$6$$$, $$$12$$$, $$$13$$$, and $$$19$$$.In the second example, there are $$$5$$$ possible cities where Sonya can build a hotel. These cities have coordinates $$$2$$$, $$$6$$$, $$... | PASSED | 900 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$d$$$ ($$$1\leq n\leq 100$$$, $$$1\leq d\leq 10^9$$$) — the number of Sonya's hotels and the needed minimum distance from a new hotel to all others. The second line contains $$$n$$$ different integers in strictly increasing order $$$x_1, x_2, \ldots, x_n$$$ ($$$-10^9\l... | ["6", "5"] | #include<stdio.h>
int main()
{
int n;
long long a[105],d,count=2;
scanf("%d%lld",&n,&d);
for(int i=0;i<n;i++)
scanf("%lld",&a[i]);
for(int i=1;i<n;i++)
{
if(a[i]-a[i-1]>2*d)
count+=2;
else if(a[i]-a[i-1]==2*d)
count++;
}
printf("%lld",count);
} | |
Sonya decided that having her own hotel business is the best way of earning money because she can profit and rest wherever she wants.The country where Sonya lives is an endless line. There is a city in each integer coordinate on this line. She has $$$n$$$ hotels, where the $$$i$$$-th hotel is located in the city with c... | Print the number of cities where Sonya can build a new hotel so that the minimum distance from this hotel to all others is equal to $$$d$$$. | C | 5babbb7c5f6b494992ffa921c8e19294 | bec5339f4ae98da0298a73492c7dc4d5 | GNU C11 | standard output | 256 megabytes | train_003.jsonl | [
"implementation"
] | 1530808500 | ["4 3\n-3 2 9 16", "5 2\n4 8 11 18 19"] | NoteIn the first example, there are $$$6$$$ possible cities where Sonya can build a hotel. These cities have coordinates $$$-6$$$, $$$5$$$, $$$6$$$, $$$12$$$, $$$13$$$, and $$$19$$$.In the second example, there are $$$5$$$ possible cities where Sonya can build a hotel. These cities have coordinates $$$2$$$, $$$6$$$, $$... | PASSED | 900 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$d$$$ ($$$1\leq n\leq 100$$$, $$$1\leq d\leq 10^9$$$) — the number of Sonya's hotels and the needed minimum distance from a new hotel to all others. The second line contains $$$n$$$ different integers in strictly increasing order $$$x_1, x_2, \ldots, x_n$$$ ($$$-10^9\l... | ["6", "5"] | # include <stdio.h>
long long int arr[101];
int main(void){
int n;
long long int d,count=2;
scanf("%d %lld",&n,&d);
for (int i=0;i<n;i++){
scanf("%lld",&arr[i]);
}
for (int i=0;i<n-1;i++){
if (arr[i]+d<arr[i+1]-d) count+=2;
else if (arr[i]+d==arr[i+1]-d) count++;
}
printf("%lld\n",count);
return 0;
}
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.