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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Mishka got an integer array $$$a$$$ of length $$$n$$$ as a birthday present (what a surprise!).Mishka doesn't like this present and wants to change it somehow. He has invented an algorithm and called it "Mishka's Adjacent Replacements Algorithm". This algorithm can be represented as a sequence of steps: Replace each o... | Print $$$n$$$ integers — $$$b_1, b_2, \dots, b_n$$$, where $$$b_i$$$ is the final value of the $$$i$$$-th element of the array after applying "Mishka's Adjacent Replacements Algorithm" to the array $$$a$$$. Note that you cannot change the order of elements in the array. | C | d00696cb27c679dda6e2e29314a8432b | c80620e849d28d5bc7d44090de656281 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1531751700 | ["5\n1 2 4 5 10", "10\n10000 10 50605065 1 5 89 5 999999999 60506056 1000000000"] | NoteThe first example is described in the problem statement. | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer number $$$n$$$ ($$$1 \le n \le 1000$$$) — the number of elements in Mishka's birthday present (surprisingly, an array). The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) — the elements of the array. | ["1 1 3 5 9", "9999 9 50605065 1 5 89 5 999999999 60506055 999999999"] | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
int main()
{
int n;
scanf("%d",&n);
long long a[n];
for(int i=0;i<n;i++)
{
scanf("%lld",&a[i]);
}
long long temp,temp1,temp2;
for(int i=0;i<n;i++)
{
int d=2;
if(a[i]%2!=0)
{
temp=a[i]+1;
while(d--)
... | |
Mishka got an integer array $$$a$$$ of length $$$n$$$ as a birthday present (what a surprise!).Mishka doesn't like this present and wants to change it somehow. He has invented an algorithm and called it "Mishka's Adjacent Replacements Algorithm". This algorithm can be represented as a sequence of steps: Replace each o... | Print $$$n$$$ integers — $$$b_1, b_2, \dots, b_n$$$, where $$$b_i$$$ is the final value of the $$$i$$$-th element of the array after applying "Mishka's Adjacent Replacements Algorithm" to the array $$$a$$$. Note that you cannot change the order of elements in the array. | C | d00696cb27c679dda6e2e29314a8432b | 304df0f67bc29ecdd03fc4cf4fee2164 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1531751700 | ["5\n1 2 4 5 10", "10\n10000 10 50605065 1 5 89 5 999999999 60506056 1000000000"] | NoteThe first example is described in the problem statement. | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer number $$$n$$$ ($$$1 \le n \le 1000$$$) — the number of elements in Mishka's birthday present (surprisingly, an array). The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) — the elements of the array. | ["1 1 3 5 9", "9999 9 50605065 1 5 89 5 999999999 60506055 999999999"] | #include<stdio.h>
int main()
{
int n,a;
scanf("%d",&n);
for(int i=0;i<n;i++)
{
scanf("%d",&a);
if(a%2==0)
{
printf("%d ",a-1);
}
else
{
printf("%d ",a);
}
}
return 0;
}
| |
Mishka got an integer array $$$a$$$ of length $$$n$$$ as a birthday present (what a surprise!).Mishka doesn't like this present and wants to change it somehow. He has invented an algorithm and called it "Mishka's Adjacent Replacements Algorithm". This algorithm can be represented as a sequence of steps: Replace each o... | Print $$$n$$$ integers — $$$b_1, b_2, \dots, b_n$$$, where $$$b_i$$$ is the final value of the $$$i$$$-th element of the array after applying "Mishka's Adjacent Replacements Algorithm" to the array $$$a$$$. Note that you cannot change the order of elements in the array. | C | d00696cb27c679dda6e2e29314a8432b | 14fc10cef7a064547c96d11ec8768533 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1531751700 | ["5\n1 2 4 5 10", "10\n10000 10 50605065 1 5 89 5 999999999 60506056 1000000000"] | NoteThe first example is described in the problem statement. | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer number $$$n$$$ ($$$1 \le n \le 1000$$$) — the number of elements in Mishka's birthday present (surprisingly, an array). The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) — the elements of the array. | ["1 1 3 5 9", "9999 9 50605065 1 5 89 5 999999999 60506055 999999999"] | #include<stdio.h>
int main()
{
int n,a;
scanf("%d",&n);
while(n--)
{
scanf("%d",&a);
if(a%2!=0)
{
printf("%d ",a);
}
else
{
printf("%d ",a-1);
}
}
return 0;
}
| |
Mishka got an integer array $$$a$$$ of length $$$n$$$ as a birthday present (what a surprise!).Mishka doesn't like this present and wants to change it somehow. He has invented an algorithm and called it "Mishka's Adjacent Replacements Algorithm". This algorithm can be represented as a sequence of steps: Replace each o... | Print $$$n$$$ integers — $$$b_1, b_2, \dots, b_n$$$, where $$$b_i$$$ is the final value of the $$$i$$$-th element of the array after applying "Mishka's Adjacent Replacements Algorithm" to the array $$$a$$$. Note that you cannot change the order of elements in the array. | C | d00696cb27c679dda6e2e29314a8432b | 6ba042e1645aee920434f8ef562cb472 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1531751700 | ["5\n1 2 4 5 10", "10\n10000 10 50605065 1 5 89 5 999999999 60506056 1000000000"] | NoteThe first example is described in the problem statement. | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer number $$$n$$$ ($$$1 \le n \le 1000$$$) — the number of elements in Mishka's birthday present (surprisingly, an array). The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) — the elements of the array. | ["1 1 3 5 9", "9999 9 50605065 1 5 89 5 999999999 60506055 999999999"] | #include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
int arr[n];
for(int i=0; i<n; i++)
scanf("%d",&arr[i]);
for(int i=0; i<n; i++)
{
if(arr[i]%2==0)
arr[i]=arr[i]-1;
}
for(int i=0; i<n; i++)
printf("%d ",arr[i]);
} | |
Mishka got an integer array $$$a$$$ of length $$$n$$$ as a birthday present (what a surprise!).Mishka doesn't like this present and wants to change it somehow. He has invented an algorithm and called it "Mishka's Adjacent Replacements Algorithm". This algorithm can be represented as a sequence of steps: Replace each o... | Print $$$n$$$ integers — $$$b_1, b_2, \dots, b_n$$$, where $$$b_i$$$ is the final value of the $$$i$$$-th element of the array after applying "Mishka's Adjacent Replacements Algorithm" to the array $$$a$$$. Note that you cannot change the order of elements in the array. | C | d00696cb27c679dda6e2e29314a8432b | 83447d9d484a125b1988ec79e6e4a0ce | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1531751700 | ["5\n1 2 4 5 10", "10\n10000 10 50605065 1 5 89 5 999999999 60506056 1000000000"] | NoteThe first example is described in the problem statement. | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer number $$$n$$$ ($$$1 \le n \le 1000$$$) — the number of elements in Mishka's birthday present (surprisingly, an array). The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) — the elements of the array. | ["1 1 3 5 9", "9999 9 50605065 1 5 89 5 999999999 60506055 999999999"] | #include <stdio.h>
int main() {
int n,k,i;
scanf("%d",&n);
int a[n];
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
if(a[i]%2==0)
a[i] -=1;
}
for(i=0;i<n;i++)
{
printf("%d ",a[i]);
}
return 0;
} | |
Mishka got an integer array $$$a$$$ of length $$$n$$$ as a birthday present (what a surprise!).Mishka doesn't like this present and wants to change it somehow. He has invented an algorithm and called it "Mishka's Adjacent Replacements Algorithm". This algorithm can be represented as a sequence of steps: Replace each o... | Print $$$n$$$ integers — $$$b_1, b_2, \dots, b_n$$$, where $$$b_i$$$ is the final value of the $$$i$$$-th element of the array after applying "Mishka's Adjacent Replacements Algorithm" to the array $$$a$$$. Note that you cannot change the order of elements in the array. | C | d00696cb27c679dda6e2e29314a8432b | 574505b89fcf29390f23c06c6da2b3fb | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1531751700 | ["5\n1 2 4 5 10", "10\n10000 10 50605065 1 5 89 5 999999999 60506056 1000000000"] | NoteThe first example is described in the problem statement. | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer number $$$n$$$ ($$$1 \le n \le 1000$$$) — the number of elements in Mishka's birthday present (surprisingly, an array). The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) — the elements of the array. | ["1 1 3 5 9", "9999 9 50605065 1 5 89 5 999999999 60506055 999999999"] | #include<stdio.h>
int main()
{
int i,j,k,t,a[1002];
scanf("%d",&t);
for(i=0; i<t; i++)
{
scanf("%d",&a[i]);
if(a[i]%2==0)
{
a[i]-=1;
}
}
for(i=0;i<t;i++)
{
printf("%d ",a[i]);
}
return 0;
}
| |
Mishka got an integer array $$$a$$$ of length $$$n$$$ as a birthday present (what a surprise!).Mishka doesn't like this present and wants to change it somehow. He has invented an algorithm and called it "Mishka's Adjacent Replacements Algorithm". This algorithm can be represented as a sequence of steps: Replace each o... | Print $$$n$$$ integers — $$$b_1, b_2, \dots, b_n$$$, where $$$b_i$$$ is the final value of the $$$i$$$-th element of the array after applying "Mishka's Adjacent Replacements Algorithm" to the array $$$a$$$. Note that you cannot change the order of elements in the array. | C | d00696cb27c679dda6e2e29314a8432b | f59d958464b71cf774ae9dcc9b70dda3 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1531751700 | ["5\n1 2 4 5 10", "10\n10000 10 50605065 1 5 89 5 999999999 60506056 1000000000"] | NoteThe first example is described in the problem statement. | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer number $$$n$$$ ($$$1 \le n \le 1000$$$) — the number of elements in Mishka's birthday present (surprisingly, an array). The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) — the elements of the array. | ["1 1 3 5 9", "9999 9 50605065 1 5 89 5 999999999 60506055 999999999"] | #include<stdio.h>
int main()
{
int i,j,k,n;
scanf("%d",&n);
long int a[n];
for(i=0;i<n;i++){
scanf("%ld",&a[i]);
}
for(i=0;i<n;i++){
if(a[i]%2==0)
printf("%ld ",a[i]-1);
else
printf("%ld ",a[i]);
}
return 0;
}
| |
Mishka got an integer array $$$a$$$ of length $$$n$$$ as a birthday present (what a surprise!).Mishka doesn't like this present and wants to change it somehow. He has invented an algorithm and called it "Mishka's Adjacent Replacements Algorithm". This algorithm can be represented as a sequence of steps: Replace each o... | Print $$$n$$$ integers — $$$b_1, b_2, \dots, b_n$$$, where $$$b_i$$$ is the final value of the $$$i$$$-th element of the array after applying "Mishka's Adjacent Replacements Algorithm" to the array $$$a$$$. Note that you cannot change the order of elements in the array. | C | d00696cb27c679dda6e2e29314a8432b | 069e9554ecdc763cc49871199f5ae54e | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1531751700 | ["5\n1 2 4 5 10", "10\n10000 10 50605065 1 5 89 5 999999999 60506056 1000000000"] | NoteThe first example is described in the problem statement. | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer number $$$n$$$ ($$$1 \le n \le 1000$$$) — the number of elements in Mishka's birthday present (surprisingly, an array). The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) — the elements of the array. | ["1 1 3 5 9", "9999 9 50605065 1 5 89 5 999999999 60506055 999999999"] | #include<stdio.h>
int main ()
{
int n;
int a[1000];
scanf("%d", &n);
for (int i = 0; i < n; i++)
{
scanf("%d", &a[i]);
if (a[i] % 2 == 0)
a[i]--;
}
for (int i = 0; i < n; i++)
printf("%d ", a[i]);
return 0 ;
}
| |
Mishka got an integer array $$$a$$$ of length $$$n$$$ as a birthday present (what a surprise!).Mishka doesn't like this present and wants to change it somehow. He has invented an algorithm and called it "Mishka's Adjacent Replacements Algorithm". This algorithm can be represented as a sequence of steps: Replace each o... | Print $$$n$$$ integers — $$$b_1, b_2, \dots, b_n$$$, where $$$b_i$$$ is the final value of the $$$i$$$-th element of the array after applying "Mishka's Adjacent Replacements Algorithm" to the array $$$a$$$. Note that you cannot change the order of elements in the array. | C | d00696cb27c679dda6e2e29314a8432b | 24b28a0f8fdb3ad719bda84b16af3e60 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1531751700 | ["5\n1 2 4 5 10", "10\n10000 10 50605065 1 5 89 5 999999999 60506056 1000000000"] | NoteThe first example is described in the problem statement. | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer number $$$n$$$ ($$$1 \le n \le 1000$$$) — the number of elements in Mishka's birthday present (surprisingly, an array). The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) — the elements of the array. | ["1 1 3 5 9", "9999 9 50605065 1 5 89 5 999999999 60506055 999999999"] | #include<stdio.h>
int main()
{
int n,i;
scanf("%d",&n);
long int arr[n];
for(i=0;i<n;i++)
{
scanf("%ld",&arr[i]);
if(arr[i]%2==0)
arr[i]= arr[i]-1;
}
for(i=0;i<n;i++)
printf(" %ld",arr[i]);
return 0;
} | |
Mishka got an integer array $$$a$$$ of length $$$n$$$ as a birthday present (what a surprise!).Mishka doesn't like this present and wants to change it somehow. He has invented an algorithm and called it "Mishka's Adjacent Replacements Algorithm". This algorithm can be represented as a sequence of steps: Replace each o... | Print $$$n$$$ integers — $$$b_1, b_2, \dots, b_n$$$, where $$$b_i$$$ is the final value of the $$$i$$$-th element of the array after applying "Mishka's Adjacent Replacements Algorithm" to the array $$$a$$$. Note that you cannot change the order of elements in the array. | C | d00696cb27c679dda6e2e29314a8432b | ff092e8743cc7ce14554fec09572fbdd | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1531751700 | ["5\n1 2 4 5 10", "10\n10000 10 50605065 1 5 89 5 999999999 60506056 1000000000"] | NoteThe first example is described in the problem statement. | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer number $$$n$$$ ($$$1 \le n \le 1000$$$) — the number of elements in Mishka's birthday present (surprisingly, an array). The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) — the elements of the array. | ["1 1 3 5 9", "9999 9 50605065 1 5 89 5 999999999 60506055 999999999"] | #include<stdio.h>
int main(){
int n,i;
scanf("%d",&n);
int a[1000];
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<n;i++){
if(a[i]%2==0)
printf("%d ",a[i]-1);
else
printf("%d ",a[i]);
}
return 0;
}
| |
Mishka got an integer array $$$a$$$ of length $$$n$$$ as a birthday present (what a surprise!).Mishka doesn't like this present and wants to change it somehow. He has invented an algorithm and called it "Mishka's Adjacent Replacements Algorithm". This algorithm can be represented as a sequence of steps: Replace each o... | Print $$$n$$$ integers — $$$b_1, b_2, \dots, b_n$$$, where $$$b_i$$$ is the final value of the $$$i$$$-th element of the array after applying "Mishka's Adjacent Replacements Algorithm" to the array $$$a$$$. Note that you cannot change the order of elements in the array. | C | d00696cb27c679dda6e2e29314a8432b | 1d17c3d0f6fdb8890d29b24bef6ff8fe | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1531751700 | ["5\n1 2 4 5 10", "10\n10000 10 50605065 1 5 89 5 999999999 60506056 1000000000"] | NoteThe first example is described in the problem statement. | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer number $$$n$$$ ($$$1 \le n \le 1000$$$) — the number of elements in Mishka's birthday present (surprisingly, an array). The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) — the elements of the array. | ["1 1 3 5 9", "9999 9 50605065 1 5 89 5 999999999 60506055 999999999"] | #include<stdio.h>
int main(){
int n,i;
scanf("%d",&n);
int a[1000];
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<n;i++){
if(a[i]%2==0)
printf("%d ",a[i]-1);
else
printf("%d ",a[i]);
}
return 0;
}
| |
Mishka got an integer array $$$a$$$ of length $$$n$$$ as a birthday present (what a surprise!).Mishka doesn't like this present and wants to change it somehow. He has invented an algorithm and called it "Mishka's Adjacent Replacements Algorithm". This algorithm can be represented as a sequence of steps: Replace each o... | Print $$$n$$$ integers — $$$b_1, b_2, \dots, b_n$$$, where $$$b_i$$$ is the final value of the $$$i$$$-th element of the array after applying "Mishka's Adjacent Replacements Algorithm" to the array $$$a$$$. Note that you cannot change the order of elements in the array. | C | d00696cb27c679dda6e2e29314a8432b | 6eb340c04277008b21e8e6fb07bb6e76 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1531751700 | ["5\n1 2 4 5 10", "10\n10000 10 50605065 1 5 89 5 999999999 60506056 1000000000"] | NoteThe first example is described in the problem statement. | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer number $$$n$$$ ($$$1 \le n \le 1000$$$) — the number of elements in Mishka's birthday present (surprisingly, an array). The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) — the elements of the array. | ["1 1 3 5 9", "9999 9 50605065 1 5 89 5 999999999 60506055 999999999"] | #include <stdio.h>
int main(void) {
int t;
scanf("%d",&t);
while(t--)
{
long n;
scanf("%ld",&n);
n -= (!(n%2));
printf("%ld ",n);
}
return 0;
} | |
Mishka got an integer array $$$a$$$ of length $$$n$$$ as a birthday present (what a surprise!).Mishka doesn't like this present and wants to change it somehow. He has invented an algorithm and called it "Mishka's Adjacent Replacements Algorithm". This algorithm can be represented as a sequence of steps: Replace each o... | Print $$$n$$$ integers — $$$b_1, b_2, \dots, b_n$$$, where $$$b_i$$$ is the final value of the $$$i$$$-th element of the array after applying "Mishka's Adjacent Replacements Algorithm" to the array $$$a$$$. Note that you cannot change the order of elements in the array. | C | d00696cb27c679dda6e2e29314a8432b | 717d4610cf378880be989e5adf61ec15 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1531751700 | ["5\n1 2 4 5 10", "10\n10000 10 50605065 1 5 89 5 999999999 60506056 1000000000"] | NoteThe first example is described in the problem statement. | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer number $$$n$$$ ($$$1 \le n \le 1000$$$) — the number of elements in Mishka's birthday present (surprisingly, an array). The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) — the elements of the array. | ["1 1 3 5 9", "9999 9 50605065 1 5 89 5 999999999 60506055 999999999"] | #include <stdio.h>
#define MAXN 1000
int main() {
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
int a, p;
scanf("%d", &a);
printf("%d ", a - (a + 1) % 2);
}
} | |
Mishka got an integer array $$$a$$$ of length $$$n$$$ as a birthday present (what a surprise!).Mishka doesn't like this present and wants to change it somehow. He has invented an algorithm and called it "Mishka's Adjacent Replacements Algorithm". This algorithm can be represented as a sequence of steps: Replace each o... | Print $$$n$$$ integers — $$$b_1, b_2, \dots, b_n$$$, where $$$b_i$$$ is the final value of the $$$i$$$-th element of the array after applying "Mishka's Adjacent Replacements Algorithm" to the array $$$a$$$. Note that you cannot change the order of elements in the array. | C | d00696cb27c679dda6e2e29314a8432b | 3d7cd79f6cfd0bfbf35a26958e9155d4 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1531751700 | ["5\n1 2 4 5 10", "10\n10000 10 50605065 1 5 89 5 999999999 60506056 1000000000"] | NoteThe first example is described in the problem statement. | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer number $$$n$$$ ($$$1 \le n \le 1000$$$) — the number of elements in Mishka's birthday present (surprisingly, an array). The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) — the elements of the array. | ["1 1 3 5 9", "9999 9 50605065 1 5 89 5 999999999 60506055 999999999"] | #include<stdio.h>
int main(){
long long int a[1010],b[1010],n,i;
scanf("%lld",&n);
for(i=0;i<n;i++){
scanf("%lld",&a[i]);
if(a[i]%2==0){
b[i]=a[i]-1;
}
else{
b[i]=a[i];
}
}
for(i=0;i<n;i++){
printf("%lld ",b[i]);
}
return 0;
}
| |
Mishka got an integer array $$$a$$$ of length $$$n$$$ as a birthday present (what a surprise!).Mishka doesn't like this present and wants to change it somehow. He has invented an algorithm and called it "Mishka's Adjacent Replacements Algorithm". This algorithm can be represented as a sequence of steps: Replace each o... | Print $$$n$$$ integers — $$$b_1, b_2, \dots, b_n$$$, where $$$b_i$$$ is the final value of the $$$i$$$-th element of the array after applying "Mishka's Adjacent Replacements Algorithm" to the array $$$a$$$. Note that you cannot change the order of elements in the array. | C | d00696cb27c679dda6e2e29314a8432b | 7eef14be971c4d5a365c73f6b9620805 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1531751700 | ["5\n1 2 4 5 10", "10\n10000 10 50605065 1 5 89 5 999999999 60506056 1000000000"] | NoteThe first example is described in the problem statement. | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer number $$$n$$$ ($$$1 \le n \le 1000$$$) — the number of elements in Mishka's birthday present (surprisingly, an array). The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) — the elements of the array. | ["1 1 3 5 9", "9999 9 50605065 1 5 89 5 999999999 60506055 999999999"] | #include<stdio.h>
int main() {
int i, j, n;
scanf ("%d", &n);
long int a[n];
for (i=0; i<n; i++) {
scanf("%ld", &a[i]);
}
for (i=0; i<n; i++) {
if (a[i]%2==0) {
a[i]= a[i]-1;
}
printf ("%ld ",a[i]);
}
} | |
Mishka got an integer array $$$a$$$ of length $$$n$$$ as a birthday present (what a surprise!).Mishka doesn't like this present and wants to change it somehow. He has invented an algorithm and called it "Mishka's Adjacent Replacements Algorithm". This algorithm can be represented as a sequence of steps: Replace each o... | Print $$$n$$$ integers — $$$b_1, b_2, \dots, b_n$$$, where $$$b_i$$$ is the final value of the $$$i$$$-th element of the array after applying "Mishka's Adjacent Replacements Algorithm" to the array $$$a$$$. Note that you cannot change the order of elements in the array. | C | d00696cb27c679dda6e2e29314a8432b | dc5b600a4555d9d432a5fa6fa71ac624 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1531751700 | ["5\n1 2 4 5 10", "10\n10000 10 50605065 1 5 89 5 999999999 60506056 1000000000"] | NoteThe first example is described in the problem statement. | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer number $$$n$$$ ($$$1 \le n \le 1000$$$) — the number of elements in Mishka's birthday present (surprisingly, an array). The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) — the elements of the array. | ["1 1 3 5 9", "9999 9 50605065 1 5 89 5 999999999 60506055 999999999"] | #include <stdio.h>
int main(){
int n;
int num;
scanf("%d",&n);
while(n--){
scanf("%d",&num);
if(num%2 == 0)
printf("%d ",num-1);
else
printf("%d ",num);
}
printf("\n");
} | |
Mishka got an integer array $$$a$$$ of length $$$n$$$ as a birthday present (what a surprise!).Mishka doesn't like this present and wants to change it somehow. He has invented an algorithm and called it "Mishka's Adjacent Replacements Algorithm". This algorithm can be represented as a sequence of steps: Replace each o... | Print $$$n$$$ integers — $$$b_1, b_2, \dots, b_n$$$, where $$$b_i$$$ is the final value of the $$$i$$$-th element of the array after applying "Mishka's Adjacent Replacements Algorithm" to the array $$$a$$$. Note that you cannot change the order of elements in the array. | C | d00696cb27c679dda6e2e29314a8432b | 10483092ce4f2fd2f33f4fb0cfe74221 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1531751700 | ["5\n1 2 4 5 10", "10\n10000 10 50605065 1 5 89 5 999999999 60506056 1000000000"] | NoteThe first example is described in the problem statement. | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer number $$$n$$$ ($$$1 \le n \le 1000$$$) — the number of elements in Mishka's birthday present (surprisingly, an array). The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) — the elements of the array. | ["1 1 3 5 9", "9999 9 50605065 1 5 89 5 999999999 60506055 999999999"] | #include<stdio.h>
int main(){
int n,i;
scanf("%d",&n);
int a[n];
for(i=0;i<n;i++){
scanf("%d",&a[i]);
if(a[i]%2==0){
a[i]=a[i]-1;
}
}
printf("%d",a[0]);
for(i=1;i<n;i++){
printf(" %d",a[i]);
}
printf("\n");
return 0;
}
| |
Mishka got an integer array $$$a$$$ of length $$$n$$$ as a birthday present (what a surprise!).Mishka doesn't like this present and wants to change it somehow. He has invented an algorithm and called it "Mishka's Adjacent Replacements Algorithm". This algorithm can be represented as a sequence of steps: Replace each o... | Print $$$n$$$ integers — $$$b_1, b_2, \dots, b_n$$$, where $$$b_i$$$ is the final value of the $$$i$$$-th element of the array after applying "Mishka's Adjacent Replacements Algorithm" to the array $$$a$$$. Note that you cannot change the order of elements in the array. | C | d00696cb27c679dda6e2e29314a8432b | 68f3fee7b9266b118fdc3fe3669156de | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1531751700 | ["5\n1 2 4 5 10", "10\n10000 10 50605065 1 5 89 5 999999999 60506056 1000000000"] | NoteThe first example is described in the problem statement. | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer number $$$n$$$ ($$$1 \le n \le 1000$$$) — the number of elements in Mishka's birthday present (surprisingly, an array). The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) — the elements of the array. | ["1 1 3 5 9", "9999 9 50605065 1 5 89 5 999999999 60506055 999999999"] | #include<stdio.h>
int main(){
int n,i;
scanf("%d",&n);
int a[n];
for(i=0;i<n;i++){
scanf("%d",&a[i]);
if(a[i]%2==0){
a[i]=a[i]-1;
}
}
printf("%d",a[0]);
for(i=1;i<n;i++){
printf(" %d",a[i]);
}
printf("\n");
return 0;
}
| |
Mishka got an integer array $$$a$$$ of length $$$n$$$ as a birthday present (what a surprise!).Mishka doesn't like this present and wants to change it somehow. He has invented an algorithm and called it "Mishka's Adjacent Replacements Algorithm". This algorithm can be represented as a sequence of steps: Replace each o... | Print $$$n$$$ integers — $$$b_1, b_2, \dots, b_n$$$, where $$$b_i$$$ is the final value of the $$$i$$$-th element of the array after applying "Mishka's Adjacent Replacements Algorithm" to the array $$$a$$$. Note that you cannot change the order of elements in the array. | C | d00696cb27c679dda6e2e29314a8432b | 94da7e50ac2b21f11c52b1e4b2542b4b | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1531751700 | ["5\n1 2 4 5 10", "10\n10000 10 50605065 1 5 89 5 999999999 60506056 1000000000"] | NoteThe first example is described in the problem statement. | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer number $$$n$$$ ($$$1 \le n \le 1000$$$) — the number of elements in Mishka's birthday present (surprisingly, an array). The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) — the elements of the array. | ["1 1 3 5 9", "9999 9 50605065 1 5 89 5 999999999 60506055 999999999"] | #include<stdio.h>
#include<stdlib.h>
int main()
{
int n,i,j,max=-1;
scanf("%d",&n);
int *a=(int*)malloc(sizeof(int)*n);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
if(max<a[i])
max=a[i];
}
for(i=0;i<n;i++)
{
/*int ele;
if(i%2==0)
ele=i-1;
else ele=i+1;
for(j=0;j<n;j++)
{
if(a[j]==i)
... | |
Mishka got an integer array $$$a$$$ of length $$$n$$$ as a birthday present (what a surprise!).Mishka doesn't like this present and wants to change it somehow. He has invented an algorithm and called it "Mishka's Adjacent Replacements Algorithm". This algorithm can be represented as a sequence of steps: Replace each o... | Print $$$n$$$ integers — $$$b_1, b_2, \dots, b_n$$$, where $$$b_i$$$ is the final value of the $$$i$$$-th element of the array after applying "Mishka's Adjacent Replacements Algorithm" to the array $$$a$$$. Note that you cannot change the order of elements in the array. | C | d00696cb27c679dda6e2e29314a8432b | d0edc9cd35d50159cd26a11a56e7c5b5 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1531751700 | ["5\n1 2 4 5 10", "10\n10000 10 50605065 1 5 89 5 999999999 60506056 1000000000"] | NoteThe first example is described in the problem statement. | PASSED | 800 | standard input | 1 second | The first line of the input contains one integer number $$$n$$$ ($$$1 \le n \le 1000$$$) — the number of elements in Mishka's birthday present (surprisingly, an array). The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) — the elements of the array. | ["1 1 3 5 9", "9999 9 50605065 1 5 89 5 999999999 60506055 999999999"] | #include<stdlib.h>
#include <stdio.h>
#include<string.h>
int main(void) {
unsigned long long int n,i;
scanf("%llu",&n);
unsigned long long int a[1000005];
for(i=1;i<=n;i++)
{
scanf("%llu",&a[i]);
if(a[i]%2==0)
{
a[i]=a[i]-1;
}
else
{
a[i]=a[i];
}
printf("%llu "... | |
Each day in Berland consists of $$$n$$$ hours. Polycarp likes time management. That's why he has a fixed schedule for each day — it is a sequence $$$a_1, a_2, \dots, a_n$$$ (each $$$a_i$$$ is either $$$0$$$ or $$$1$$$), where $$$a_i=0$$$ if Polycarp works during the $$$i$$$-th hour of the day and $$$a_i=1$$$ if Polycar... | Print the maximal number of continuous hours during which Polycarp rests. Remember that you should consider that days go one after another endlessly and Polycarp uses the same schedule for each day. | C | fcd88c7b64da4b839cda4273d928429d | 25fa2efff54a9744b985f1cd96f5e6ef | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553006100 | ["5\n1 0 1 0 1", "6\n0 1 0 1 1 0", "7\n1 0 1 1 1 0 1", "3\n0 0 0"] | NoteIn the first example, the maximal rest starts in last hour and goes to the first hour of the next day.In the second example, Polycarp has maximal rest from the $$$4$$$-th to the $$$5$$$-th hour.In the third example, Polycarp has maximal rest from the $$$3$$$-rd to the $$$5$$$-th hour.In the fourth example, Polycarp... | PASSED | 900 | standard input | 2 seconds | The first line contains $$$n$$$ ($$$1 \le n \le 2\cdot10^5$$$) — number of hours per day. The second line contains $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 1$$$), where $$$a_i=0$$$ if the $$$i$$$-th hour in a day is working and $$$a_i=1$$$ if the $$$i$$$-th hour is resting. It is guaranteed ... | ["2", "2", "3", "0"] | # include<stdio.h>
int a[200005];
int main()
{
int i,n,ans = 1,flag = 0;
scanf("%d",&n);
for( i = 0;i<n;++i)
scanf("%d",&a[i]);
int max = 0;
for(i=0;i<n;++i)
{
if(a[i] == 1)
flag = 1;
}
for(i = 0;i<n-1;++i)
{
if(a[i] == 1 && a[i+1] == 1)
{
ans++;
flag =1;
if(ans > max)
max... | |
Each day in Berland consists of $$$n$$$ hours. Polycarp likes time management. That's why he has a fixed schedule for each day — it is a sequence $$$a_1, a_2, \dots, a_n$$$ (each $$$a_i$$$ is either $$$0$$$ or $$$1$$$), where $$$a_i=0$$$ if Polycarp works during the $$$i$$$-th hour of the day and $$$a_i=1$$$ if Polycar... | Print the maximal number of continuous hours during which Polycarp rests. Remember that you should consider that days go one after another endlessly and Polycarp uses the same schedule for each day. | C | fcd88c7b64da4b839cda4273d928429d | dc1ef1255daab7e112eb2dd45b9626c4 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553006100 | ["5\n1 0 1 0 1", "6\n0 1 0 1 1 0", "7\n1 0 1 1 1 0 1", "3\n0 0 0"] | NoteIn the first example, the maximal rest starts in last hour and goes to the first hour of the next day.In the second example, Polycarp has maximal rest from the $$$4$$$-th to the $$$5$$$-th hour.In the third example, Polycarp has maximal rest from the $$$3$$$-rd to the $$$5$$$-th hour.In the fourth example, Polycarp... | PASSED | 900 | standard input | 2 seconds | The first line contains $$$n$$$ ($$$1 \le n \le 2\cdot10^5$$$) — number of hours per day. The second line contains $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 1$$$), where $$$a_i=0$$$ if the $$$i$$$-th hour in a day is working and $$$a_i=1$$$ if the $$$i$$$-th hour is resting. It is guaranteed ... | ["2", "2", "3", "0"] | #include<stdio.h>
int main()
{
int i,n,a[500000],len = 0,max = 0;
scanf("%d",&n);
for(i = 0; i < n; i++)
{
scanf("%d",&a[i]);
}
for(i = 0; i < 2*n; i++)
{
if(a[i%n] == 1)
{
len++;
}
if(a[i%n] == 0)
{
len = 0;
}
... | |
Each day in Berland consists of $$$n$$$ hours. Polycarp likes time management. That's why he has a fixed schedule for each day — it is a sequence $$$a_1, a_2, \dots, a_n$$$ (each $$$a_i$$$ is either $$$0$$$ or $$$1$$$), where $$$a_i=0$$$ if Polycarp works during the $$$i$$$-th hour of the day and $$$a_i=1$$$ if Polycar... | Print the maximal number of continuous hours during which Polycarp rests. Remember that you should consider that days go one after another endlessly and Polycarp uses the same schedule for each day. | C | fcd88c7b64da4b839cda4273d928429d | 37c4136f40d6ff3c3d157ff5a19d24c6 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553006100 | ["5\n1 0 1 0 1", "6\n0 1 0 1 1 0", "7\n1 0 1 1 1 0 1", "3\n0 0 0"] | NoteIn the first example, the maximal rest starts in last hour and goes to the first hour of the next day.In the second example, Polycarp has maximal rest from the $$$4$$$-th to the $$$5$$$-th hour.In the third example, Polycarp has maximal rest from the $$$3$$$-rd to the $$$5$$$-th hour.In the fourth example, Polycarp... | PASSED | 900 | standard input | 2 seconds | The first line contains $$$n$$$ ($$$1 \le n \le 2\cdot10^5$$$) — number of hours per day. The second line contains $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 1$$$), where $$$a_i=0$$$ if the $$$i$$$-th hour in a day is working and $$$a_i=1$$$ if the $$$i$$$-th hour is resting. It is guaranteed ... | ["2", "2", "3", "0"] | #include<stdio.h>
int main(){
int n,i,arr[200009];
while(scanf("%d",&n)!=EOF){
for(i=1;i<=n;i++){
scanf("%d",&arr[i]);
}
int a=0,max=0;
for(i=1;i<=n;i++){
if(arr[i]==1){
a++;
if(a>max){
max=a;
... | |
Each day in Berland consists of $$$n$$$ hours. Polycarp likes time management. That's why he has a fixed schedule for each day — it is a sequence $$$a_1, a_2, \dots, a_n$$$ (each $$$a_i$$$ is either $$$0$$$ or $$$1$$$), where $$$a_i=0$$$ if Polycarp works during the $$$i$$$-th hour of the day and $$$a_i=1$$$ if Polycar... | Print the maximal number of continuous hours during which Polycarp rests. Remember that you should consider that days go one after another endlessly and Polycarp uses the same schedule for each day. | C | fcd88c7b64da4b839cda4273d928429d | 39b88e5df43235ac162acd580ea7821c | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553006100 | ["5\n1 0 1 0 1", "6\n0 1 0 1 1 0", "7\n1 0 1 1 1 0 1", "3\n0 0 0"] | NoteIn the first example, the maximal rest starts in last hour and goes to the first hour of the next day.In the second example, Polycarp has maximal rest from the $$$4$$$-th to the $$$5$$$-th hour.In the third example, Polycarp has maximal rest from the $$$3$$$-rd to the $$$5$$$-th hour.In the fourth example, Polycarp... | PASSED | 900 | standard input | 2 seconds | The first line contains $$$n$$$ ($$$1 \le n \le 2\cdot10^5$$$) — number of hours per day. The second line contains $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 1$$$), where $$$a_i=0$$$ if the $$$i$$$-th hour in a day is working and $$$a_i=1$$$ if the $$$i$$$-th hour is resting. It is guaranteed ... | ["2", "2", "3", "0"] | #include<stdio.h>
int main(){
long long n, arr[4000000], rest=0, x=0, i, j=0;
scanf("%I64d", &n);
for(i=0; i<n; i++) scanf("%I64d", &arr[i]);
for(i=0; i<n; i++){
if(arr[i]==1) {arr[n+j]=1; j++;}
else break;
}
n=n+j;
for(i=0; i<n; ){
if(arr[i]==1) {
x++;
i++;
}
else {
if(x>rest)r... | |
Each day in Berland consists of $$$n$$$ hours. Polycarp likes time management. That's why he has a fixed schedule for each day — it is a sequence $$$a_1, a_2, \dots, a_n$$$ (each $$$a_i$$$ is either $$$0$$$ or $$$1$$$), where $$$a_i=0$$$ if Polycarp works during the $$$i$$$-th hour of the day and $$$a_i=1$$$ if Polycar... | Print the maximal number of continuous hours during which Polycarp rests. Remember that you should consider that days go one after another endlessly and Polycarp uses the same schedule for each day. | C | fcd88c7b64da4b839cda4273d928429d | cc1706c752225482926a029d62a80bff | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553006100 | ["5\n1 0 1 0 1", "6\n0 1 0 1 1 0", "7\n1 0 1 1 1 0 1", "3\n0 0 0"] | NoteIn the first example, the maximal rest starts in last hour and goes to the first hour of the next day.In the second example, Polycarp has maximal rest from the $$$4$$$-th to the $$$5$$$-th hour.In the third example, Polycarp has maximal rest from the $$$3$$$-rd to the $$$5$$$-th hour.In the fourth example, Polycarp... | PASSED | 900 | standard input | 2 seconds | The first line contains $$$n$$$ ($$$1 \le n \le 2\cdot10^5$$$) — number of hours per day. The second line contains $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 1$$$), where $$$a_i=0$$$ if the $$$i$$$-th hour in a day is working and $$$a_i=1$$$ if the $$$i$$$-th hour is resting. It is guaranteed ... | ["2", "2", "3", "0"] | #include<stdio.h>
int main()
{
int n,i,c,m=0,m1=0,m2=0;
scanf("%d",&n);
int arr[n];
for(i=0; i<n; i++)
scanf("%d",&arr[i]);
for(i=0; i<n; i++)
{
if(arr[i]== 1)
{
while(arr[i]!= 0 && i< n)
{
m++;
i++;
}
... | |
Each day in Berland consists of $$$n$$$ hours. Polycarp likes time management. That's why he has a fixed schedule for each day — it is a sequence $$$a_1, a_2, \dots, a_n$$$ (each $$$a_i$$$ is either $$$0$$$ or $$$1$$$), where $$$a_i=0$$$ if Polycarp works during the $$$i$$$-th hour of the day and $$$a_i=1$$$ if Polycar... | Print the maximal number of continuous hours during which Polycarp rests. Remember that you should consider that days go one after another endlessly and Polycarp uses the same schedule for each day. | C | fcd88c7b64da4b839cda4273d928429d | 07a316feebb4465cf9bf3835a1069dd0 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553006100 | ["5\n1 0 1 0 1", "6\n0 1 0 1 1 0", "7\n1 0 1 1 1 0 1", "3\n0 0 0"] | NoteIn the first example, the maximal rest starts in last hour and goes to the first hour of the next day.In the second example, Polycarp has maximal rest from the $$$4$$$-th to the $$$5$$$-th hour.In the third example, Polycarp has maximal rest from the $$$3$$$-rd to the $$$5$$$-th hour.In the fourth example, Polycarp... | PASSED | 900 | standard input | 2 seconds | The first line contains $$$n$$$ ($$$1 \le n \le 2\cdot10^5$$$) — number of hours per day. The second line contains $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 1$$$), where $$$a_i=0$$$ if the $$$i$$$-th hour in a day is working and $$$a_i=1$$$ if the $$$i$$$-th hour is resting. It is guaranteed ... | ["2", "2", "3", "0"] | #include <stdio.h>
int count_max, count_begin, count_end, count;
int main()
{
int a[200001];
int n, i;
scanf("%d", &n);
a[n] = 0;
for (i=0; i<n; i++)
{
scanf("%d", &a[i]);
}
for (i=0; i<=n; i++)
{
if (a[i]==1)
{
count++;
... | |
Each day in Berland consists of $$$n$$$ hours. Polycarp likes time management. That's why he has a fixed schedule for each day — it is a sequence $$$a_1, a_2, \dots, a_n$$$ (each $$$a_i$$$ is either $$$0$$$ or $$$1$$$), where $$$a_i=0$$$ if Polycarp works during the $$$i$$$-th hour of the day and $$$a_i=1$$$ if Polycar... | Print the maximal number of continuous hours during which Polycarp rests. Remember that you should consider that days go one after another endlessly and Polycarp uses the same schedule for each day. | C | fcd88c7b64da4b839cda4273d928429d | 930896abfc50c6c1891ff79b7f087c6d | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553006100 | ["5\n1 0 1 0 1", "6\n0 1 0 1 1 0", "7\n1 0 1 1 1 0 1", "3\n0 0 0"] | NoteIn the first example, the maximal rest starts in last hour and goes to the first hour of the next day.In the second example, Polycarp has maximal rest from the $$$4$$$-th to the $$$5$$$-th hour.In the third example, Polycarp has maximal rest from the $$$3$$$-rd to the $$$5$$$-th hour.In the fourth example, Polycarp... | PASSED | 900 | standard input | 2 seconds | The first line contains $$$n$$$ ($$$1 \le n \le 2\cdot10^5$$$) — number of hours per day. The second line contains $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 1$$$), where $$$a_i=0$$$ if the $$$i$$$-th hour in a day is working and $$$a_i=1$$$ if the $$$i$$$-th hour is resting. It is guaranteed ... | ["2", "2", "3", "0"] | #include <stdio.h>
int main(){
int n,st=0,end=0,max=0,f=1,prev_a;
scanf("%i%i",&n,&prev_a);
if(prev_a==1){
st++;
end++;
max = end;
}
else
f=0;
n--;
while(n){
int a;
scanf("%i",&a);
if(a){
if(f){
st++;
... | |
Each day in Berland consists of $$$n$$$ hours. Polycarp likes time management. That's why he has a fixed schedule for each day — it is a sequence $$$a_1, a_2, \dots, a_n$$$ (each $$$a_i$$$ is either $$$0$$$ or $$$1$$$), where $$$a_i=0$$$ if Polycarp works during the $$$i$$$-th hour of the day and $$$a_i=1$$$ if Polycar... | Print the maximal number of continuous hours during which Polycarp rests. Remember that you should consider that days go one after another endlessly and Polycarp uses the same schedule for each day. | C | fcd88c7b64da4b839cda4273d928429d | 706681445af593c9653a2ddb7f9ab1f9 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553006100 | ["5\n1 0 1 0 1", "6\n0 1 0 1 1 0", "7\n1 0 1 1 1 0 1", "3\n0 0 0"] | NoteIn the first example, the maximal rest starts in last hour and goes to the first hour of the next day.In the second example, Polycarp has maximal rest from the $$$4$$$-th to the $$$5$$$-th hour.In the third example, Polycarp has maximal rest from the $$$3$$$-rd to the $$$5$$$-th hour.In the fourth example, Polycarp... | PASSED | 900 | standard input | 2 seconds | The first line contains $$$n$$$ ($$$1 \le n \le 2\cdot10^5$$$) — number of hours per day. The second line contains $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 1$$$), where $$$a_i=0$$$ if the $$$i$$$-th hour in a day is working and $$$a_i=1$$$ if the $$$i$$$-th hour is resting. It is guaranteed ... | ["2", "2", "3", "0"] | #include<stdio.h>
int main()
{
int n,i,c=1,j=0,m;
scanf("%d",&n);
int a[n];
int b[n];
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{if(a[i]==1 &&a[i+1]==1)
{
c++;
}
else{
c=1;
}
b[i]=c;
}
int p=0;
for(i=0;i<n;i++)
{
if(a[i]=... | |
Each day in Berland consists of $$$n$$$ hours. Polycarp likes time management. That's why he has a fixed schedule for each day — it is a sequence $$$a_1, a_2, \dots, a_n$$$ (each $$$a_i$$$ is either $$$0$$$ or $$$1$$$), where $$$a_i=0$$$ if Polycarp works during the $$$i$$$-th hour of the day and $$$a_i=1$$$ if Polycar... | Print the maximal number of continuous hours during which Polycarp rests. Remember that you should consider that days go one after another endlessly and Polycarp uses the same schedule for each day. | C | fcd88c7b64da4b839cda4273d928429d | a529c498ee703fc26ba9a974dcb08f34 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553006100 | ["5\n1 0 1 0 1", "6\n0 1 0 1 1 0", "7\n1 0 1 1 1 0 1", "3\n0 0 0"] | NoteIn the first example, the maximal rest starts in last hour and goes to the first hour of the next day.In the second example, Polycarp has maximal rest from the $$$4$$$-th to the $$$5$$$-th hour.In the third example, Polycarp has maximal rest from the $$$3$$$-rd to the $$$5$$$-th hour.In the fourth example, Polycarp... | PASSED | 900 | standard input | 2 seconds | The first line contains $$$n$$$ ($$$1 \le n \le 2\cdot10^5$$$) — number of hours per day. The second line contains $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 1$$$), where $$$a_i=0$$$ if the $$$i$$$-th hour in a day is working and $$$a_i=1$$$ if the $$$i$$$-th hour is resting. It is guaranteed ... | ["2", "2", "3", "0"] | #include<stdio.h>
int main()
{
int n,c=0,d=0,s,e=1,f=0,g=1;
scanf("%d",&n);
int a[n];
for(int i=0;i<n;++i)
scanf("%d",&a[i]);
for(int j=0;j<n;++j)
{
if(a[j]==1)
++c;
else
break;
}
for(int l=n-1;l>=0;--l)
{
if(a[l]==1)
++d;
... | |
Each day in Berland consists of $$$n$$$ hours. Polycarp likes time management. That's why he has a fixed schedule for each day — it is a sequence $$$a_1, a_2, \dots, a_n$$$ (each $$$a_i$$$ is either $$$0$$$ or $$$1$$$), where $$$a_i=0$$$ if Polycarp works during the $$$i$$$-th hour of the day and $$$a_i=1$$$ if Polycar... | Print the maximal number of continuous hours during which Polycarp rests. Remember that you should consider that days go one after another endlessly and Polycarp uses the same schedule for each day. | C | fcd88c7b64da4b839cda4273d928429d | f9ed6e3e9b547d11e5112816204f4d99 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553006100 | ["5\n1 0 1 0 1", "6\n0 1 0 1 1 0", "7\n1 0 1 1 1 0 1", "3\n0 0 0"] | NoteIn the first example, the maximal rest starts in last hour and goes to the first hour of the next day.In the second example, Polycarp has maximal rest from the $$$4$$$-th to the $$$5$$$-th hour.In the third example, Polycarp has maximal rest from the $$$3$$$-rd to the $$$5$$$-th hour.In the fourth example, Polycarp... | PASSED | 900 | standard input | 2 seconds | The first line contains $$$n$$$ ($$$1 \le n \le 2\cdot10^5$$$) — number of hours per day. The second line contains $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 1$$$), where $$$a_i=0$$$ if the $$$i$$$-th hour in a day is working and $$$a_i=1$$$ if the $$$i$$$-th hour is resting. It is guaranteed ... | ["2", "2", "3", "0"] | #include <stdio.h>
int main()
{
int i, len = 0, n, max = 0;
scanf("%d", &n);
int arr[n];
for(i = 0; i < n; i++)
scanf("%d", &arr[i]);
for(i = 0; i < 2 * n; i++)
{
if(arr[i % n])
{
len++;
if(len > max)
max = len;
}
el... | |
Each day in Berland consists of $$$n$$$ hours. Polycarp likes time management. That's why he has a fixed schedule for each day — it is a sequence $$$a_1, a_2, \dots, a_n$$$ (each $$$a_i$$$ is either $$$0$$$ or $$$1$$$), where $$$a_i=0$$$ if Polycarp works during the $$$i$$$-th hour of the day and $$$a_i=1$$$ if Polycar... | Print the maximal number of continuous hours during which Polycarp rests. Remember that you should consider that days go one after another endlessly and Polycarp uses the same schedule for each day. | C | fcd88c7b64da4b839cda4273d928429d | f1f64e4742124b1cc51b83cd3963713a | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553006100 | ["5\n1 0 1 0 1", "6\n0 1 0 1 1 0", "7\n1 0 1 1 1 0 1", "3\n0 0 0"] | NoteIn the first example, the maximal rest starts in last hour and goes to the first hour of the next day.In the second example, Polycarp has maximal rest from the $$$4$$$-th to the $$$5$$$-th hour.In the third example, Polycarp has maximal rest from the $$$3$$$-rd to the $$$5$$$-th hour.In the fourth example, Polycarp... | PASSED | 900 | standard input | 2 seconds | The first line contains $$$n$$$ ($$$1 \le n \le 2\cdot10^5$$$) — number of hours per day. The second line contains $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 1$$$), where $$$a_i=0$$$ if the $$$i$$$-th hour in a day is working and $$$a_i=1$$$ if the $$$i$$$-th hour is resting. It is guaranteed ... | ["2", "2", "3", "0"] | #include <stdio.h>
#define N 200000
int main() {
static int aa[N];
int n, i, cnt, max;
scanf("%d", &n);
for (i = 0; i < n; i++)
scanf("%d", &aa[i]);
cnt = 0;
for (i = 0; i < n && aa[i] == 1; i++)
cnt++;
for (i = n - 1; i >= 0 && aa[i] == 1; i--)
cnt++;
max = cnt;
cnt = 0;
for (i = 0; i < n; i++)
if... | |
Each day in Berland consists of $$$n$$$ hours. Polycarp likes time management. That's why he has a fixed schedule for each day — it is a sequence $$$a_1, a_2, \dots, a_n$$$ (each $$$a_i$$$ is either $$$0$$$ or $$$1$$$), where $$$a_i=0$$$ if Polycarp works during the $$$i$$$-th hour of the day and $$$a_i=1$$$ if Polycar... | Print the maximal number of continuous hours during which Polycarp rests. Remember that you should consider that days go one after another endlessly and Polycarp uses the same schedule for each day. | C | fcd88c7b64da4b839cda4273d928429d | 1edc4c4558056e92debdf8b18d88c07e | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553006100 | ["5\n1 0 1 0 1", "6\n0 1 0 1 1 0", "7\n1 0 1 1 1 0 1", "3\n0 0 0"] | NoteIn the first example, the maximal rest starts in last hour and goes to the first hour of the next day.In the second example, Polycarp has maximal rest from the $$$4$$$-th to the $$$5$$$-th hour.In the third example, Polycarp has maximal rest from the $$$3$$$-rd to the $$$5$$$-th hour.In the fourth example, Polycarp... | PASSED | 900 | standard input | 2 seconds | The first line contains $$$n$$$ ($$$1 \le n \le 2\cdot10^5$$$) — number of hours per day. The second line contains $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 1$$$), where $$$a_i=0$$$ if the $$$i$$$-th hour in a day is working and $$$a_i=1$$$ if the $$$i$$$-th hour is resting. It is guaranteed ... | ["2", "2", "3", "0"] | /* https://codeforces.com/contest/1141/submission/53826745 (Dukkha) */
#include <stdio.h>
#define N 200000
int main() {
static int aa[N];
int n, i, cnt, max;
scanf("%d", &n);
for (i = 0; i < n; i++)
scanf("%d", &aa[i]);
cnt = 0;
for (i = 0; i < n && aa[i] == 1; i++)
cnt++;
for (i = n - 1; i >= 0 && aa[i] ... | |
Each day in Berland consists of $$$n$$$ hours. Polycarp likes time management. That's why he has a fixed schedule for each day — it is a sequence $$$a_1, a_2, \dots, a_n$$$ (each $$$a_i$$$ is either $$$0$$$ or $$$1$$$), where $$$a_i=0$$$ if Polycarp works during the $$$i$$$-th hour of the day and $$$a_i=1$$$ if Polycar... | Print the maximal number of continuous hours during which Polycarp rests. Remember that you should consider that days go one after another endlessly and Polycarp uses the same schedule for each day. | C | fcd88c7b64da4b839cda4273d928429d | fc94cc822d90ec6d0b749b4197a7c524 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553006100 | ["5\n1 0 1 0 1", "6\n0 1 0 1 1 0", "7\n1 0 1 1 1 0 1", "3\n0 0 0"] | NoteIn the first example, the maximal rest starts in last hour and goes to the first hour of the next day.In the second example, Polycarp has maximal rest from the $$$4$$$-th to the $$$5$$$-th hour.In the third example, Polycarp has maximal rest from the $$$3$$$-rd to the $$$5$$$-th hour.In the fourth example, Polycarp... | PASSED | 900 | standard input | 2 seconds | The first line contains $$$n$$$ ($$$1 \le n \le 2\cdot10^5$$$) — number of hours per day. The second line contains $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 1$$$), where $$$a_i=0$$$ if the $$$i$$$-th hour in a day is working and $$$a_i=1$$$ if the $$$i$$$-th hour is resting. It is guaranteed ... | ["2", "2", "3", "0"] | #include<stdio.h>
main()
{
int i,j,num=0,flag=1,flag1=1,max=0;
long n;
scanf("%ld",&n);
int a[n];
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<n&&flag!=0;i++)
{
if(a[i]==1)
{
num++;
if(i==n-1)
{
i=-1;
flag1=0;
}
}
else
{
if(num>max)
max=num;
num=0;
if(flag1==0)
f... | |
Each day in Berland consists of $$$n$$$ hours. Polycarp likes time management. That's why he has a fixed schedule for each day — it is a sequence $$$a_1, a_2, \dots, a_n$$$ (each $$$a_i$$$ is either $$$0$$$ or $$$1$$$), where $$$a_i=0$$$ if Polycarp works during the $$$i$$$-th hour of the day and $$$a_i=1$$$ if Polycar... | Print the maximal number of continuous hours during which Polycarp rests. Remember that you should consider that days go one after another endlessly and Polycarp uses the same schedule for each day. | C | fcd88c7b64da4b839cda4273d928429d | 4b25ad359571104d8774c43cf43b8bfa | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553006100 | ["5\n1 0 1 0 1", "6\n0 1 0 1 1 0", "7\n1 0 1 1 1 0 1", "3\n0 0 0"] | NoteIn the first example, the maximal rest starts in last hour and goes to the first hour of the next day.In the second example, Polycarp has maximal rest from the $$$4$$$-th to the $$$5$$$-th hour.In the third example, Polycarp has maximal rest from the $$$3$$$-rd to the $$$5$$$-th hour.In the fourth example, Polycarp... | PASSED | 900 | standard input | 2 seconds | The first line contains $$$n$$$ ($$$1 \le n \le 2\cdot10^5$$$) — number of hours per day. The second line contains $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 1$$$), where $$$a_i=0$$$ if the $$$i$$$-th hour in a day is working and $$$a_i=1$$$ if the $$$i$$$-th hour is resting. It is guaranteed ... | ["2", "2", "3", "0"] | #include <stdio.h>
main()
{
int n;
scanf("%d",&n);
int a[n];
for(int i=0;i<n;i++)
scanf("%d",&a[i]);
int max=0;
int rest=0;
for(int i=0;i<n;i++)
{
if(a[i]==1)
{ rest++;
if(rest>max)
max=rest;
}
else if(a[i]==0)
{
if(rest>max)
max=rest;
rest=0;
}
}
if(a[n-1]==1 && a[0]==1)
{
i... | |
Each day in Berland consists of $$$n$$$ hours. Polycarp likes time management. That's why he has a fixed schedule for each day — it is a sequence $$$a_1, a_2, \dots, a_n$$$ (each $$$a_i$$$ is either $$$0$$$ or $$$1$$$), where $$$a_i=0$$$ if Polycarp works during the $$$i$$$-th hour of the day and $$$a_i=1$$$ if Polycar... | Print the maximal number of continuous hours during which Polycarp rests. Remember that you should consider that days go one after another endlessly and Polycarp uses the same schedule for each day. | C | fcd88c7b64da4b839cda4273d928429d | a8892c22738de9529ea7c6283f044db5 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553006100 | ["5\n1 0 1 0 1", "6\n0 1 0 1 1 0", "7\n1 0 1 1 1 0 1", "3\n0 0 0"] | NoteIn the first example, the maximal rest starts in last hour and goes to the first hour of the next day.In the second example, Polycarp has maximal rest from the $$$4$$$-th to the $$$5$$$-th hour.In the third example, Polycarp has maximal rest from the $$$3$$$-rd to the $$$5$$$-th hour.In the fourth example, Polycarp... | PASSED | 900 | standard input | 2 seconds | The first line contains $$$n$$$ ($$$1 \le n \le 2\cdot10^5$$$) — number of hours per day. The second line contains $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 1$$$), where $$$a_i=0$$$ if the $$$i$$$-th hour in a day is working and $$$a_i=1$$$ if the $$$i$$$-th hour is resting. It is guaranteed ... | ["2", "2", "3", "0"] | #include<stdio.h>
int main()
{
int n, x, i, f=0, c=0, y, z=0, k=0;
scanf("%d", &n);
for(i=0; i<n; i++)
{
scanf("%d", &x);
if(x==1)
{
c++;
f=1;
}
else
{
if(k==0){
y=c;
}
if(c>=z){
z=c;
}
c=0;
k=1;
f=0;
}
}
if(f==1 && c+y>z)
{
printf("%d", c+y);
}
else
{... | |
Each day in Berland consists of $$$n$$$ hours. Polycarp likes time management. That's why he has a fixed schedule for each day — it is a sequence $$$a_1, a_2, \dots, a_n$$$ (each $$$a_i$$$ is either $$$0$$$ or $$$1$$$), where $$$a_i=0$$$ if Polycarp works during the $$$i$$$-th hour of the day and $$$a_i=1$$$ if Polycar... | Print the maximal number of continuous hours during which Polycarp rests. Remember that you should consider that days go one after another endlessly and Polycarp uses the same schedule for each day. | C | fcd88c7b64da4b839cda4273d928429d | 760c59efb63890ee30c609890ddbfd08 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553006100 | ["5\n1 0 1 0 1", "6\n0 1 0 1 1 0", "7\n1 0 1 1 1 0 1", "3\n0 0 0"] | NoteIn the first example, the maximal rest starts in last hour and goes to the first hour of the next day.In the second example, Polycarp has maximal rest from the $$$4$$$-th to the $$$5$$$-th hour.In the third example, Polycarp has maximal rest from the $$$3$$$-rd to the $$$5$$$-th hour.In the fourth example, Polycarp... | PASSED | 900 | standard input | 2 seconds | The first line contains $$$n$$$ ($$$1 \le n \le 2\cdot10^5$$$) — number of hours per day. The second line contains $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 1$$$), where $$$a_i=0$$$ if the $$$i$$$-th hour in a day is working and $$$a_i=1$$$ if the $$$i$$$-th hour is resting. It is guaranteed ... | ["2", "2", "3", "0"] | #include <stdio.h>
#include <stdlib.h>
int main() {
int n,i,temp=0,max=0;
int *ptr;
scanf("%d",&n);
int arr[n];
for(i=0;i<n;i++){
scanf("%d",&arr[i]);
}
arr[i]=-1;
ptr=arr;
for(i=0;i<n*2;i++){
if(*ptr==-1)
ptr=arr;
if(*ptr==1){
temp++;
}
if(*ptr==0){
if(temp > max)
max=temp;
temp=0... | |
Each day in Berland consists of $$$n$$$ hours. Polycarp likes time management. That's why he has a fixed schedule for each day — it is a sequence $$$a_1, a_2, \dots, a_n$$$ (each $$$a_i$$$ is either $$$0$$$ or $$$1$$$), where $$$a_i=0$$$ if Polycarp works during the $$$i$$$-th hour of the day and $$$a_i=1$$$ if Polycar... | Print the maximal number of continuous hours during which Polycarp rests. Remember that you should consider that days go one after another endlessly and Polycarp uses the same schedule for each day. | C | fcd88c7b64da4b839cda4273d928429d | 0c121337b4c87c541acf0db6f3eb2392 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553006100 | ["5\n1 0 1 0 1", "6\n0 1 0 1 1 0", "7\n1 0 1 1 1 0 1", "3\n0 0 0"] | NoteIn the first example, the maximal rest starts in last hour and goes to the first hour of the next day.In the second example, Polycarp has maximal rest from the $$$4$$$-th to the $$$5$$$-th hour.In the third example, Polycarp has maximal rest from the $$$3$$$-rd to the $$$5$$$-th hour.In the fourth example, Polycarp... | PASSED | 900 | standard input | 2 seconds | The first line contains $$$n$$$ ($$$1 \le n \le 2\cdot10^5$$$) — number of hours per day. The second line contains $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 1$$$), where $$$a_i=0$$$ if the $$$i$$$-th hour in a day is working and $$$a_i=1$$$ if the $$$i$$$-th hour is resting. It is guaranteed ... | ["2", "2", "3", "0"] | #include <stdio.h>
#include <math.h>
int main()
{
int n,m,num=0,k=0,i,a[200000],head=0,end=0,max=0;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
if (a[0] == 1)num++;
for (i = 1; i < n; i++) {
if (a[i - 1] == 0) {
num = 0;
}
if (a[i] == 1)num++;
if (num > max)max = num;
}
if (a[0... | |
Each day in Berland consists of $$$n$$$ hours. Polycarp likes time management. That's why he has a fixed schedule for each day — it is a sequence $$$a_1, a_2, \dots, a_n$$$ (each $$$a_i$$$ is either $$$0$$$ or $$$1$$$), where $$$a_i=0$$$ if Polycarp works during the $$$i$$$-th hour of the day and $$$a_i=1$$$ if Polycar... | Print the maximal number of continuous hours during which Polycarp rests. Remember that you should consider that days go one after another endlessly and Polycarp uses the same schedule for each day. | C | fcd88c7b64da4b839cda4273d928429d | f3ef51aa6c269df28771b83c5b7eae4f | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553006100 | ["5\n1 0 1 0 1", "6\n0 1 0 1 1 0", "7\n1 0 1 1 1 0 1", "3\n0 0 0"] | NoteIn the first example, the maximal rest starts in last hour and goes to the first hour of the next day.In the second example, Polycarp has maximal rest from the $$$4$$$-th to the $$$5$$$-th hour.In the third example, Polycarp has maximal rest from the $$$3$$$-rd to the $$$5$$$-th hour.In the fourth example, Polycarp... | PASSED | 900 | standard input | 2 seconds | The first line contains $$$n$$$ ($$$1 \le n \le 2\cdot10^5$$$) — number of hours per day. The second line contains $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 1$$$), where $$$a_i=0$$$ if the $$$i$$$-th hour in a day is working and $$$a_i=1$$$ if the $$$i$$$-th hour is resting. It is guaranteed ... | ["2", "2", "3", "0"] | #include <stdio.h>
int main()
{
int n,count=0,max=0,flag=0;
scanf("%d",&n);
int a[n];
for(int i=0;i<n;i++)
{
scanf("%d",a+i);
}
for(int i=0;;i++)
{
if(i>=n)
{
flag=1;
i-=n;
}
if(a[i]==0)
{
if(count>max)
... | |
Each day in Berland consists of $$$n$$$ hours. Polycarp likes time management. That's why he has a fixed schedule for each day — it is a sequence $$$a_1, a_2, \dots, a_n$$$ (each $$$a_i$$$ is either $$$0$$$ or $$$1$$$), where $$$a_i=0$$$ if Polycarp works during the $$$i$$$-th hour of the day and $$$a_i=1$$$ if Polycar... | Print the maximal number of continuous hours during which Polycarp rests. Remember that you should consider that days go one after another endlessly and Polycarp uses the same schedule for each day. | C | fcd88c7b64da4b839cda4273d928429d | 2db895be23b1d16f0b6a9d53add474f0 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553006100 | ["5\n1 0 1 0 1", "6\n0 1 0 1 1 0", "7\n1 0 1 1 1 0 1", "3\n0 0 0"] | NoteIn the first example, the maximal rest starts in last hour and goes to the first hour of the next day.In the second example, Polycarp has maximal rest from the $$$4$$$-th to the $$$5$$$-th hour.In the third example, Polycarp has maximal rest from the $$$3$$$-rd to the $$$5$$$-th hour.In the fourth example, Polycarp... | PASSED | 900 | standard input | 2 seconds | The first line contains $$$n$$$ ($$$1 \le n \le 2\cdot10^5$$$) — number of hours per day. The second line contains $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 1$$$), where $$$a_i=0$$$ if the $$$i$$$-th hour in a day is working and $$$a_i=1$$$ if the $$$i$$$-th hour is resting. It is guaranteed ... | ["2", "2", "3", "0"] | #include <stdio.h>
int main()
{
int n,i,count=0,t=0;
scanf("%d",&n);
long int a[n+n];
for(i=0;i<n;i++)
{
scanf("%ld",&a[i]);
}
for(i=0;i<n;i++)
{
a[n+i]=a[i];
}
for (i=0;i<n+n;i++)
{
if(a[i]==1)
{
count=count+1;
if(t<count)
{
t=count;
... | |
Each day in Berland consists of $$$n$$$ hours. Polycarp likes time management. That's why he has a fixed schedule for each day — it is a sequence $$$a_1, a_2, \dots, a_n$$$ (each $$$a_i$$$ is either $$$0$$$ or $$$1$$$), where $$$a_i=0$$$ if Polycarp works during the $$$i$$$-th hour of the day and $$$a_i=1$$$ if Polycar... | Print the maximal number of continuous hours during which Polycarp rests. Remember that you should consider that days go one after another endlessly and Polycarp uses the same schedule for each day. | C | fcd88c7b64da4b839cda4273d928429d | d5b374dde9e1d07b30a588c85625ce92 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553006100 | ["5\n1 0 1 0 1", "6\n0 1 0 1 1 0", "7\n1 0 1 1 1 0 1", "3\n0 0 0"] | NoteIn the first example, the maximal rest starts in last hour and goes to the first hour of the next day.In the second example, Polycarp has maximal rest from the $$$4$$$-th to the $$$5$$$-th hour.In the third example, Polycarp has maximal rest from the $$$3$$$-rd to the $$$5$$$-th hour.In the fourth example, Polycarp... | PASSED | 900 | standard input | 2 seconds | The first line contains $$$n$$$ ($$$1 \le n \le 2\cdot10^5$$$) — number of hours per day. The second line contains $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 1$$$), where $$$a_i=0$$$ if the $$$i$$$-th hour in a day is working and $$$a_i=1$$$ if the $$$i$$$-th hour is resting. It is guaranteed ... | ["2", "2", "3", "0"] | #include<stdio.h>
int main(){
int i,j=0;
int n;
scanf("%d",&n);
int arr[n*2];
int count[n*2];
for(i=0;i<n;i++){
scanf("%d",&arr[i]);
arr[i+n]=arr[i];
count[i]=0;
}
arr[n]=arr[0];
count[n]=0;
for(i=0;i<=2*n;i++){
if(arr[i]==1){
count[j]++;
}
else{
j++;
}
}
int max=count[0];
for(i... | |
Each day in Berland consists of $$$n$$$ hours. Polycarp likes time management. That's why he has a fixed schedule for each day — it is a sequence $$$a_1, a_2, \dots, a_n$$$ (each $$$a_i$$$ is either $$$0$$$ or $$$1$$$), where $$$a_i=0$$$ if Polycarp works during the $$$i$$$-th hour of the day and $$$a_i=1$$$ if Polycar... | Print the maximal number of continuous hours during which Polycarp rests. Remember that you should consider that days go one after another endlessly and Polycarp uses the same schedule for each day. | C | fcd88c7b64da4b839cda4273d928429d | 3330502a6de8b8eb2c68d19253eeb68d | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553006100 | ["5\n1 0 1 0 1", "6\n0 1 0 1 1 0", "7\n1 0 1 1 1 0 1", "3\n0 0 0"] | NoteIn the first example, the maximal rest starts in last hour and goes to the first hour of the next day.In the second example, Polycarp has maximal rest from the $$$4$$$-th to the $$$5$$$-th hour.In the third example, Polycarp has maximal rest from the $$$3$$$-rd to the $$$5$$$-th hour.In the fourth example, Polycarp... | PASSED | 900 | standard input | 2 seconds | The first line contains $$$n$$$ ($$$1 \le n \le 2\cdot10^5$$$) — number of hours per day. The second line contains $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 1$$$), where $$$a_i=0$$$ if the $$$i$$$-th hour in a day is working and $$$a_i=1$$$ if the $$$i$$$-th hour is resting. It is guaranteed ... | ["2", "2", "3", "0"] | #include <stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
int main()
{
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int i, j, n;
scanf("%d", &n);
int a[n * 2 + 2], max = 0, c = 0, d = 0;
for (i = 0; i < n; i++)
scanf("%d", &a[i]);
for (i = ... | |
Each day in Berland consists of $$$n$$$ hours. Polycarp likes time management. That's why he has a fixed schedule for each day — it is a sequence $$$a_1, a_2, \dots, a_n$$$ (each $$$a_i$$$ is either $$$0$$$ or $$$1$$$), where $$$a_i=0$$$ if Polycarp works during the $$$i$$$-th hour of the day and $$$a_i=1$$$ if Polycar... | Print the maximal number of continuous hours during which Polycarp rests. Remember that you should consider that days go one after another endlessly and Polycarp uses the same schedule for each day. | C | fcd88c7b64da4b839cda4273d928429d | 92a492d1061ff1a0636c941e93679596 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553006100 | ["5\n1 0 1 0 1", "6\n0 1 0 1 1 0", "7\n1 0 1 1 1 0 1", "3\n0 0 0"] | NoteIn the first example, the maximal rest starts in last hour and goes to the first hour of the next day.In the second example, Polycarp has maximal rest from the $$$4$$$-th to the $$$5$$$-th hour.In the third example, Polycarp has maximal rest from the $$$3$$$-rd to the $$$5$$$-th hour.In the fourth example, Polycarp... | PASSED | 900 | standard input | 2 seconds | The first line contains $$$n$$$ ($$$1 \le n \le 2\cdot10^5$$$) — number of hours per day. The second line contains $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 1$$$), where $$$a_i=0$$$ if the $$$i$$$-th hour in a day is working and $$$a_i=1$$$ if the $$$i$$$-th hour is resting. It is guaranteed ... | ["2", "2", "3", "0"] | #include<stdio.h>
int main()
{
int h,i,j,k,l,c,p,v,ind=0;
scanf("%d",&h);
c = 0;
l = 0;
k = 0;
v = 0;
for(i=0;i<h;i++){
scanf("%d",&p);
if(p==1){
c = c + 1;
if(i==0){
k = 1;
}
else if(i+1==h){
... | |
Each day in Berland consists of $$$n$$$ hours. Polycarp likes time management. That's why he has a fixed schedule for each day — it is a sequence $$$a_1, a_2, \dots, a_n$$$ (each $$$a_i$$$ is either $$$0$$$ or $$$1$$$), where $$$a_i=0$$$ if Polycarp works during the $$$i$$$-th hour of the day and $$$a_i=1$$$ if Polycar... | Print the maximal number of continuous hours during which Polycarp rests. Remember that you should consider that days go one after another endlessly and Polycarp uses the same schedule for each day. | C | fcd88c7b64da4b839cda4273d928429d | 4d8c98814a2bb7ff71a2f032ff4efc4a | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553006100 | ["5\n1 0 1 0 1", "6\n0 1 0 1 1 0", "7\n1 0 1 1 1 0 1", "3\n0 0 0"] | NoteIn the first example, the maximal rest starts in last hour and goes to the first hour of the next day.In the second example, Polycarp has maximal rest from the $$$4$$$-th to the $$$5$$$-th hour.In the third example, Polycarp has maximal rest from the $$$3$$$-rd to the $$$5$$$-th hour.In the fourth example, Polycarp... | PASSED | 900 | standard input | 2 seconds | The first line contains $$$n$$$ ($$$1 \le n \le 2\cdot10^5$$$) — number of hours per day. The second line contains $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 1$$$), where $$$a_i=0$$$ if the $$$i$$$-th hour in a day is working and $$$a_i=1$$$ if the $$$i$$$-th hour is resting. It is guaranteed ... | ["2", "2", "3", "0"] | #include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
int a[n*2],c=0,d=0,i,j=n,m=n;
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
a[j] = a[i];
j++;
}
for(i=0;i<n*2;i++)
{
if(a[i]==1)
{
c = c+1;
if(c>d)
... | |
Each day in Berland consists of $$$n$$$ hours. Polycarp likes time management. That's why he has a fixed schedule for each day — it is a sequence $$$a_1, a_2, \dots, a_n$$$ (each $$$a_i$$$ is either $$$0$$$ or $$$1$$$), where $$$a_i=0$$$ if Polycarp works during the $$$i$$$-th hour of the day and $$$a_i=1$$$ if Polycar... | Print the maximal number of continuous hours during which Polycarp rests. Remember that you should consider that days go one after another endlessly and Polycarp uses the same schedule for each day. | C | fcd88c7b64da4b839cda4273d928429d | caf59cebf7009c46e83e76719d85319b | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553006100 | ["5\n1 0 1 0 1", "6\n0 1 0 1 1 0", "7\n1 0 1 1 1 0 1", "3\n0 0 0"] | NoteIn the first example, the maximal rest starts in last hour and goes to the first hour of the next day.In the second example, Polycarp has maximal rest from the $$$4$$$-th to the $$$5$$$-th hour.In the third example, Polycarp has maximal rest from the $$$3$$$-rd to the $$$5$$$-th hour.In the fourth example, Polycarp... | PASSED | 900 | standard input | 2 seconds | The first line contains $$$n$$$ ($$$1 \le n \le 2\cdot10^5$$$) — number of hours per day. The second line contains $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 1$$$), where $$$a_i=0$$$ if the $$$i$$$-th hour in a day is working and $$$a_i=1$$$ if the $$$i$$$-th hour is resting. It is guaranteed ... | ["2", "2", "3", "0"] | #include<stdio.h>
int main()
{
int i,n,a[200000],c=0,max=0;
scanf("%d",&n);
for(i=0;i<n;i++)scanf("%d",&a[i]);
for(i=0;i<n;i++)
{
if(a[i]==1)c++;
else
{
if(max<=c)max=c;
c=0;
}
}
if(a[n-1]==1)
{
for(i=0;a[i]==1;i++)c++;
}
if(max<=c)max=c;
printf("%d",max);
}
| |
Each day in Berland consists of $$$n$$$ hours. Polycarp likes time management. That's why he has a fixed schedule for each day — it is a sequence $$$a_1, a_2, \dots, a_n$$$ (each $$$a_i$$$ is either $$$0$$$ or $$$1$$$), where $$$a_i=0$$$ if Polycarp works during the $$$i$$$-th hour of the day and $$$a_i=1$$$ if Polycar... | Print the maximal number of continuous hours during which Polycarp rests. Remember that you should consider that days go one after another endlessly and Polycarp uses the same schedule for each day. | C | fcd88c7b64da4b839cda4273d928429d | 88da6ebd2df7f35387cf7d6198d990e9 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553006100 | ["5\n1 0 1 0 1", "6\n0 1 0 1 1 0", "7\n1 0 1 1 1 0 1", "3\n0 0 0"] | NoteIn the first example, the maximal rest starts in last hour and goes to the first hour of the next day.In the second example, Polycarp has maximal rest from the $$$4$$$-th to the $$$5$$$-th hour.In the third example, Polycarp has maximal rest from the $$$3$$$-rd to the $$$5$$$-th hour.In the fourth example, Polycarp... | PASSED | 900 | standard input | 2 seconds | The first line contains $$$n$$$ ($$$1 \le n \le 2\cdot10^5$$$) — number of hours per day. The second line contains $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 1$$$), where $$$a_i=0$$$ if the $$$i$$$-th hour in a day is working and $$$a_i=1$$$ if the $$$i$$$-th hour is resting. It is guaranteed ... | ["2", "2", "3", "0"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int n,i,count=0,j=0,a,k,temp,max=0;
int b[200001];
int c[200001];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&b[i]);
}
for(i=0;i<2*n;i++){
if(b[i%n]==1){
count++;
}
else{
if(count>m... | |
Each day in Berland consists of $$$n$$$ hours. Polycarp likes time management. That's why he has a fixed schedule for each day — it is a sequence $$$a_1, a_2, \dots, a_n$$$ (each $$$a_i$$$ is either $$$0$$$ or $$$1$$$), where $$$a_i=0$$$ if Polycarp works during the $$$i$$$-th hour of the day and $$$a_i=1$$$ if Polycar... | Print the maximal number of continuous hours during which Polycarp rests. Remember that you should consider that days go one after another endlessly and Polycarp uses the same schedule for each day. | C | fcd88c7b64da4b839cda4273d928429d | 6ca26a01643f3ef5daa3ce0f2c54e773 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553006100 | ["5\n1 0 1 0 1", "6\n0 1 0 1 1 0", "7\n1 0 1 1 1 0 1", "3\n0 0 0"] | NoteIn the first example, the maximal rest starts in last hour and goes to the first hour of the next day.In the second example, Polycarp has maximal rest from the $$$4$$$-th to the $$$5$$$-th hour.In the third example, Polycarp has maximal rest from the $$$3$$$-rd to the $$$5$$$-th hour.In the fourth example, Polycarp... | PASSED | 900 | standard input | 2 seconds | The first line contains $$$n$$$ ($$$1 \le n \le 2\cdot10^5$$$) — number of hours per day. The second line contains $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 1$$$), where $$$a_i=0$$$ if the $$$i$$$-th hour in a day is working and $$$a_i=1$$$ if the $$$i$$$-th hour is resting. It is guaranteed ... | ["2", "2", "3", "0"] | #include<stdio.h>
#include<stdlib.h>
int main(){
int n;
scanf("%d",&n);
int *a=(int *)malloc(sizeof(int)*n);
int i,j;
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
i=0;
int maxCounter=0;
int counter;
while(i<n){
j=i+1;
if(a[i]==1){
//printf("i = %d: "... | |
Each day in Berland consists of $$$n$$$ hours. Polycarp likes time management. That's why he has a fixed schedule for each day — it is a sequence $$$a_1, a_2, \dots, a_n$$$ (each $$$a_i$$$ is either $$$0$$$ or $$$1$$$), where $$$a_i=0$$$ if Polycarp works during the $$$i$$$-th hour of the day and $$$a_i=1$$$ if Polycar... | Print the maximal number of continuous hours during which Polycarp rests. Remember that you should consider that days go one after another endlessly and Polycarp uses the same schedule for each day. | C | fcd88c7b64da4b839cda4273d928429d | 6b07fa1c5164a4d60ed2421f2684722b | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553006100 | ["5\n1 0 1 0 1", "6\n0 1 0 1 1 0", "7\n1 0 1 1 1 0 1", "3\n0 0 0"] | NoteIn the first example, the maximal rest starts in last hour and goes to the first hour of the next day.In the second example, Polycarp has maximal rest from the $$$4$$$-th to the $$$5$$$-th hour.In the third example, Polycarp has maximal rest from the $$$3$$$-rd to the $$$5$$$-th hour.In the fourth example, Polycarp... | PASSED | 900 | standard input | 2 seconds | The first line contains $$$n$$$ ($$$1 \le n \le 2\cdot10^5$$$) — number of hours per day. The second line contains $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 1$$$), where $$$a_i=0$$$ if the $$$i$$$-th hour in a day is working and $$$a_i=1$$$ if the $$$i$$$-th hour is resting. It is guaranteed ... | ["2", "2", "3", "0"] | #include<stdio.h>
int main()
{
int a[200001];
int n,y=0,z=0;
int i;
scanf("%d",&n);
for(i=1;i<=n;i++)
scanf("%d",&a[i]);
int ans=0;
int x;
for(i=1;i<=n;i++)
{
if(a[i]==0)
{
x=0;
continue;
}
else
{
x++;
if(x>ans)
ans=x;
}
}
for(i=1;a[i]!=0;i++)
{
if(a[i]==1)
y++;
}
for(i=... | |
Each day in Berland consists of $$$n$$$ hours. Polycarp likes time management. That's why he has a fixed schedule for each day — it is a sequence $$$a_1, a_2, \dots, a_n$$$ (each $$$a_i$$$ is either $$$0$$$ or $$$1$$$), where $$$a_i=0$$$ if Polycarp works during the $$$i$$$-th hour of the day and $$$a_i=1$$$ if Polycar... | Print the maximal number of continuous hours during which Polycarp rests. Remember that you should consider that days go one after another endlessly and Polycarp uses the same schedule for each day. | C | fcd88c7b64da4b839cda4273d928429d | 6a6e11529b056afc923c3bcd9edd29b7 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553006100 | ["5\n1 0 1 0 1", "6\n0 1 0 1 1 0", "7\n1 0 1 1 1 0 1", "3\n0 0 0"] | NoteIn the first example, the maximal rest starts in last hour and goes to the first hour of the next day.In the second example, Polycarp has maximal rest from the $$$4$$$-th to the $$$5$$$-th hour.In the third example, Polycarp has maximal rest from the $$$3$$$-rd to the $$$5$$$-th hour.In the fourth example, Polycarp... | PASSED | 900 | standard input | 2 seconds | The first line contains $$$n$$$ ($$$1 \le n \le 2\cdot10^5$$$) — number of hours per day. The second line contains $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 1$$$), where $$$a_i=0$$$ if the $$$i$$$-th hour in a day is working and $$$a_i=1$$$ if the $$$i$$$-th hour is resting. It is guaranteed ... | ["2", "2", "3", "0"] | #include<stdio.h>
int main(void)
{
int d,r, i, k=0;
scanf("%d", &d);
int h[2*d];
for(i=0; i<d; i++)
{
scanf("%d", &h[i]);
h[d+i]=h[i];
}
for(i=0; i<d*2; i++)
{
r=0;
while(h[i]==1)
{
r++;
i++;
}
if (r>k)
... | |
Each day in Berland consists of $$$n$$$ hours. Polycarp likes time management. That's why he has a fixed schedule for each day — it is a sequence $$$a_1, a_2, \dots, a_n$$$ (each $$$a_i$$$ is either $$$0$$$ or $$$1$$$), where $$$a_i=0$$$ if Polycarp works during the $$$i$$$-th hour of the day and $$$a_i=1$$$ if Polycar... | Print the maximal number of continuous hours during which Polycarp rests. Remember that you should consider that days go one after another endlessly and Polycarp uses the same schedule for each day. | C | fcd88c7b64da4b839cda4273d928429d | b0901a940131c1e3f898d454e0835742 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553006100 | ["5\n1 0 1 0 1", "6\n0 1 0 1 1 0", "7\n1 0 1 1 1 0 1", "3\n0 0 0"] | NoteIn the first example, the maximal rest starts in last hour and goes to the first hour of the next day.In the second example, Polycarp has maximal rest from the $$$4$$$-th to the $$$5$$$-th hour.In the third example, Polycarp has maximal rest from the $$$3$$$-rd to the $$$5$$$-th hour.In the fourth example, Polycarp... | PASSED | 900 | standard input | 2 seconds | The first line contains $$$n$$$ ($$$1 \le n \le 2\cdot10^5$$$) — number of hours per day. The second line contains $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 1$$$), where $$$a_i=0$$$ if the $$$i$$$-th hour in a day is working and $$$a_i=1$$$ if the $$$i$$$-th hour is resting. It is guaranteed ... | ["2", "2", "3", "0"] | #include<stdio.h>
int main(void)
{
int n;
int mc=0;
scanf("%d",&n);
int arr[2*n];
for(int i=0; i<n; i++)
{
scanf("%d",&arr[i]);
arr[n+i]= arr[i];
}
for(int i=0; i<2*n; i++)
{
int c=0;
while(arr[i]==1)
{
c++;
i++;
... | |
Each day in Berland consists of $$$n$$$ hours. Polycarp likes time management. That's why he has a fixed schedule for each day — it is a sequence $$$a_1, a_2, \dots, a_n$$$ (each $$$a_i$$$ is either $$$0$$$ or $$$1$$$), where $$$a_i=0$$$ if Polycarp works during the $$$i$$$-th hour of the day and $$$a_i=1$$$ if Polycar... | Print the maximal number of continuous hours during which Polycarp rests. Remember that you should consider that days go one after another endlessly and Polycarp uses the same schedule for each day. | C | fcd88c7b64da4b839cda4273d928429d | 45353066444c03f399a4b25562d2d775 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553006100 | ["5\n1 0 1 0 1", "6\n0 1 0 1 1 0", "7\n1 0 1 1 1 0 1", "3\n0 0 0"] | NoteIn the first example, the maximal rest starts in last hour and goes to the first hour of the next day.In the second example, Polycarp has maximal rest from the $$$4$$$-th to the $$$5$$$-th hour.In the third example, Polycarp has maximal rest from the $$$3$$$-rd to the $$$5$$$-th hour.In the fourth example, Polycarp... | PASSED | 900 | standard input | 2 seconds | The first line contains $$$n$$$ ($$$1 \le n \le 2\cdot10^5$$$) — number of hours per day. The second line contains $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 1$$$), where $$$a_i=0$$$ if the $$$i$$$-th hour in a day is working and $$$a_i=1$$$ if the $$$i$$$-th hour is resting. It is guaranteed ... | ["2", "2", "3", "0"] | #include <stdio.h>
#define sf scanf
#define pf printf
int main(void) {
int x,first,ans1,ans2,ans=0;
sf("%d",&x);
sf("%d",&first);
if(first==1)ans1=1;
else ans1=0;
ans2=ans1;
int ans3=ans1;
int k=0;
for(int i=1;i<x;i++){
int y;
sf("%d",&y);
if(y==0){
if(k==0 && first==1 )ans3=ans1;
... | |
Let $$$c$$$ be some positive integer. Let's call an array $$$a_1, a_2, \ldots, a_n$$$ of positive integers $$$c$$$-array, if for all $$$i$$$ condition $$$1 \leq a_i \leq c$$$ is satisfied. Let's call $$$c$$$-array $$$b_1, b_2, \ldots, b_k$$$ a subarray of $$$c$$$-array $$$a_1, a_2, \ldots, a_n$$$, if there exists such ... | Print $$$n + 1$$$ numbers $$$s_0, s_1, \ldots, s_n$$$. $$$s_p$$$ should be equal to the number of sequences of indices $$$1 \leq i_1 < i_2 < \ldots < i_k \leq n$$$ for all $$$1 \leq k \leq n$$$ by modulo $$$998\,244\,353$$$, such that the density of array $$$a_{i_1}, a_{i_2}, \ldots, a_{i_k}$$$ is equal to $$$... | C | 95c277d67c04fc644989c3112c2b5ae7 | 60b7b18cca72d9d0672b38fae6d10114 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"math"
] | 1557671700 | ["4 1\n1 1 1 1", "3 3\n1 2 3", "5 2\n1 2 1 2 1"] | NoteIn the first example, it's easy to see that the density of array will always be equal to its length. There exists $$$4$$$ sequences with one index, $$$6$$$ with two indices, $$$4$$$ with three and $$$1$$$ with four.In the second example, the only sequence of indices, such that the array will have non-zero density i... | PASSED | 3,500 | standard input | 6 seconds | The first line contains two integers $$$n$$$ and $$$c$$$, separated by spaces ($$$1 \leq n, c \leq 3\,000$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$, separated by spaces ($$$1 \leq a_i \leq c$$$). | ["0 4 6 4 1", "6 1 0 0", "10 17 4 0 0 0"] | /* https://codeforces.com/contest/1158/submission/54045740 (ecnerwala) */
/* upsolve with Dukkha */
#include <stdio.h>
#include <string.h>
#define N 3000
#define C 3000
#define MD 998244353
#define L 11
long long power(int a, int k) {
long long p;
if (k == 0)
return 1;
p = power(a, k / 2);
p = p * p % MD;
if ... | |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | 8de797fd10f5eef2f1b97fea40c96b22 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include <stdio.h>
int main()
{
int n;
scanf("%d",&n);
if(n%2==0)
{
int i,j=1,k,a[n];
for(i=1;i<=n;i+=2)
{
a[j]=i+1;
a[j+1]=i;
j+=2;
}
for(k=1;k<=n;k++)
{
printf("%d ",a[k]);
... | |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | 28bb567ecbc53ad3f56a5f225a43dcd6 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include<stdio.h>
#include<math.h>
#include<stdlib.h>
long long int cmpp( const void * a,const void *b ){
return ( *(long long int *)a-*(long long int*)b);
}
char cmp(const void * a,const void *b){
return (*(char*)a-*(char*)b);
}
int main(void)
{
long long int test, i, j,flag = 0,n, o1 = 0, o2 = 0, x, m,... | |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | ac1d44e9789ce8ed7606f13a69220884 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include <stdio.h>
#include<string.h>
#include<math.h>
int main(void){
// Your code here!
int test,n,c,o,d,e,r,i,fflag=0,flag=0,index,sum,m,l,j,z,b,k,count=0,a;
scanf("%d",&n);
if(n%2==1){
printf("-1");
}else{
//printf("%d %d %d %d",a,b,c,d);
for(i=2;i<=n;i+=2){... | |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | 8b585330966ce4a4bbc0247f8180b9b4 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include<stdio.h>
int main()
{
int n,p=0,q=0,i,j;
scanf("%d",&n);
int b[n],a[n];
if(n%2!=0)
printf("-1");
else
{
for(int i=1;i<=n;i++)
{
if(i%2==0)
a[p++]=i;
else
b[q++]=i;
}
for(i=0,j=0;i<p,j<q;i++,j++)
{
printf(" %d %d",a[i],b[j]);
}
}
} | |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | e036f10ab3819d2012268c86843708f5 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int t;
scanf("%d",&t);
int a[t];
if(t==1||t%2!=0){
printf("-1");
}
else if(t%2==0){
for(int i=1;i<t;i+=2){
a[i]=i+1;
a[i+1]=i;
}
for(int j=1;j<=t;j++){
printf("%d ",a[j]);
}}
... | |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | c54085d5a98008da25874db36f2ad905 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include<stdio.h>
int main()
{
int n,i;
scanf("%d",&n);
if(n%2!=0){
printf("-1");
}
else{
for(i=n;i>=1;i--){
printf("%d ",i);
}
}
return 0;
}
| |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | 5c89fe887ac6dd1829b041f459199b9e | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include <stdio.h>
int main() {
long long int i,c=0,e=0,f=0,d=0,k=0,g=0,n,sum=0,s,MaiorAB;
scanf("%lld",&n);
if(n%2==1){
printf("-1");
}
else if(n%2==0){
for(i=2;i<=n;i=i+2){
printf("%lld %lld ",i,i-1);
}}
return 0;
}
| |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | 39ebd1fd2468dd7f712b814003a559d4 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include<stdio.h>
int main()
{
int n,i;
scanf("%d",&n);
if(n%2==1)
printf("-1");
else if(n%2==0)
{
for(i=n;i>0;i--)
{
printf("%d ",i);
}
}
/*else
{
for(i=n-1;i>=n/2;i--)
{printf("%d ",i);}
printf("%d ",n);
for(i=n/2-1;i>0;i--)
{printf("%d ",i);}
}
*/
}
| |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | 06b264d5db7c9557768fe26ac63797d5 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include <stdio.h>
#include <string.h>
int main()
{
int n;
scanf("%d",&n);
if(n%2==1)
{
printf("-1\n");
}
else{
int i;
int b=n;
for(i=1;i<=n;i++)
{
printf("%d ",b);
b--;
}
}
}
| |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | 4f679ad85ac135da3141184ec21b18b7 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include <stdio.h>
int main() {
int n, i;
scanf("%d", &n);
if (n % 2 != 0) {
printf("-1\n");
return 0;
}
for (i = 2; i <= n; i += 2)
printf("%d %d ", i, i - 1);
printf("\n");
return 0;
}
| |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | 6b99287bac9943a1f5df89ee7328099f | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
if(n%2==0)
{for(int i=1;i<=n;i++)
{
if(i%2==0)
printf("%d ",i-1);
else
printf("%d ",i+1);
}}
else
printf("-1");
} | |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | a6dd39854aa0fb37123f0f302495a178 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include <stdio.h>
int main()
{
int i,j,a,b;
scanf("%d",&a);
if(a%2==1)
printf("-1");
else
for(i=1;i<=a;i+=2)
{
printf("%d %d ",i+1,i);
}
return 0;
} | |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | 26200985931af3554a008f23be43a5da | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int n, i;
scanf("%d", &n);
if (n%2 == 1)
printf("-1");
else
{
for (i = 0; i < n; i++)
{
if (i%2 == 0)
printf("%d ", i+2);
else
printf("%d ", i);
}
}
re... | |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | b5a97ecd88ee8c3ef11271e167fa00ac | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include<stdio.h>
int main()
{
int n,i;
scanf("%d",&n);
if(n%2==1)
{
printf("-1");
return 0;
}
if(n%2==0)
{
for(i=n;i>=1;i--)
{
printf("%d ",i);
}
}
} | |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | 0005127f2d2b79ea8b5a28954300fd85 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include<stdio.h>
int main(void)
{
int n;
scanf("%d",&n);
if(n%2)
printf("-1");
else
{
int arr[105];
for(int i=0;i<n;i++)
arr[i]=i+1;
for(int i=0;i<n-1;i+=2)
{
arr[i]++;
arr[i+1]-... | |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | 9e419f8395dbf2d107b2526c739629d8 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include<stdio.h>
int main(void)
{
int n;
scanf("%d",&n);
if(n%2)
printf("-1");
else
{
for(int i=2;i<=n;i+=2)
printf("%d %d ",i,i-1);
}
return 0;
}
| |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | 61f2c1029401c1df20d877cc0aabb897 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include<stdio.h>
void swap(int*a,int*b)
{
int temp=*a;
*a=*b;
*b=temp;
}
int main()
{
int n,i;
scanf("%d",&n);
if(n%2==0)
{
int a[n];
for(i=0;i<n;i++)
a[i]=i+1;
for(i=0;i<n;i=i+2)
swap(&a[i],&a[i+1]);
for(i=0;i<n;i++)
printf("%d ",a[i]... | |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | 783962c313068e6ee9738e75a3f4c274 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include<stdio.h>
int main()
{
int i,n,d[100],m;
scanf("%d",&n);
if(n%2==1)
{
printf("-1");
}
else
{
for(i=1; i<=n; i++)
{
if(i%2==1)
{
if(i!=n)
{
d[i]=i+1;
}
e... | |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | b482fda62d5105bb7ccba3968ab85436 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include<stdio.h>
int main(void)
{
int n,i;
scanf("%d",&n);
if(n%2) printf("-1");
else
{
for(i=0;i<n;i++)
{
if(i%2) printf("%d ",i);
else printf("%d ",i+2);
}
}
return 0;
} | |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | a33d383d817f6a7fe4265ca66559d2e8 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include<stdio.h>
int main()
{
int n,i,temp;
scanf("%d",&n);
int a[n];
for(i=0;i<n;i++)
a[i]=i+1;
for(i=0;i<n-1;i++)
{
if(a[i]<a[i+1])
{
temp=a[i];
a[i]=a[i+1];
a[i+1]=temp;
i++;
}
}
if(n==0 || n%2==1)
printf("-... | |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | 2a0d01c2ab75a34b335b8a752ad98406 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include <stdio.h>
#include <stdlib.h>
int main() {
int n;
scanf("%d",&n);
int i;
if(n%2!=0){
printf("-1\n");
}else{
if(n>2){
for(i=1;i<=n-2;i++){
printf("%d ",i+1);
printf("%d ",i);
i++;
}
}
printf("%d ",n);
printf("%d\n",n-1);
}
return 0;
} | |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | bf1db99611c08f7c44dc09aa53d4d413 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
int n;
scanf("%d",&n);
int i;
if(n%2!=0){
printf("-1\n");
}else{
if(n>2){
for(i=1;i<=n-2;i++){
printf("%d ",i+1);
printf("%d ",i);
i++;
}
}
printf("%d ",n);
printf("%d\n",n-1);
}
return 0;
} | |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | 7f6000059dab7d485a07fbea479929f6 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include<stdio.h>
int main()
{
int n,i;
scanf("%d",&n);
if(n%2!=0) printf("-1\n");
else
{
for(i=1;i<=n;i++)
{
if(i%2==0) printf("%d ",i-1);
else printf("%d ",i+1);
}
}
}
| |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | 5b8d21281751c354813bd4046cd8f5af | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include <stdio.h>
#include <conio.h>
#include <stdlib.h>
int main()
{
int permu[100]={0};
int len,i,temp;
scanf("%d",&len);
if (len%2==0)
{
for (i=0;i<len;i++)
{
permu[i]=i+1;
}
for(i=0;i<len;i=i+2)
{
temp=permu[i];
permu[i]=permu[i+1];
permu[i+1]=temp;
}
for(i=0;i<len;i++)
... | |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | 5d8f596ed88d0f261cc27e09759e00c2 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include <stdio.h>
int main() {
int n;
scanf("%d",&n);
if(n%2 == 1) {
printf("%d\n",-1);
}
else {
for(int i=n;i>0;i--) {
printf("%d ",i);
}
printf("\n");
}
return 0;
} | |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | 15b5220bfb22ebf8cf15673ffb80f13d | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include<stdio.h>
int main()
{
int n,i,j,k,m;
scanf("%d",&n);
if(n%2!=0)
{
printf("-1");
}
else
{
printf("2 1");
for(i=3;i<=n;i+=2)
printf(" %d %d", i+1, i);
}
}
| |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | aab8c03c17894f645d3bf940a9ff0405 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
if(n%2 == 1){
printf("-1\n");
return 0;
}
int output[102] = {0}, i, j;
for(i = 1, j= 1; i <= n; ){
if(i == j){
output[++j] = i;
output[j-1] = ++i;
j++;
}
else outp... | |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | 3ebfb38723a8656e9161ebf984de5317 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include <stdio.h>
int main()
{
int n,i,j;
scanf("%d",&n);
if(n%2!=0)
printf("-1");
else{
for(i=1;i<=n;i+=2)
printf("%d %d ",i+1,i);
}
}
| |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | d3529a3673eafda521ef8ae399499733 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include <stdio.h>
int main()
{
int n,i,j;
scanf("%d",&n);
if(n%2!=0)
printf("-1");
else{
for(i=n/2+1;i<=n;i++)
printf("%d ",i);
for(i=1;i<=n/2;i++)
printf("%d ",i);
}
}
| |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | 6e494fb4e48128d285b33dafcf4113ec | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include <stdio.h>
main()
{
int n,i;
scanf("%d",&n);
if(n%2 ==1) printf("-1\n");
else
{
printf("2 1 ");
for(i=3;i<n;i+=2)
printf("%d %d ",i+1,i);
}
return 0;
} | |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | 840576a8a359e40d85ce451a0c769b4e | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include<stdio.h>
int main()
{
int n; //p(2k)=2k+1 :: p(2k+1)=2k
scanf("%d",&n);
if(n%2)
printf("-1");
else
{
for(int i=n;i>0;i--)
{
printf("%d ",i);
}
}
return 0;
}
| |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | 8065633311e89e175f466344ebc00edc | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include<stdio.h>
int main()
{
int a,b,c,d,e,x,y,ara[100000],i,j;
scanf("%d",&a);
if(a%2!=0)
{
printf("-1");
}
else
{
for(i=1;i<=a-1;i=i+2)
{
printf("%d ",i+1);
printf("%d ",i);
}
}
}
| |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | 52cc54ee910056d1ec965c40796cc087 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int n;
scanf("%d",&n);
int arr[n+1],i=1,ele=2;
for(i=0;i<=n;i++)
arr[i]=0;
i=1;
if(n%2==1)
printf("-1");
else{
while(i<=n&&ele<=n)
{
arr[i]=ele;
if(i%2==0)
ele+=3;
else
ele--;
i++;
}
for(i=1;i<=n;i++)
printf("%d ",arr[i]);
printf("\n");... | |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | 18d0e477495e2431afab33c696cae27c | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include<stdio.h>
#include<string.h>
int main()
{
int n,i,j;
scanf("%d",&n);
if(n%2==0){
for(i=1;i<=n;i++){
if(i%2==0)
printf("%d %d ",i,i-1);
}
}
else
printf("-1\n");
return 0;
} | |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | a3373348ea7996eea0e1260c10375e20 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include<stdio.h>
int main()
{
int n,i;
scanf("%d",&n);
if(n%2==1)
printf("-1");
else{
for(i=1;i<n;i=i+2)
printf("%d %d ",i+1,i);
}
}
| |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | edcfe4921086264e67e4d94e69f9e910 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include<stdio.h>
int main()
{
int n,i;
scanf("%d",&n);
if(n%2==1)
{
printf("-1");
}
else
{ printf("2 1 ");
for(i=3;i<n;i=i+2)
{
printf("%d %d",i+1,i);
printf(" ");
}
}
return 0;
}
| |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | 8401dac5a86247bc237a340cfb0ec18a | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include<stdio.h>
int main()
{
int n,i;
scanf("%d",&n);
if(n%2==1)
{
printf("-1\n");
}
else
{
for(i=n;i>0;i--)
{
printf("%d ",i);
}
}
return 0;
}
| |
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1, p2, ..., pn.Nickolas adores permutations. He likes some permutations more than the oth... | If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1, p2, ..., pn — permutation p, that is perfect. Separate printed numbers by whitespaces. | C | 204ba74195a384c59fb1357bdd71e16c | 2931fcc464c0405edae8007d5ab7fd3a | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"math"
] | 1349969400 | ["1", "2", "4"] | null | PASSED | 800 | standard input | 2 seconds | A single line contains a single integer n (1 ≤ n ≤ 100) — the permutation size. | ["-1", "2 1", "2 1 4 3"] | #include<stdio.h>
int main()
{
int n,k=1;
scanf("%d",&n);
if(n%2==1)
printf("-1");
else
{
for(int i=0;i<n;i++)
{
if(i%2==0)
{
printf("%d ",2*k);
k++;
}
else
printf("%d ",i);
}
}... | |
There are $$$n$$$ dormitories in Berland State University, they are numbered with integers from $$$1$$$ to $$$n$$$. Each dormitory consists of rooms, there are $$$a_i$$$ rooms in $$$i$$$-th dormitory. The rooms in $$$i$$$-th dormitory are numbered from $$$1$$$ to $$$a_i$$$.A postman delivers letters. Sometimes there is... | Print $$$m$$$ lines. For each letter print two integers $$$f$$$ and $$$k$$$ — the dormitory number $$$f$$$ $$$(1 \le f \le n)$$$ and the room number $$$k$$$ in this dormitory $$$(1 \le k \le a_f)$$$ to deliver the letter. | C | 56bdab2019ee12e18d4f7e17ac414962 | ce7fcefddfdddd4926e8797ac54b1d4b | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"two pointers",
"binary search",
"implementation"
] | 1526202300 | ["3 6\n10 15 12\n1 9 12 23 26 37", "2 3\n5 10000000000\n5 6 9999999999"] | NoteIn the first example letters should be delivered in the following order: the first letter in room $$$1$$$ of the first dormitory the second letter in room $$$9$$$ of the first dormitory the third letter in room $$$2$$$ of the second dormitory the fourth letter in room $$$13$$$ of the second dormitory the fifth... | PASSED | 1,000 | standard input | 4 seconds | The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 2 \cdot 10^{5})$$$ — the number of dormitories and the number of letters. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{10})$$$, where $$$a_i$$$ equals to the number of rooms in the $$$i$$$-th dormitory. T... | ["1 1\n1 9\n2 2\n2 13\n3 1\n3 12", "1 5\n2 1\n2 9999999994"] | #include <stdio.h>
long long Sum[200001];
int main()
{
int n, m;
long long a, b;
scanf("%d %d", &n, &m);
for(int i = 1; i <= n; ++i) {
scanf("%I64d", &a);
Sum[i] = Sum[i - 1] + a;
}
while(m--) {
scanf("%I64d", &b);
int l = 0;
int r = n;
while(l <... | |
There are $$$n$$$ dormitories in Berland State University, they are numbered with integers from $$$1$$$ to $$$n$$$. Each dormitory consists of rooms, there are $$$a_i$$$ rooms in $$$i$$$-th dormitory. The rooms in $$$i$$$-th dormitory are numbered from $$$1$$$ to $$$a_i$$$.A postman delivers letters. Sometimes there is... | Print $$$m$$$ lines. For each letter print two integers $$$f$$$ and $$$k$$$ — the dormitory number $$$f$$$ $$$(1 \le f \le n)$$$ and the room number $$$k$$$ in this dormitory $$$(1 \le k \le a_f)$$$ to deliver the letter. | C | 56bdab2019ee12e18d4f7e17ac414962 | bf61923d19e234bdd248c75e508f1e48 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"two pointers",
"binary search",
"implementation"
] | 1526202300 | ["3 6\n10 15 12\n1 9 12 23 26 37", "2 3\n5 10000000000\n5 6 9999999999"] | NoteIn the first example letters should be delivered in the following order: the first letter in room $$$1$$$ of the first dormitory the second letter in room $$$9$$$ of the first dormitory the third letter in room $$$2$$$ of the second dormitory the fourth letter in room $$$13$$$ of the second dormitory the fifth... | PASSED | 1,000 | standard input | 4 seconds | The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 2 \cdot 10^{5})$$$ — the number of dormitories and the number of letters. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{10})$$$, where $$$a_i$$$ equals to the number of rooms in the $$$i$$$-th dormitory. T... | ["1 1\n1 9\n2 2\n2 13\n3 1\n3 12", "1 5\n2 1\n2 9999999994"] | #include<stdio.h>
#define N 200002
int main(){
int n,m;
scanf("%d%d",&n,&m);
int i,j;
long long sum[N];
long long a[N];
sum[0]=0;
for(i=1;i<=n;i++){
scanf("%lld",&a[i]);
sum[i]=sum[i-1]+a[i];
}
/*
for(i=0;i<=n;i++){
printf(" %d:%lld",i,sum[i]);
}
p... | |
There are $$$n$$$ dormitories in Berland State University, they are numbered with integers from $$$1$$$ to $$$n$$$. Each dormitory consists of rooms, there are $$$a_i$$$ rooms in $$$i$$$-th dormitory. The rooms in $$$i$$$-th dormitory are numbered from $$$1$$$ to $$$a_i$$$.A postman delivers letters. Sometimes there is... | Print $$$m$$$ lines. For each letter print two integers $$$f$$$ and $$$k$$$ — the dormitory number $$$f$$$ $$$(1 \le f \le n)$$$ and the room number $$$k$$$ in this dormitory $$$(1 \le k \le a_f)$$$ to deliver the letter. | C | 56bdab2019ee12e18d4f7e17ac414962 | 3dc973896a4744435767c732f279a1a4 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"two pointers",
"binary search",
"implementation"
] | 1526202300 | ["3 6\n10 15 12\n1 9 12 23 26 37", "2 3\n5 10000000000\n5 6 9999999999"] | NoteIn the first example letters should be delivered in the following order: the first letter in room $$$1$$$ of the first dormitory the second letter in room $$$9$$$ of the first dormitory the third letter in room $$$2$$$ of the second dormitory the fourth letter in room $$$13$$$ of the second dormitory the fifth... | PASSED | 1,000 | standard input | 4 seconds | The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 2 \cdot 10^{5})$$$ — the number of dormitories and the number of letters. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{10})$$$, where $$$a_i$$$ equals to the number of rooms in the $$$i$$$-th dormitory. T... | ["1 1\n1 9\n2 2\n2 13\n3 1\n3 12", "1 5\n2 1\n2 9999999994"] | #include<stdio.h>
int main()
{
#ifndef ONLINE_JUDGE
freopen("input.txt","r", stdin);
freopen("output.txt","w", stdout);
#endif
int n,m,i,j;
scanf("%d%d",&n,&m);
int long long dorm[n+1],letter[m];
dorm[0]=0;
for (i=1;i<=n;i++)
{
scanf("%lld",&dorm[i]);
dorm[i]+=dorm[i-1];
}
for(i=0;i<m;i++)
scanf("%... | |
There are $$$n$$$ dormitories in Berland State University, they are numbered with integers from $$$1$$$ to $$$n$$$. Each dormitory consists of rooms, there are $$$a_i$$$ rooms in $$$i$$$-th dormitory. The rooms in $$$i$$$-th dormitory are numbered from $$$1$$$ to $$$a_i$$$.A postman delivers letters. Sometimes there is... | Print $$$m$$$ lines. For each letter print two integers $$$f$$$ and $$$k$$$ — the dormitory number $$$f$$$ $$$(1 \le f \le n)$$$ and the room number $$$k$$$ in this dormitory $$$(1 \le k \le a_f)$$$ to deliver the letter. | C | 56bdab2019ee12e18d4f7e17ac414962 | 463f6e05827481e90e13a2ec2172d555 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"two pointers",
"binary search",
"implementation"
] | 1526202300 | ["3 6\n10 15 12\n1 9 12 23 26 37", "2 3\n5 10000000000\n5 6 9999999999"] | NoteIn the first example letters should be delivered in the following order: the first letter in room $$$1$$$ of the first dormitory the second letter in room $$$9$$$ of the first dormitory the third letter in room $$$2$$$ of the second dormitory the fourth letter in room $$$13$$$ of the second dormitory the fifth... | PASSED | 1,000 | standard input | 4 seconds | The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 2 \cdot 10^{5})$$$ — the number of dormitories and the number of letters. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{10})$$$, where $$$a_i$$$ equals to the number of rooms in the $$$i$$$-th dormitory. T... | ["1 1\n1 9\n2 2\n2 13\n3 1\n3 12", "1 5\n2 1\n2 9999999994"] | #include<stdio.h>
int main()
{
int n,m,i,j,a=1;
scanf("%d %d",&n,&m);
long long int x[n+1],y[m]; x[0]=0;
for(i=1;i<=n;i++)
{
scanf("%lld",&x[i]);
x[i]+=x[i-1];
}
for(i=0;i<m;i++)
{
scanf("%lld",&y[i]);
for(j=a;y[i]>x[j];j++); a=j;
printf("... | |
There are $$$n$$$ dormitories in Berland State University, they are numbered with integers from $$$1$$$ to $$$n$$$. Each dormitory consists of rooms, there are $$$a_i$$$ rooms in $$$i$$$-th dormitory. The rooms in $$$i$$$-th dormitory are numbered from $$$1$$$ to $$$a_i$$$.A postman delivers letters. Sometimes there is... | Print $$$m$$$ lines. For each letter print two integers $$$f$$$ and $$$k$$$ — the dormitory number $$$f$$$ $$$(1 \le f \le n)$$$ and the room number $$$k$$$ in this dormitory $$$(1 \le k \le a_f)$$$ to deliver the letter. | C | 56bdab2019ee12e18d4f7e17ac414962 | 69374ef0371e1136b51730d116d6b314 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"two pointers",
"binary search",
"implementation"
] | 1526202300 | ["3 6\n10 15 12\n1 9 12 23 26 37", "2 3\n5 10000000000\n5 6 9999999999"] | NoteIn the first example letters should be delivered in the following order: the first letter in room $$$1$$$ of the first dormitory the second letter in room $$$9$$$ of the first dormitory the third letter in room $$$2$$$ of the second dormitory the fourth letter in room $$$13$$$ of the second dormitory the fifth... | PASSED | 1,000 | standard input | 4 seconds | The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 2 \cdot 10^{5})$$$ — the number of dormitories and the number of letters. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{10})$$$, where $$$a_i$$$ equals to the number of rooms in the $$$i$$$-th dormitory. T... | ["1 1\n1 9\n2 2\n2 13\n3 1\n3 12", "1 5\n2 1\n2 9999999994"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int n,m;
long long x,k=0;
long long dorm[200001]={0},lett[200001]={0},d[200001]={0};
scanf("%d %d",&n,&m);
for (int i=0; i<n; i++)
{
scanf("%I64d",&x);
if (i==0)
dorm[i]=x;
else
dorm[i]=dorm[i-1]... | |
There are $$$n$$$ dormitories in Berland State University, they are numbered with integers from $$$1$$$ to $$$n$$$. Each dormitory consists of rooms, there are $$$a_i$$$ rooms in $$$i$$$-th dormitory. The rooms in $$$i$$$-th dormitory are numbered from $$$1$$$ to $$$a_i$$$.A postman delivers letters. Sometimes there is... | Print $$$m$$$ lines. For each letter print two integers $$$f$$$ and $$$k$$$ — the dormitory number $$$f$$$ $$$(1 \le f \le n)$$$ and the room number $$$k$$$ in this dormitory $$$(1 \le k \le a_f)$$$ to deliver the letter. | C | 56bdab2019ee12e18d4f7e17ac414962 | 9662c31c87c4c1cb91fb761bbe4b4a25 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"two pointers",
"binary search",
"implementation"
] | 1526202300 | ["3 6\n10 15 12\n1 9 12 23 26 37", "2 3\n5 10000000000\n5 6 9999999999"] | NoteIn the first example letters should be delivered in the following order: the first letter in room $$$1$$$ of the first dormitory the second letter in room $$$9$$$ of the first dormitory the third letter in room $$$2$$$ of the second dormitory the fourth letter in room $$$13$$$ of the second dormitory the fifth... | PASSED | 1,000 | standard input | 4 seconds | The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 2 \cdot 10^{5})$$$ — the number of dormitories and the number of letters. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{10})$$$, where $$$a_i$$$ equals to the number of rooms in the $$$i$$$-th dormitory. T... | ["1 1\n1 9\n2 2\n2 13\n3 1\n3 12", "1 5\n2 1\n2 9999999994"] | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<ctype.h>
#include<stdbool.h>
#include<math.h>
#define INFINI 10000000
#define LLD "%l" "ld"
struct element
{
int value;
int pos;
};
typedef struct element element;
element tab[1001];
int compare(const void * p1,const void * p2)
{
element ... | |
There are $$$n$$$ dormitories in Berland State University, they are numbered with integers from $$$1$$$ to $$$n$$$. Each dormitory consists of rooms, there are $$$a_i$$$ rooms in $$$i$$$-th dormitory. The rooms in $$$i$$$-th dormitory are numbered from $$$1$$$ to $$$a_i$$$.A postman delivers letters. Sometimes there is... | Print $$$m$$$ lines. For each letter print two integers $$$f$$$ and $$$k$$$ — the dormitory number $$$f$$$ $$$(1 \le f \le n)$$$ and the room number $$$k$$$ in this dormitory $$$(1 \le k \le a_f)$$$ to deliver the letter. | C | 56bdab2019ee12e18d4f7e17ac414962 | 6966aaa4bce6b2719d7d903df55cfa49 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"two pointers",
"binary search",
"implementation"
] | 1526202300 | ["3 6\n10 15 12\n1 9 12 23 26 37", "2 3\n5 10000000000\n5 6 9999999999"] | NoteIn the first example letters should be delivered in the following order: the first letter in room $$$1$$$ of the first dormitory the second letter in room $$$9$$$ of the first dormitory the third letter in room $$$2$$$ of the second dormitory the fourth letter in room $$$13$$$ of the second dormitory the fifth... | PASSED | 1,000 | standard input | 4 seconds | The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 2 \cdot 10^{5})$$$ — the number of dormitories and the number of letters. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{10})$$$, where $$$a_i$$$ equals to the number of rooms in the $$$i$$$-th dormitory. T... | ["1 1\n1 9\n2 2\n2 13\n3 1\n3 12", "1 5\n2 1\n2 9999999994"] | #include<stdio.h>
int main()
{
long long int n,m,i,comp,p,ara[200005],low,high,mid,ans;
scanf("%lld%lld",&n,&m);
ara[0]=0;
for(i=1;i<=n;i++){
scanf("%lld",&ara[i]);
ara[i]=ara[i]+ara[i-1];
}
ara[n+1]=ara[n]+1;
for(i=1;i<=m;i++){
scanf("%lld",&comp);
... | |
There are $$$n$$$ dormitories in Berland State University, they are numbered with integers from $$$1$$$ to $$$n$$$. Each dormitory consists of rooms, there are $$$a_i$$$ rooms in $$$i$$$-th dormitory. The rooms in $$$i$$$-th dormitory are numbered from $$$1$$$ to $$$a_i$$$.A postman delivers letters. Sometimes there is... | Print $$$m$$$ lines. For each letter print two integers $$$f$$$ and $$$k$$$ — the dormitory number $$$f$$$ $$$(1 \le f \le n)$$$ and the room number $$$k$$$ in this dormitory $$$(1 \le k \le a_f)$$$ to deliver the letter. | C | 56bdab2019ee12e18d4f7e17ac414962 | ec28f4ccf4c2fe8d7d50ade151f856d4 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"two pointers",
"binary search",
"implementation"
] | 1526202300 | ["3 6\n10 15 12\n1 9 12 23 26 37", "2 3\n5 10000000000\n5 6 9999999999"] | NoteIn the first example letters should be delivered in the following order: the first letter in room $$$1$$$ of the first dormitory the second letter in room $$$9$$$ of the first dormitory the third letter in room $$$2$$$ of the second dormitory the fourth letter in room $$$13$$$ of the second dormitory the fifth... | PASSED | 1,000 | standard input | 4 seconds | The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 2 \cdot 10^{5})$$$ — the number of dormitories and the number of letters. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{10})$$$, where $$$a_i$$$ equals to the number of rooms in the $$$i$$$-th dormitory. T... | ["1 1\n1 9\n2 2\n2 13\n3 1\n3 12", "1 5\n2 1\n2 9999999994"] | #include<stdio.h>
int main()
{
int n,m,i,x,y,j;
scanf("%d %d",&n,&m);
long long int a[n],p,b[m],s=0;
for(i=0;i<n;i++)
scanf("%lld",&a[i]);
a[n]=0;
for(i=0;i<m;i++)
scanf("%lld",&b[i]);
i=0;
s=0;
for(j=0;j<m;j++){
while(i<n+1){
if(s<b[j]){
p=s;
s=s+a[i];
i++;
}
if(s>=b[j]){
x=i;
pr... | |
There are $$$n$$$ dormitories in Berland State University, they are numbered with integers from $$$1$$$ to $$$n$$$. Each dormitory consists of rooms, there are $$$a_i$$$ rooms in $$$i$$$-th dormitory. The rooms in $$$i$$$-th dormitory are numbered from $$$1$$$ to $$$a_i$$$.A postman delivers letters. Sometimes there is... | Print $$$m$$$ lines. For each letter print two integers $$$f$$$ and $$$k$$$ — the dormitory number $$$f$$$ $$$(1 \le f \le n)$$$ and the room number $$$k$$$ in this dormitory $$$(1 \le k \le a_f)$$$ to deliver the letter. | C | 56bdab2019ee12e18d4f7e17ac414962 | d061edcd3eec9ac3749c29182ce98681 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"two pointers",
"binary search",
"implementation"
] | 1526202300 | ["3 6\n10 15 12\n1 9 12 23 26 37", "2 3\n5 10000000000\n5 6 9999999999"] | NoteIn the first example letters should be delivered in the following order: the first letter in room $$$1$$$ of the first dormitory the second letter in room $$$9$$$ of the first dormitory the third letter in room $$$2$$$ of the second dormitory the fourth letter in room $$$13$$$ of the second dormitory the fifth... | PASSED | 1,000 | standard input | 4 seconds | The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 2 \cdot 10^{5})$$$ — the number of dormitories and the number of letters. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{10})$$$, where $$$a_i$$$ equals to the number of rooms in the $$$i$$$-th dormitory. T... | ["1 1\n1 9\n2 2\n2 13\n3 1\n3 12", "1 5\n2 1\n2 9999999994"] | #include<stdio.h>
#define MAX 200000
typedef long long ll;
ll main()
{
ll n,m,a[MAX],b,add=0,l=0;
scanf("%lld %lld %lld",&n,&m,&a[0]);
for(ll i=1;i<n;i++)
{
scanf("%lld",&add);
a[i]=a[i-1]+add;
}
while(m--)
{
scanf("%lld",&b);
ll r=n-1,mid;
while(r>l)
... | |
There are $$$n$$$ dormitories in Berland State University, they are numbered with integers from $$$1$$$ to $$$n$$$. Each dormitory consists of rooms, there are $$$a_i$$$ rooms in $$$i$$$-th dormitory. The rooms in $$$i$$$-th dormitory are numbered from $$$1$$$ to $$$a_i$$$.A postman delivers letters. Sometimes there is... | Print $$$m$$$ lines. For each letter print two integers $$$f$$$ and $$$k$$$ — the dormitory number $$$f$$$ $$$(1 \le f \le n)$$$ and the room number $$$k$$$ in this dormitory $$$(1 \le k \le a_f)$$$ to deliver the letter. | C | 56bdab2019ee12e18d4f7e17ac414962 | e44fd4c31e04f90ff8200416326115da | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"two pointers",
"binary search",
"implementation"
] | 1526202300 | ["3 6\n10 15 12\n1 9 12 23 26 37", "2 3\n5 10000000000\n5 6 9999999999"] | NoteIn the first example letters should be delivered in the following order: the first letter in room $$$1$$$ of the first dormitory the second letter in room $$$9$$$ of the first dormitory the third letter in room $$$2$$$ of the second dormitory the fourth letter in room $$$13$$$ of the second dormitory the fifth... | PASSED | 1,000 | standard input | 4 seconds | The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 2 \cdot 10^{5})$$$ — the number of dormitories and the number of letters. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{10})$$$, where $$$a_i$$$ equals to the number of rooms in the $$$i$$$-th dormitory. T... | ["1 1\n1 9\n2 2\n2 13\n3 1\n3 12", "1 5\n2 1\n2 9999999994"] | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
int binsearch(int n, long long int size[], long long int room) {
int lo = 0;
int hi = n;
while (hi > lo) {
int mid = (hi+lo)/2;
if (size[mid] >= room) {
hi = mid;
} else {
lo = mid+1;
}
}
if (size[lo] >= room) {
lo--;... | |
There are $$$n$$$ dormitories in Berland State University, they are numbered with integers from $$$1$$$ to $$$n$$$. Each dormitory consists of rooms, there are $$$a_i$$$ rooms in $$$i$$$-th dormitory. The rooms in $$$i$$$-th dormitory are numbered from $$$1$$$ to $$$a_i$$$.A postman delivers letters. Sometimes there is... | Print $$$m$$$ lines. For each letter print two integers $$$f$$$ and $$$k$$$ — the dormitory number $$$f$$$ $$$(1 \le f \le n)$$$ and the room number $$$k$$$ in this dormitory $$$(1 \le k \le a_f)$$$ to deliver the letter. | C | 56bdab2019ee12e18d4f7e17ac414962 | c6f3b80a408487cfa16b7c6d58ec41e0 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"two pointers",
"binary search",
"implementation"
] | 1526202300 | ["3 6\n10 15 12\n1 9 12 23 26 37", "2 3\n5 10000000000\n5 6 9999999999"] | NoteIn the first example letters should be delivered in the following order: the first letter in room $$$1$$$ of the first dormitory the second letter in room $$$9$$$ of the first dormitory the third letter in room $$$2$$$ of the second dormitory the fourth letter in room $$$13$$$ of the second dormitory the fifth... | PASSED | 1,000 | standard input | 4 seconds | The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 2 \cdot 10^{5})$$$ — the number of dormitories and the number of letters. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{10})$$$, where $$$a_i$$$ equals to the number of rooms in the $$$i$$$-th dormitory. T... | ["1 1\n1 9\n2 2\n2 13\n3 1\n3 12", "1 5\n2 1\n2 9999999994"] | #include <stdio.h>
int main(void)
{
long long int n,i,j,sum=0,m,e=0;
scanf("%lld%lld",&n,&m);
long long int a[n],b[m],d,c=0;
for(i=0;i<n;i++)
{
scanf("%lld",&a[i]);
}
for(i=0;i<m;i++)
{
scanf("%lld",&b[i]);
}
sum=a[0];
for(i=0;i<m;i++)
{
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.