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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t... | On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number... | C | a55d6c4af876e9c88b43d088f2b81817 | 178fc11109e42a81056b4f74c274ea9b | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"hashing",
"greedy"
] | 1409383800 | ["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"] | null | PASSED | 1,900 | standard input | 3 seconds | The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard. | ["12\n2 2 3 2"] | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<time.h>
#include<ctype.h>
#include<limits.h>
#define eps 1e-7
#define ll long long int
#define N 2500
ll board[N][N];
ll up[N][N];
ll low[N][N];
int main(){
int a,b,c;
scanf("%d",&a);
for(int i=1;i<=a;i++){
for(int w=1;w<=... | |
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t... | On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number... | C | a55d6c4af876e9c88b43d088f2b81817 | 4e1c20813005b6313b19807d0a44aab0 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"hashing",
"greedy"
] | 1409383800 | ["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"] | null | PASSED | 1,900 | standard input | 3 seconds | The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard. | ["12\n2 2 3 2"] | #include<stdio.h>
#define MAX 2005
long long d1[2*MAX]={0},d2[2*MAX]={0};
int a[MAX][MAX];
long long value[2];
struct point{
int x,y;
}pp[2];
void update(int num,int i,int j,long long val){
if(value[num] < val){
value[num] = val;
pp[num].x = i;
pp[num].y = j;
}
}
int main(){
... | |
Ivan recently bought a detective book. The book is so interesting that each page of this book introduces some sort of a mystery, which will be explained later. The $$$i$$$-th page contains some mystery that will be explained on page $$$a_i$$$ ($$$a_i \ge i$$$).Ivan wants to read the whole book. Each day, he reads the f... | Print one integer — the number of days it will take to read the whole book. | C | 291601d6cdafa4113c1154f0dda3470d | d79bc21cbf0433204d1c2dc575486e96 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553267100 | ["9\n1 3 3 6 7 6 8 8 9"] | NoteExplanation of the example test:During the first day Ivan will read only the first page. During the second day Ivan will read pages number $$$2$$$ and $$$3$$$. During the third day — pages $$$4$$$-$$$8$$$. During the fourth (and the last) day Ivan will read remaining page number $$$9$$$. | PASSED | 1,000 | standard input | 2 seconds | The first line contains single integer $$$n$$$ ($$$1 \le n \le 10^4$$$) — the number of pages in the book. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$i \le a_i \le n$$$), where $$$a_i$$$ is the number of page which contains the explanation of the mystery on page $$$i$$$. | ["4"] |
#include <stdio.h>
int main()
{
int n, count = 0;
scanf("%d", &n);
int a[n];
for(int i = 1; i <= n; i++){
scanf("%d", &a[i]);
}
a[0] = a[1];
int max = a[0];
for(int i = 1; i <= n; i++){
if (max < a[i])
max = a[i];
if((a[i] == i) && !(a[i] < a[i ... | |
Ivan recently bought a detective book. The book is so interesting that each page of this book introduces some sort of a mystery, which will be explained later. The $$$i$$$-th page contains some mystery that will be explained on page $$$a_i$$$ ($$$a_i \ge i$$$).Ivan wants to read the whole book. Each day, he reads the f... | Print one integer — the number of days it will take to read the whole book. | C | 291601d6cdafa4113c1154f0dda3470d | 86cfd1f99d8c405a69aa2105a57fde52 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553267100 | ["9\n1 3 3 6 7 6 8 8 9"] | NoteExplanation of the example test:During the first day Ivan will read only the first page. During the second day Ivan will read pages number $$$2$$$ and $$$3$$$. During the third day — pages $$$4$$$-$$$8$$$. During the fourth (and the last) day Ivan will read remaining page number $$$9$$$. | PASSED | 1,000 | standard input | 2 seconds | The first line contains single integer $$$n$$$ ($$$1 \le n \le 10^4$$$) — the number of pages in the book. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$i \le a_i \le n$$$), where $$$a_i$$$ is the number of page which contains the explanation of the mystery on page $$$i$$$. | ["4"] | #include <stdio.h>
#include <string.h>
#include <limits.h>
#define FOR(i, a, b) for (i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
int cmpfunc (const void * a, const void * b){
//qsort(values, 5, sizeof(int), cmpfunc);
return ( *(int*)a - *(int*)b );
}
int min(int a,int b){
return a < b ? a : b;
}
long nc... | |
Ivan recently bought a detective book. The book is so interesting that each page of this book introduces some sort of a mystery, which will be explained later. The $$$i$$$-th page contains some mystery that will be explained on page $$$a_i$$$ ($$$a_i \ge i$$$).Ivan wants to read the whole book. Each day, he reads the f... | Print one integer — the number of days it will take to read the whole book. | C | 291601d6cdafa4113c1154f0dda3470d | 45131e25cc1fa48b68b30bb9242c4fe5 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553267100 | ["9\n1 3 3 6 7 6 8 8 9"] | NoteExplanation of the example test:During the first day Ivan will read only the first page. During the second day Ivan will read pages number $$$2$$$ and $$$3$$$. During the third day — pages $$$4$$$-$$$8$$$. During the fourth (and the last) day Ivan will read remaining page number $$$9$$$. | PASSED | 1,000 | standard input | 2 seconds | The first line contains single integer $$$n$$$ ($$$1 \le n \le 10^4$$$) — the number of pages in the book. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$i \le a_i \le n$$$), where $$$a_i$$$ is the number of page which contains the explanation of the mystery on page $$$i$$$. | ["4"] | #include<stdio.h>
int main()
{
int n,i,j,d=0,c=0,max=0;
scanf("%d",&n);
int a[n];
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<n;i++)
{
if(i+1==a[i])
{
for(j=0;j<=i;j++)
{
if(a[i]>=a[j])
d++;
}
p... | |
Ivan recently bought a detective book. The book is so interesting that each page of this book introduces some sort of a mystery, which will be explained later. The $$$i$$$-th page contains some mystery that will be explained on page $$$a_i$$$ ($$$a_i \ge i$$$).Ivan wants to read the whole book. Each day, he reads the f... | Print one integer — the number of days it will take to read the whole book. | C | 291601d6cdafa4113c1154f0dda3470d | dcaf72696b01b9bfe16e5201ee488c42 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553267100 | ["9\n1 3 3 6 7 6 8 8 9"] | NoteExplanation of the example test:During the first day Ivan will read only the first page. During the second day Ivan will read pages number $$$2$$$ and $$$3$$$. During the third day — pages $$$4$$$-$$$8$$$. During the fourth (and the last) day Ivan will read remaining page number $$$9$$$. | PASSED | 1,000 | standard input | 2 seconds | The first line contains single integer $$$n$$$ ($$$1 \le n \le 10^4$$$) — the number of pages in the book. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$i \le a_i \le n$$$), where $$$a_i$$$ is the number of page which contains the explanation of the mystery on page $$$i$$$. | ["4"] | #include <stdio.h>
int main()
{
int i,j=0,k=0,n;
scanf("%d",&n);
int a[n];
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=1;i<=n;i++)
{
if(a[i-1]>j)
j=a[i-1];
if(i>=j)
k++;
}
printf("%d",k);
} | |
Ivan recently bought a detective book. The book is so interesting that each page of this book introduces some sort of a mystery, which will be explained later. The $$$i$$$-th page contains some mystery that will be explained on page $$$a_i$$$ ($$$a_i \ge i$$$).Ivan wants to read the whole book. Each day, he reads the f... | Print one integer — the number of days it will take to read the whole book. | C | 291601d6cdafa4113c1154f0dda3470d | 4395635f10a5e964acb91cb2da90fc5a | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553267100 | ["9\n1 3 3 6 7 6 8 8 9"] | NoteExplanation of the example test:During the first day Ivan will read only the first page. During the second day Ivan will read pages number $$$2$$$ and $$$3$$$. During the third day — pages $$$4$$$-$$$8$$$. During the fourth (and the last) day Ivan will read remaining page number $$$9$$$. | PASSED | 1,000 | standard input | 2 seconds | The first line contains single integer $$$n$$$ ($$$1 \le n \le 10^4$$$) — the number of pages in the book. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$i \le a_i \le n$$$), where $$$a_i$$$ is the number of page which contains the explanation of the mystery on page $$$i$$$. | ["4"] | #include<stdio.h>
int main()
{
int n,i,count=0,sum=0;
scanf("%d",&n);
int array[n];
for(i=0;i<n;i++)
{
scanf("%d",&array[i]);
}
for(i=0;i<n;i++)
{
if((array[i]<=i+1)&&(array[i]>=sum)) count++;
if(array[i]>sum) sum=array[i];
}
printf("%d",count);
retu... | |
Ivan recently bought a detective book. The book is so interesting that each page of this book introduces some sort of a mystery, which will be explained later. The $$$i$$$-th page contains some mystery that will be explained on page $$$a_i$$$ ($$$a_i \ge i$$$).Ivan wants to read the whole book. Each day, he reads the f... | Print one integer — the number of days it will take to read the whole book. | C | 291601d6cdafa4113c1154f0dda3470d | 10b5ea071a4da79d71de1133ae75f7b4 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553267100 | ["9\n1 3 3 6 7 6 8 8 9"] | NoteExplanation of the example test:During the first day Ivan will read only the first page. During the second day Ivan will read pages number $$$2$$$ and $$$3$$$. During the third day — pages $$$4$$$-$$$8$$$. During the fourth (and the last) day Ivan will read remaining page number $$$9$$$. | PASSED | 1,000 | standard input | 2 seconds | The first line contains single integer $$$n$$$ ($$$1 \le n \le 10^4$$$) — the number of pages in the book. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$i \le a_i \le n$$$), where $$$a_i$$$ is the number of page which contains the explanation of the mystery on page $$$i$$$. | ["4"] | #include<stdio.h>
int main()
{
int n,a[10001],i,k=0,j;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
if(a[i]==(1+i))
{
for(j=0;j<i;j++)
{
if(a[j]>a[i])
break;
}
if(i==j)
{
... | |
Ivan recently bought a detective book. The book is so interesting that each page of this book introduces some sort of a mystery, which will be explained later. The $$$i$$$-th page contains some mystery that will be explained on page $$$a_i$$$ ($$$a_i \ge i$$$).Ivan wants to read the whole book. Each day, he reads the f... | Print one integer — the number of days it will take to read the whole book. | C | 291601d6cdafa4113c1154f0dda3470d | 66e362b17bcd1738a17f4edc9411d94d | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553267100 | ["9\n1 3 3 6 7 6 8 8 9"] | NoteExplanation of the example test:During the first day Ivan will read only the first page. During the second day Ivan will read pages number $$$2$$$ and $$$3$$$. During the third day — pages $$$4$$$-$$$8$$$. During the fourth (and the last) day Ivan will read remaining page number $$$9$$$. | PASSED | 1,000 | standard input | 2 seconds | The first line contains single integer $$$n$$$ ($$$1 \le n \le 10^4$$$) — the number of pages in the book. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$i \le a_i \le n$$$), where $$$a_i$$$ is the number of page which contains the explanation of the mystery on page $$$i$$$. | ["4"] | #include <stdio.h>
int main()
{
int p;
int a[10000];
int i;
scanf("%d",&p);
for(i=0 ; i<p ; i++){
scanf("%d",&a[i]);
}
int days = 0;
int read = 0;
int start = 0;
int mystery;
while(1){
mystery = a[start];
while(read<mystery){
if(a[read]>my... | |
Ivan recently bought a detective book. The book is so interesting that each page of this book introduces some sort of a mystery, which will be explained later. The $$$i$$$-th page contains some mystery that will be explained on page $$$a_i$$$ ($$$a_i \ge i$$$).Ivan wants to read the whole book. Each day, he reads the f... | Print one integer — the number of days it will take to read the whole book. | C | 291601d6cdafa4113c1154f0dda3470d | 4dd82d085b2512cfbbb7dcbb71a6b041 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553267100 | ["9\n1 3 3 6 7 6 8 8 9"] | NoteExplanation of the example test:During the first day Ivan will read only the first page. During the second day Ivan will read pages number $$$2$$$ and $$$3$$$. During the third day — pages $$$4$$$-$$$8$$$. During the fourth (and the last) day Ivan will read remaining page number $$$9$$$. | PASSED | 1,000 | standard input | 2 seconds | The first line contains single integer $$$n$$$ ($$$1 \le n \le 10^4$$$) — the number of pages in the book. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$i \le a_i \le n$$$), where $$$a_i$$$ is the number of page which contains the explanation of the mystery on page $$$i$$$. | ["4"] | #include <stdio.h>
int a[10005], v[10005];
int main()
{
int n, cnt = 0;
// freopen("test.txt","r",stdin);
scanf("%d", &n);
for(int i = 1; i <= n; i++) scanf("%d", &a[i]);
int max = 0;
for(int i = 1; i <= n; i++)
{
if(max < a[i]) max = a[i];
if(i == max) cnt++;
}
... | |
Ivan recently bought a detective book. The book is so interesting that each page of this book introduces some sort of a mystery, which will be explained later. The $$$i$$$-th page contains some mystery that will be explained on page $$$a_i$$$ ($$$a_i \ge i$$$).Ivan wants to read the whole book. Each day, he reads the f... | Print one integer — the number of days it will take to read the whole book. | C | 291601d6cdafa4113c1154f0dda3470d | b7e17dc5f2d6b60b1ddb432937480fb5 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553267100 | ["9\n1 3 3 6 7 6 8 8 9"] | NoteExplanation of the example test:During the first day Ivan will read only the first page. During the second day Ivan will read pages number $$$2$$$ and $$$3$$$. During the third day — pages $$$4$$$-$$$8$$$. During the fourth (and the last) day Ivan will read remaining page number $$$9$$$. | PASSED | 1,000 | standard input | 2 seconds | The first line contains single integer $$$n$$$ ($$$1 \le n \le 10^4$$$) — the number of pages in the book. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$i \le a_i \le n$$$), where $$$a_i$$$ is the number of page which contains the explanation of the mystery on page $$$i$$$. | ["4"] | #include<stdio.h>
#include<stdlib.h>
int main(){
int N, day = 0, cnt = 0, t = 1, s = 0, max;
int arr[10001] = {};
scanf("%d", &N);
for(int i=0; i<N; i++){
scanf("%d", &arr[i]);
}
while(1){
if(cnt == N) break;
for(int j=s; j<t; j++){
if(arr[j] > t) t = arr[j];
cnt++;
}
s = t;
... | |
Ivan recently bought a detective book. The book is so interesting that each page of this book introduces some sort of a mystery, which will be explained later. The $$$i$$$-th page contains some mystery that will be explained on page $$$a_i$$$ ($$$a_i \ge i$$$).Ivan wants to read the whole book. Each day, he reads the f... | Print one integer — the number of days it will take to read the whole book. | C | 291601d6cdafa4113c1154f0dda3470d | 16be89cfa21d0aa5892973b87a7e5a40 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553267100 | ["9\n1 3 3 6 7 6 8 8 9"] | NoteExplanation of the example test:During the first day Ivan will read only the first page. During the second day Ivan will read pages number $$$2$$$ and $$$3$$$. During the third day — pages $$$4$$$-$$$8$$$. During the fourth (and the last) day Ivan will read remaining page number $$$9$$$. | PASSED | 1,000 | standard input | 2 seconds | The first line contains single integer $$$n$$$ ($$$1 \le n \le 10^4$$$) — the number of pages in the book. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$i \le a_i \le n$$$), where $$$a_i$$$ is the number of page which contains the explanation of the mystery on page $$$i$$$. | ["4"] | #include<stdio.h>
int main(void){
int n=0,i=0,day=0;
scanf("%d",&n);
int a[n];
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
i=0;
while(i<n){
for(i++;i<a[i-1];i++){
if(a[i]<a[i-1]){
a[i]+=a[i-1];
a[i-1]=a[i]-a[i-1];
a[i]-=a[i-1];
}
}
day++;
}
printf("%d",day);
}
| |
Ivan recently bought a detective book. The book is so interesting that each page of this book introduces some sort of a mystery, which will be explained later. The $$$i$$$-th page contains some mystery that will be explained on page $$$a_i$$$ ($$$a_i \ge i$$$).Ivan wants to read the whole book. Each day, he reads the f... | Print one integer — the number of days it will take to read the whole book. | C | 291601d6cdafa4113c1154f0dda3470d | 05627b7a5809708414e0387cc87e8661 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553267100 | ["9\n1 3 3 6 7 6 8 8 9"] | NoteExplanation of the example test:During the first day Ivan will read only the first page. During the second day Ivan will read pages number $$$2$$$ and $$$3$$$. During the third day — pages $$$4$$$-$$$8$$$. During the fourth (and the last) day Ivan will read remaining page number $$$9$$$. | PASSED | 1,000 | standard input | 2 seconds | The first line contains single integer $$$n$$$ ($$$1 \le n \le 10^4$$$) — the number of pages in the book. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$i \le a_i \le n$$$), where $$$a_i$$$ is the number of page which contains the explanation of the mystery on page $$$i$$$. | ["4"] | #include<stdio.h>
int main()
{
int n,mam;
scanf("%d",&n);
int a[n];
int i,count=0;
scanf("%d",&a[0]);
mam=a[0];
if(mam==1){
++count;
mam=2;
}
... | |
Ivan recently bought a detective book. The book is so interesting that each page of this book introduces some sort of a mystery, which will be explained later. The $$$i$$$-th page contains some mystery that will be explained on page $$$a_i$$$ ($$$a_i \ge i$$$).Ivan wants to read the whole book. Each day, he reads the f... | Print one integer — the number of days it will take to read the whole book. | C | 291601d6cdafa4113c1154f0dda3470d | a616f64bc2901ba8513d80a57750f9a6 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553267100 | ["9\n1 3 3 6 7 6 8 8 9"] | NoteExplanation of the example test:During the first day Ivan will read only the first page. During the second day Ivan will read pages number $$$2$$$ and $$$3$$$. During the third day — pages $$$4$$$-$$$8$$$. During the fourth (and the last) day Ivan will read remaining page number $$$9$$$. | PASSED | 1,000 | standard input | 2 seconds | The first line contains single integer $$$n$$$ ($$$1 \le n \le 10^4$$$) — the number of pages in the book. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$i \le a_i \le n$$$), where $$$a_i$$$ is the number of page which contains the explanation of the mystery on page $$$i$$$. | ["4"] | /* AUTHOR:AKASH JAIN
* USERNAME:akash19jain
* DATE:23/03/2019
*/
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
int main()
{
long long t=1;
//scanf("%lld",&t);
while(t--)
{
long long n,ans=0,max=0;
scanf("%lld",&n);
long lo... | |
Ivan recently bought a detective book. The book is so interesting that each page of this book introduces some sort of a mystery, which will be explained later. The $$$i$$$-th page contains some mystery that will be explained on page $$$a_i$$$ ($$$a_i \ge i$$$).Ivan wants to read the whole book. Each day, he reads the f... | Print one integer — the number of days it will take to read the whole book. | C | 291601d6cdafa4113c1154f0dda3470d | 3ac6a75e937f059fb2c7f6829dd79d85 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553267100 | ["9\n1 3 3 6 7 6 8 8 9"] | NoteExplanation of the example test:During the first day Ivan will read only the first page. During the second day Ivan will read pages number $$$2$$$ and $$$3$$$. During the third day — pages $$$4$$$-$$$8$$$. During the fourth (and the last) day Ivan will read remaining page number $$$9$$$. | PASSED | 1,000 | standard input | 2 seconds | The first line contains single integer $$$n$$$ ($$$1 \le n \le 10^4$$$) — the number of pages in the book. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$i \le a_i \le n$$$), where $$$a_i$$$ is the number of page which contains the explanation of the mystery on page $$$i$$$. | ["4"] | #include<stdio.h>
int main(){
int n;
scanf("%d",&n);
int count=0;
int sum=0;
for(int i=1;i<=n;i++){
int a;
scanf("%d",&a);
if(a>count) count=a;
if(i==count) sum++;
}
printf("%d",sum);
} | |
Ivan recently bought a detective book. The book is so interesting that each page of this book introduces some sort of a mystery, which will be explained later. The $$$i$$$-th page contains some mystery that will be explained on page $$$a_i$$$ ($$$a_i \ge i$$$).Ivan wants to read the whole book. Each day, he reads the f... | Print one integer — the number of days it will take to read the whole book. | C | 291601d6cdafa4113c1154f0dda3470d | 21a6f90f0592050a99257500c1e35bd2 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553267100 | ["9\n1 3 3 6 7 6 8 8 9"] | NoteExplanation of the example test:During the first day Ivan will read only the first page. During the second day Ivan will read pages number $$$2$$$ and $$$3$$$. During the third day — pages $$$4$$$-$$$8$$$. During the fourth (and the last) day Ivan will read remaining page number $$$9$$$. | PASSED | 1,000 | standard input | 2 seconds | The first line contains single integer $$$n$$$ ($$$1 \le n \le 10^4$$$) — the number of pages in the book. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$i \le a_i \le n$$$), where $$$a_i$$$ is the number of page which contains the explanation of the mystery on page $$$i$$$. | ["4"] | #include <stdio.h>
int main() {
unsigned n;
scanf("%u", &n);
unsigned max = 0;
unsigned count = 0;
for (unsigned i = 1; i <= n; i++) {
unsigned next;
scanf("%u", &next);
if (next > max) max = next;
if (max <= i) count++;
}
printf("%u\n", count);
return 0;
}
| |
Ivan recently bought a detective book. The book is so interesting that each page of this book introduces some sort of a mystery, which will be explained later. The $$$i$$$-th page contains some mystery that will be explained on page $$$a_i$$$ ($$$a_i \ge i$$$).Ivan wants to read the whole book. Each day, he reads the f... | Print one integer — the number of days it will take to read the whole book. | C | 291601d6cdafa4113c1154f0dda3470d | 5bf13fc646db8abe631211d7dd5c1618 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553267100 | ["9\n1 3 3 6 7 6 8 8 9"] | NoteExplanation of the example test:During the first day Ivan will read only the first page. During the second day Ivan will read pages number $$$2$$$ and $$$3$$$. During the third day — pages $$$4$$$-$$$8$$$. During the fourth (and the last) day Ivan will read remaining page number $$$9$$$. | PASSED | 1,000 | standard input | 2 seconds | The first line contains single integer $$$n$$$ ($$$1 \le n \le 10^4$$$) — the number of pages in the book. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$i \le a_i \le n$$$), where $$$a_i$$$ is the number of page which contains the explanation of the mystery on page $$$i$$$. | ["4"] | #include<stdio.h>
int main()
{
int n,c=0,temp;
scanf("%d",&n);
int ar[n];
for(int i=0;i<n;i++)
{
scanf("%d",&ar[i]);
}
for(int i=0;i<n;i++)
{
for(int j=i+1;j<n;j++)
{
if(ar[i]>ar[j])
{
temp=ar[j];
ar[j]=ar[i];
... | |
Ivan recently bought a detective book. The book is so interesting that each page of this book introduces some sort of a mystery, which will be explained later. The $$$i$$$-th page contains some mystery that will be explained on page $$$a_i$$$ ($$$a_i \ge i$$$).Ivan wants to read the whole book. Each day, he reads the f... | Print one integer — the number of days it will take to read the whole book. | C | 291601d6cdafa4113c1154f0dda3470d | f36f5b938bdc4cbd7277b3f8c8959bea | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553267100 | ["9\n1 3 3 6 7 6 8 8 9"] | NoteExplanation of the example test:During the first day Ivan will read only the first page. During the second day Ivan will read pages number $$$2$$$ and $$$3$$$. During the third day — pages $$$4$$$-$$$8$$$. During the fourth (and the last) day Ivan will read remaining page number $$$9$$$. | PASSED | 1,000 | standard input | 2 seconds | The first line contains single integer $$$n$$$ ($$$1 \le n \le 10^4$$$) — the number of pages in the book. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$i \le a_i \le n$$$), where $$$a_i$$$ is the number of page which contains the explanation of the mystery on page $$$i$$$. | ["4"] | #include<stdio.h>
int main(){
int n,i,p,max=0,j=0,c=0;
scanf("%d",&n);
int arr[n];
for(i=0;i<n;i++)
scanf("%d",&arr[i]);
for(i=0;i<n;i++){
j=i;
do{
if(arr[j]-1>=max)
max=arr[j]... | |
Ivan recently bought a detective book. The book is so interesting that each page of this book introduces some sort of a mystery, which will be explained later. The $$$i$$$-th page contains some mystery that will be explained on page $$$a_i$$$ ($$$a_i \ge i$$$).Ivan wants to read the whole book. Each day, he reads the f... | Print one integer — the number of days it will take to read the whole book. | C | 291601d6cdafa4113c1154f0dda3470d | 55b74e415b7846721c0d4e767aeb6d88 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553267100 | ["9\n1 3 3 6 7 6 8 8 9"] | NoteExplanation of the example test:During the first day Ivan will read only the first page. During the second day Ivan will read pages number $$$2$$$ and $$$3$$$. During the third day — pages $$$4$$$-$$$8$$$. During the fourth (and the last) day Ivan will read remaining page number $$$9$$$. | PASSED | 1,000 | standard input | 2 seconds | The first line contains single integer $$$n$$$ ($$$1 \le n \le 10^4$$$) — the number of pages in the book. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$i \le a_i \le n$$$), where $$$a_i$$$ is the number of page which contains the explanation of the mystery on page $$$i$$$. | ["4"] | #include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
int k[n],i,j;
for(i=0;i<n;i++)
{
scanf("%d",&k[i]);
}
int day=0,next_stop=0,prev_stop=-1;
for(i=0;i<n;i++)
{
int num = k[i];
next_stop = num>next_stop?num:next_stop;
for(j=i;j<next_stop;j++)
{
next... | |
Ivan recently bought a detective book. The book is so interesting that each page of this book introduces some sort of a mystery, which will be explained later. The $$$i$$$-th page contains some mystery that will be explained on page $$$a_i$$$ ($$$a_i \ge i$$$).Ivan wants to read the whole book. Each day, he reads the f... | Print one integer — the number of days it will take to read the whole book. | C | 291601d6cdafa4113c1154f0dda3470d | ea0ae13349b47f454646a9c7a8f7b7be | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553267100 | ["9\n1 3 3 6 7 6 8 8 9"] | NoteExplanation of the example test:During the first day Ivan will read only the first page. During the second day Ivan will read pages number $$$2$$$ and $$$3$$$. During the third day — pages $$$4$$$-$$$8$$$. During the fourth (and the last) day Ivan will read remaining page number $$$9$$$. | PASSED | 1,000 | standard input | 2 seconds | The first line contains single integer $$$n$$$ ($$$1 \le n \le 10^4$$$) — the number of pages in the book. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$i \le a_i \le n$$$), where $$$a_i$$$ is the number of page which contains the explanation of the mystery on page $$$i$$$. | ["4"] | #include<stdio.h>
int main(){
int n;
scanf("%d", &n);
int a[n], k, i, count = 0;
for(i = 1; i <= n; i++)
scanf("%d", &a[i]);
k = a[1];
for(i = 1; i <= n; i++){
if(a[i] > k){
k = a[i];
}
if(k == i){
k++;
count++;
}
}
... | |
Ivan recently bought a detective book. The book is so interesting that each page of this book introduces some sort of a mystery, which will be explained later. The $$$i$$$-th page contains some mystery that will be explained on page $$$a_i$$$ ($$$a_i \ge i$$$).Ivan wants to read the whole book. Each day, he reads the f... | Print one integer — the number of days it will take to read the whole book. | C | 291601d6cdafa4113c1154f0dda3470d | 77ca8c557ab87cfc0de1a6ad54dda19f | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553267100 | ["9\n1 3 3 6 7 6 8 8 9"] | NoteExplanation of the example test:During the first day Ivan will read only the first page. During the second day Ivan will read pages number $$$2$$$ and $$$3$$$. During the third day — pages $$$4$$$-$$$8$$$. During the fourth (and the last) day Ivan will read remaining page number $$$9$$$. | PASSED | 1,000 | standard input | 2 seconds | The first line contains single integer $$$n$$$ ($$$1 \le n \le 10^4$$$) — the number of pages in the book. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$i \le a_i \le n$$$), where $$$a_i$$$ is the number of page which contains the explanation of the mystery on page $$$i$$$. | ["4"] | #include<stdio.h>
int main(){
int n,arr[100000], i, j, point=0, count=0;
scanf("%d", &n);
for(i=0; i<n; i++) scanf("%d", &arr[i]);
for(i=0; i<n; i++)
{
if(arr[i]-1>point) point = arr[i]-1;
if(point == i) count++;
}
printf("%d", count);
}
| |
Ivan recently bought a detective book. The book is so interesting that each page of this book introduces some sort of a mystery, which will be explained later. The $$$i$$$-th page contains some mystery that will be explained on page $$$a_i$$$ ($$$a_i \ge i$$$).Ivan wants to read the whole book. Each day, he reads the f... | Print one integer — the number of days it will take to read the whole book. | C | 291601d6cdafa4113c1154f0dda3470d | 50c07f1b8ac035183045d1e390354f61 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1553267100 | ["9\n1 3 3 6 7 6 8 8 9"] | NoteExplanation of the example test:During the first day Ivan will read only the first page. During the second day Ivan will read pages number $$$2$$$ and $$$3$$$. During the third day — pages $$$4$$$-$$$8$$$. During the fourth (and the last) day Ivan will read remaining page number $$$9$$$. | PASSED | 1,000 | standard input | 2 seconds | The first line contains single integer $$$n$$$ ($$$1 \le n \le 10^4$$$) — the number of pages in the book. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$i \le a_i \le n$$$), where $$$a_i$$$ is the number of page which contains the explanation of the mystery on page $$$i$$$. | ["4"] | #include<stdio.h>
#include<string.h>
int v[10005];
int main()
{
int a,s,d,f,g;
scanf("%d",&a);
for(int i=1;i<=a;++i)
scanf("%d",&v[i]);
s=d=0;
for(int i=1;i<=a;++i)
{
if(s<v[i]) s=v[i];
if(s==i) ++d;
}
printf("%d\n",d);
}
| |
In a new version of the famous Pinball game, one of the most important parts of the game field is a sequence of n bumpers. The bumpers are numbered with integers from 1 to n from left to right. There are two types of bumpers. They are denoted by the characters '<' and '>'. When the ball hits the bumper at positio... | Print one integer — the number of positions in the sequence such that the ball will eventually fall from the game field if it starts at that position. | C | 6b4242ae9a52d36548dda79d93fe0aef | 059315d67770b2596c5d2b0e834024ea | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1477148700 | ["4\n<<><", "5\n>>>>>", "4\n>><<"] | NoteIn the first sample, the ball will fall from the field if starts at position 1 or position 2.In the second sample, any starting position will result in the ball falling from the field. | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the length of the sequence of bumpers. The second line contains the string, which consists of the characters '<' and '>'. The character at the i-th position of this string corresponds to the type of the i-th bumper. | ["2", "5", "0"] | #include <stdio.h>
#include <string.h>
int main() {
char s[200111];
int n;
scanf("%d", &n);
scanf("%s", s);
int i = 0, len = strlen(s);
int num = 0;
while (s[i] == '<') { i++; num++; }
i = len - 1;
while (s[i] == '>') { i--; num++; }
printf("%d", num);
return 0;
} | |
In a new version of the famous Pinball game, one of the most important parts of the game field is a sequence of n bumpers. The bumpers are numbered with integers from 1 to n from left to right. There are two types of bumpers. They are denoted by the characters '<' and '>'. When the ball hits the bumper at positio... | Print one integer — the number of positions in the sequence such that the ball will eventually fall from the game field if it starts at that position. | C | 6b4242ae9a52d36548dda79d93fe0aef | cddd7267c9f585334b83623e19618527 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1477148700 | ["4\n<<><", "5\n>>>>>", "4\n>><<"] | NoteIn the first sample, the ball will fall from the field if starts at position 1 or position 2.In the second sample, any starting position will result in the ball falling from the field. | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the length of the sequence of bumpers. The second line contains the string, which consists of the characters '<' and '>'. The character at the i-th position of this string corresponds to the type of the i-th bumper. | ["2", "5", "0"] | #include <stdio.h>
#include <string.h>
int main() {
int n;
char str[200000];
scanf("%d", &n);
scanf("%s", &str);
int count = 0;
int i = 0;
while (str[i] == '<') {
count++;
i++;
}
i = n - 1;
while (str[i] == '>') {
count++;
i--;
}
printf("%d", count);
return 0;
}
| |
In a new version of the famous Pinball game, one of the most important parts of the game field is a sequence of n bumpers. The bumpers are numbered with integers from 1 to n from left to right. There are two types of bumpers. They are denoted by the characters '<' and '>'. When the ball hits the bumper at positio... | Print one integer — the number of positions in the sequence such that the ball will eventually fall from the game field if it starts at that position. | C | 6b4242ae9a52d36548dda79d93fe0aef | 4009b260bab0f958636ce2ef59270121 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1477148700 | ["4\n<<><", "5\n>>>>>", "4\n>><<"] | NoteIn the first sample, the ball will fall from the field if starts at position 1 or position 2.In the second sample, any starting position will result in the ball falling from the field. | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the length of the sequence of bumpers. The second line contains the string, which consists of the characters '<' and '>'. The character at the i-th position of this string corresponds to the type of the i-th bumper. | ["2", "5", "0"] | #include <stdio.h>
#define N 200000
int main() {
static char s[N + 1];
int n, i, j;
scanf("%d%s", &n, s);
for (i = 0; i < n && s[i] == '<'; i++)
;
for (j = n - 1; j >= 0 && s[j] == '>'; j--)
;
printf("%d\n", i + (n - 1 - j));
return 0;
}
| |
In a new version of the famous Pinball game, one of the most important parts of the game field is a sequence of n bumpers. The bumpers are numbered with integers from 1 to n from left to right. There are two types of bumpers. They are denoted by the characters '<' and '>'. When the ball hits the bumper at positio... | Print one integer — the number of positions in the sequence such that the ball will eventually fall from the game field if it starts at that position. | C | 6b4242ae9a52d36548dda79d93fe0aef | 4f452d518424db6167ac6f9887a444a8 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1477148700 | ["4\n<<><", "5\n>>>>>", "4\n>><<"] | NoteIn the first sample, the ball will fall from the field if starts at position 1 or position 2.In the second sample, any starting position will result in the ball falling from the field. | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the length of the sequence of bumpers. The second line contains the string, which consists of the characters '<' and '>'. The character at the i-th position of this string corresponds to the type of the i-th bumper. | ["2", "5", "0"] | #include <stdio.h>
int main(void) {
long long int n,i,count=0;
scanf("%lld",&n);
char s[n];
scanf("%s",s);
for(i=0;i<n;i++)
{
if(s[i]=='<'){
count++;}
else
break;
}
for(i=n-1;i>=0;i--)
{
if(s[i]=='>')
{count++;}
else
break;
}
printf("%lld\n",count);
return 0;
}
| |
In a new version of the famous Pinball game, one of the most important parts of the game field is a sequence of n bumpers. The bumpers are numbered with integers from 1 to n from left to right. There are two types of bumpers. They are denoted by the characters '<' and '>'. When the ball hits the bumper at positio... | Print one integer — the number of positions in the sequence such that the ball will eventually fall from the game field if it starts at that position. | C | 6b4242ae9a52d36548dda79d93fe0aef | b04f0a5ae9debf245ca0aebb7f07c34e | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1477148700 | ["4\n<<><", "5\n>>>>>", "4\n>><<"] | NoteIn the first sample, the ball will fall from the field if starts at position 1 or position 2.In the second sample, any starting position will result in the ball falling from the field. | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the length of the sequence of bumpers. The second line contains the string, which consists of the characters '<' and '>'. The character at the i-th position of this string corresponds to the type of the i-th bumper. | ["2", "5", "0"] | #include<stdio.h>
#include<string.h>
int main()
{
int i,n,a=0,b=0;
char ch[200005],m;
scanf("%d",&n);
m=getchar();
gets(ch);
for(i=0; i<n; i++)
{
if(ch[i]=='<')
a++;
else
break;
}
for(i=n-1; i>=0; i--)
{
if(ch[i]=='>')
... | |
In a new version of the famous Pinball game, one of the most important parts of the game field is a sequence of n bumpers. The bumpers are numbered with integers from 1 to n from left to right. There are two types of bumpers. They are denoted by the characters '<' and '>'. When the ball hits the bumper at positio... | Print one integer — the number of positions in the sequence such that the ball will eventually fall from the game field if it starts at that position. | C | 6b4242ae9a52d36548dda79d93fe0aef | 142abfe0e493c491c931e6d9797ecd6c | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1477148700 | ["4\n<<><", "5\n>>>>>", "4\n>><<"] | NoteIn the first sample, the ball will fall from the field if starts at position 1 or position 2.In the second sample, any starting position will result in the ball falling from the field. | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the length of the sequence of bumpers. The second line contains the string, which consists of the characters '<' and '>'. The character at the i-th position of this string corresponds to the type of the i-th bumper. | ["2", "5", "0"] | #include<stdio.h>
#include<stdlib.h>
int main()
{
int n, i, j;
scanf("%d", &n);
char a[n+1];
scanf("%s", a);
i=0;
j=n-1;
while(a[i]=='<')
i++;
while(a[j]=='>')
j--;
j = n-1-j;
printf("%d", i+j);
return 0;
}
| |
In a new version of the famous Pinball game, one of the most important parts of the game field is a sequence of n bumpers. The bumpers are numbered with integers from 1 to n from left to right. There are two types of bumpers. They are denoted by the characters '<' and '>'. When the ball hits the bumper at positio... | Print one integer — the number of positions in the sequence such that the ball will eventually fall from the game field if it starts at that position. | C | 6b4242ae9a52d36548dda79d93fe0aef | a09e8b194d23ec8dd8f6e69d64218c90 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1477148700 | ["4\n<<><", "5\n>>>>>", "4\n>><<"] | NoteIn the first sample, the ball will fall from the field if starts at position 1 or position 2.In the second sample, any starting position will result in the ball falling from the field. | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the length of the sequence of bumpers. The second line contains the string, which consists of the characters '<' and '>'. The character at the i-th position of this string corresponds to the type of the i-th bumper. | ["2", "5", "0"] | #include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
char s[200002];
scanf("%s",s);
int i=0,count=0;
if(s[0]=='<')
{
while(s[i]=='<'){count++;i++;}
}
i=n-1;
if(s[n-1]=='>')
{
while(s[i]=='>'){count++;i--;}
}
printf("%d\n",count);
return 0;
}
| |
In a new version of the famous Pinball game, one of the most important parts of the game field is a sequence of n bumpers. The bumpers are numbered with integers from 1 to n from left to right. There are two types of bumpers. They are denoted by the characters '<' and '>'. When the ball hits the bumper at positio... | Print one integer — the number of positions in the sequence such that the ball will eventually fall from the game field if it starts at that position. | C | 6b4242ae9a52d36548dda79d93fe0aef | 6ebea0aaf806773cfab672e4c457216e | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1477148700 | ["4\n<<><", "5\n>>>>>", "4\n>><<"] | NoteIn the first sample, the ball will fall from the field if starts at position 1 or position 2.In the second sample, any starting position will result in the ball falling from the field. | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the length of the sequence of bumpers. The second line contains the string, which consists of the characters '<' and '>'. The character at the i-th position of this string corresponds to the type of the i-th bumper. | ["2", "5", "0"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int l , i = 1 , k ,ans;
//int ans = 0 , portion = 0;
scanf("%d",&l);
char arr[l + 1];
//while (i <= l && scanf(" %c", &arr[i++]) == 1);
scanf("%s",arr);
for( i = 0 ; i < (l-1) ; i++ )
{
if(arr[i] == '>' && arr[i+1] == '<')
... | |
In a new version of the famous Pinball game, one of the most important parts of the game field is a sequence of n bumpers. The bumpers are numbered with integers from 1 to n from left to right. There are two types of bumpers. They are denoted by the characters '<' and '>'. When the ball hits the bumper at positio... | Print one integer — the number of positions in the sequence such that the ball will eventually fall from the game field if it starts at that position. | C | 6b4242ae9a52d36548dda79d93fe0aef | 9e0f607e4c07466e80fb63328b3263da | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1477148700 | ["4\n<<><", "5\n>>>>>", "4\n>><<"] | NoteIn the first sample, the ball will fall from the field if starts at position 1 or position 2.In the second sample, any starting position will result in the ball falling from the field. | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the length of the sequence of bumpers. The second line contains the string, which consists of the characters '<' and '>'. The character at the i-th position of this string corresponds to the type of the i-th bumper. | ["2", "5", "0"] | #include <stdio.h>
int main()
{
int n, m=0, i, j;
char s[200005];
scanf("%d", &n);
scanf("%s",s);
for (i=0; i<n; i++)
{
if (s[i]=='<')
{
m++;
}
else
{
break;
}
}
for (i=n-1; i>=0; i--)
{
if (s[i]=='>')
{
m++;
}
else
{
break;
}
}
printf("%d", m);
return 0;
} | |
In a new version of the famous Pinball game, one of the most important parts of the game field is a sequence of n bumpers. The bumpers are numbered with integers from 1 to n from left to right. There are two types of bumpers. They are denoted by the characters '<' and '>'. When the ball hits the bumper at positio... | Print one integer — the number of positions in the sequence such that the ball will eventually fall from the game field if it starts at that position. | C | 6b4242ae9a52d36548dda79d93fe0aef | 01d7b387f7c1b3da4426e736c32513e4 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1477148700 | ["4\n<<><", "5\n>>>>>", "4\n>><<"] | NoteIn the first sample, the ball will fall from the field if starts at position 1 or position 2.In the second sample, any starting position will result in the ball falling from the field. | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the length of the sequence of bumpers. The second line contains the string, which consists of the characters '<' and '>'. The character at the i-th position of this string corresponds to the type of the i-th bumper. | ["2", "5", "0"] | #include <stdio.h>
int main(){
int n;
scanf("%d",&n);
char a[n];
scanf("%s",&a);
int num=0;
for(int i=0;i<n;i++){
if(a[i]=='<')
num++;
else{
break;
}
}
for(int i=n-1;i>=0;i--){
if(a[i]=='>')
num++;
else{
break;
}
}
printf("%d",num);
} | |
In a new version of the famous Pinball game, one of the most important parts of the game field is a sequence of n bumpers. The bumpers are numbered with integers from 1 to n from left to right. There are two types of bumpers. They are denoted by the characters '<' and '>'. When the ball hits the bumper at positio... | Print one integer — the number of positions in the sequence such that the ball will eventually fall from the game field if it starts at that position. | C | 6b4242ae9a52d36548dda79d93fe0aef | aabff62db86db09cc4b7676fd4f00d0c | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1477148700 | ["4\n<<><", "5\n>>>>>", "4\n>><<"] | NoteIn the first sample, the ball will fall from the field if starts at position 1 or position 2.In the second sample, any starting position will result in the ball falling from the field. | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the length of the sequence of bumpers. The second line contains the string, which consists of the characters '<' and '>'. The character at the i-th position of this string corresponds to the type of the i-th bumper. | ["2", "5", "0"] | #include <stdio.h>
#include <string.h>
int main()
{
long long n,i,r=0,p,s=0,t=0,f=0;
scanf("%I64d", &n);
char str[n];
scanf("%s",&str);
p = strlen(str);
for(i=0;i<p;i++)
{
if(str[i] == '>')
s++;
else if(s > 0 && str[i] == '<')
{
s = 0;
... | |
In a new version of the famous Pinball game, one of the most important parts of the game field is a sequence of n bumpers. The bumpers are numbered with integers from 1 to n from left to right. There are two types of bumpers. They are denoted by the characters '<' and '>'. When the ball hits the bumper at positio... | Print one integer — the number of positions in the sequence such that the ball will eventually fall from the game field if it starts at that position. | C | 6b4242ae9a52d36548dda79d93fe0aef | 09c474a483f170ae4e26819c0a6e51be | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1477148700 | ["4\n<<><", "5\n>>>>>", "4\n>><<"] | NoteIn the first sample, the ball will fall from the field if starts at position 1 or position 2.In the second sample, any starting position will result in the ball falling from the field. | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the length of the sequence of bumpers. The second line contains the string, which consists of the characters '<' and '>'. The character at the i-th position of this string corresponds to the type of the i-th bumper. | ["2", "5", "0"] | #include<stdio.h>
#include<string.h>
int main()
{
int n,count=0,i=0,j,k,p;
char s[200000];
scanf("%d",&n);
scanf("%s",s);
while(i<n)
{
k=1;
if(s[i]=='>')
{
for(j=i+1;j<n;j++)
{if(s[j]=='<')
{k=0;
break;}
}
if(k==1)
count+=n-i;
i=j+1;
}
//printf("%d\n",count);
else
i++;
}... | |
In a new version of the famous Pinball game, one of the most important parts of the game field is a sequence of n bumpers. The bumpers are numbered with integers from 1 to n from left to right. There are two types of bumpers. They are denoted by the characters '<' and '>'. When the ball hits the bumper at positio... | Print one integer — the number of positions in the sequence such that the ball will eventually fall from the game field if it starts at that position. | C | 6b4242ae9a52d36548dda79d93fe0aef | 72b1e8ab7ef057a3ec4f03a91ffce68e | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1477148700 | ["4\n<<><", "5\n>>>>>", "4\n>><<"] | NoteIn the first sample, the ball will fall from the field if starts at position 1 or position 2.In the second sample, any starting position will result in the ball falling from the field. | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the length of the sequence of bumpers. The second line contains the string, which consists of the characters '<' and '>'. The character at the i-th position of this string corresponds to the type of the i-th bumper. | ["2", "5", "0"] | #include<stdio.h>
#include<string.h>
int main()
{
int n,i,j,c,d,sum,s;
while(scanf("%d",&n)!=EOF)
{
c=0,d=0;
char array[n];
getchar();
gets(array);
s=strlen(array);
for(i=0; i<s; i++)
{
if(array[i]=='<')
{
c++;
... | |
In a new version of the famous Pinball game, one of the most important parts of the game field is a sequence of n bumpers. The bumpers are numbered with integers from 1 to n from left to right. There are two types of bumpers. They are denoted by the characters '<' and '>'. When the ball hits the bumper at positio... | Print one integer — the number of positions in the sequence such that the ball will eventually fall from the game field if it starts at that position. | C | 6b4242ae9a52d36548dda79d93fe0aef | 6025ee8d9e7623c20b439ec01879107e | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1477148700 | ["4\n<<><", "5\n>>>>>", "4\n>><<"] | NoteIn the first sample, the ball will fall from the field if starts at position 1 or position 2.In the second sample, any starting position will result in the ball falling from the field. | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the length of the sequence of bumpers. The second line contains the string, which consists of the characters '<' and '>'. The character at the i-th position of this string corresponds to the type of the i-th bumper. | ["2", "5", "0"] | #include<stdio.h>
int main()
{
int t,i,count1=0,count2=0,x;
scanf("%d",&t);
char str[t];
scanf("%s",str);
for(i=0;i<t;i++)
{
if(str[i]=='<')
count1++;
else
break;
}
for(i=t-1;i>=0;i--)
{
if(str[i]=='>')
count2++;
else
break;
}
printf("%d\n",x=count1+count2);
return 0;
} | |
In a new version of the famous Pinball game, one of the most important parts of the game field is a sequence of n bumpers. The bumpers are numbered with integers from 1 to n from left to right. There are two types of bumpers. They are denoted by the characters '<' and '>'. When the ball hits the bumper at positio... | Print one integer — the number of positions in the sequence such that the ball will eventually fall from the game field if it starts at that position. | C | 6b4242ae9a52d36548dda79d93fe0aef | eed03d5710c97958dd617f7e53414ba9 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1477148700 | ["4\n<<><", "5\n>>>>>", "4\n>><<"] | NoteIn the first sample, the ball will fall from the field if starts at position 1 or position 2.In the second sample, any starting position will result in the ball falling from the field. | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the length of the sequence of bumpers. The second line contains the string, which consists of the characters '<' and '>'. The character at the i-th position of this string corresponds to the type of the i-th bumper. | ["2", "5", "0"] | #include <stdio.h>
int main(void)
{
int n;
scanf("%d", &n);
char str[200001];
scanf("%s", str);
int count = 0;
int i = 0;
while(i < n && str[i++] == '<')
{
count++;
}
i = n - 1;
while(i >= 0 && str[i--] == '>')
{
count++;
}
printf("%d\n", count);
return 0;
} | |
In a new version of the famous Pinball game, one of the most important parts of the game field is a sequence of n bumpers. The bumpers are numbered with integers from 1 to n from left to right. There are two types of bumpers. They are denoted by the characters '<' and '>'. When the ball hits the bumper at positio... | Print one integer — the number of positions in the sequence such that the ball will eventually fall from the game field if it starts at that position. | C | 6b4242ae9a52d36548dda79d93fe0aef | 03d3d7828f6b7a99b17b9e6e07a1b0f5 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1477148700 | ["4\n<<><", "5\n>>>>>", "4\n>><<"] | NoteIn the first sample, the ball will fall from the field if starts at position 1 or position 2.In the second sample, any starting position will result in the ball falling from the field. | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the length of the sequence of bumpers. The second line contains the string, which consists of the characters '<' and '>'. The character at the i-th position of this string corresponds to the type of the i-th bumper. | ["2", "5", "0"] | #include <stdio.h>
char str[1<<18];
int main(void) {
int n;
int cnt = 0;
scanf("%d\n", &n);
fgets(str, n + 1, stdin);
for(int i = 0; str[i] == '<'; cnt = ++i);
for(int i = n - 1; str[i] == '>'; cnt++, i--);
printf("%d", cnt);
} | |
In a new version of the famous Pinball game, one of the most important parts of the game field is a sequence of n bumpers. The bumpers are numbered with integers from 1 to n from left to right. There are two types of bumpers. They are denoted by the characters '<' and '>'. When the ball hits the bumper at positio... | Print one integer — the number of positions in the sequence such that the ball will eventually fall from the game field if it starts at that position. | C | 6b4242ae9a52d36548dda79d93fe0aef | 900b76159e3dddeeb7e9a77078c03dec | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1477148700 | ["4\n<<><", "5\n>>>>>", "4\n>><<"] | NoteIn the first sample, the ball will fall from the field if starts at position 1 or position 2.In the second sample, any starting position will result in the ball falling from the field. | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the length of the sequence of bumpers. The second line contains the string, which consists of the characters '<' and '>'. The character at the i-th position of this string corresponds to the type of the i-th bumper. | ["2", "5", "0"] | #include<stdio.h>
int main()
{
int n,i,j=0,k=0;
scanf("%d",&n);
char a[n];
scanf("%s",a);
for(i=0;a[i]!='>' && i<n;i++)
++j;
for(i=n-1;a[i]!='<' && i>=0;--i)
++k;
printf("%d",j+k);
return 0;
}
| |
In a new version of the famous Pinball game, one of the most important parts of the game field is a sequence of n bumpers. The bumpers are numbered with integers from 1 to n from left to right. There are two types of bumpers. They are denoted by the characters '<' and '>'. When the ball hits the bumper at positio... | Print one integer — the number of positions in the sequence such that the ball will eventually fall from the game field if it starts at that position. | C | 6b4242ae9a52d36548dda79d93fe0aef | 5ddb81b17123b8e62ab64eed2af5d08f | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1477148700 | ["4\n<<><", "5\n>>>>>", "4\n>><<"] | NoteIn the first sample, the ball will fall from the field if starts at position 1 or position 2.In the second sample, any starting position will result in the ball falling from the field. | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the length of the sequence of bumpers. The second line contains the string, which consists of the characters '<' and '>'. The character at the i-th position of this string corresponds to the type of the i-th bumper. | ["2", "5", "0"] | #include<stdio.h>
int main()
{
int n,i,j=0,k=0;
scanf("%d",&n);
char a[n];
scanf("%s",a);
for(i=0;a[i]!='>' && i<n;i++)
++j;
for(i=n-1;a[i]!='<' && i>=0;--i)
++k;
printf("%d",j+k);
return 0;
}
| |
In a new version of the famous Pinball game, one of the most important parts of the game field is a sequence of n bumpers. The bumpers are numbered with integers from 1 to n from left to right. There are two types of bumpers. They are denoted by the characters '<' and '>'. When the ball hits the bumper at positio... | Print one integer — the number of positions in the sequence such that the ball will eventually fall from the game field if it starts at that position. | C | 6b4242ae9a52d36548dda79d93fe0aef | 97bde7444f6c96f0f47110ade89962ea | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1477148700 | ["4\n<<><", "5\n>>>>>", "4\n>><<"] | NoteIn the first sample, the ball will fall from the field if starts at position 1 or position 2.In the second sample, any starting position will result in the ball falling from the field. | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the length of the sequence of bumpers. The second line contains the string, which consists of the characters '<' and '>'. The character at the i-th position of this string corresponds to the type of the i-th bumper. | ["2", "5", "0"] | #include <stdio.h>
#include<math.h>
#include<string.h>
int main()
{
char str[1000000];
long long i, frequency = 0,f=0,n;
scanf("%I64d",&n);
scanf("%s",str);
for(i=0; str[i] != '\0';i++)
{
if(str[i]=='>')
break;
frequency++;
}
long long l=strlen(str);
for(i=l-1;i>=0;i--)
... | |
While sailing on a boat, Inessa noticed a beautiful water lily flower above the lake's surface. She came closer and it turned out that the lily was exactly $$$H$$$ centimeters above the water surface. Inessa grabbed the flower and sailed the distance of $$$L$$$ centimeters. Exactly at this point the flower touched the ... | Print a single number — the depth of the lake at point $$$A$$$. The absolute or relative error should not exceed $$$10^{-6}$$$. Formally, let your answer be $$$A$$$, and the jury's answer be $$$B$$$. Your answer is accepted if and only if $$$\frac{|A - B|}{\max{(1, |B|)}} \le 10^{-6}$$$. | C | 2cd5807e3f9685d4eff88f2283904f0d | 40c6687006d27d2db7f544cf44454c6f | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"geometry",
"math"
] | 1564497300 | ["1 2", "3 5"] | null | PASSED | 1,000 | standard input | 1 second | The only line contains two integers $$$H$$$ and $$$L$$$ ($$$1 \le H < L \le 10^{6}$$$). | ["1.5000000000000", "2.6666666666667"] | #include<stdio.h>
int main()
{
float a,b;
scanf("%f %f",&a,&b);
printf("%f",(b*b - a*a)/(2*a));
}
| |
While sailing on a boat, Inessa noticed a beautiful water lily flower above the lake's surface. She came closer and it turned out that the lily was exactly $$$H$$$ centimeters above the water surface. Inessa grabbed the flower and sailed the distance of $$$L$$$ centimeters. Exactly at this point the flower touched the ... | Print a single number — the depth of the lake at point $$$A$$$. The absolute or relative error should not exceed $$$10^{-6}$$$. Formally, let your answer be $$$A$$$, and the jury's answer be $$$B$$$. Your answer is accepted if and only if $$$\frac{|A - B|}{\max{(1, |B|)}} \le 10^{-6}$$$. | C | 2cd5807e3f9685d4eff88f2283904f0d | a9b4c8901da488e439e81a991a743b05 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"geometry",
"math"
] | 1564497300 | ["1 2", "3 5"] | null | PASSED | 1,000 | standard input | 1 second | The only line contains two integers $$$H$$$ and $$$L$$$ ($$$1 \le H < L \le 10^{6}$$$). | ["1.5000000000000", "2.6666666666667"] | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<limits.h>
int main()
{
float l,h;
scanf("%f %f",&h,&l);
double k;
k=l*l-h*h;
float ans=k/(2*h);
printf("%f",ans);
}
| |
While sailing on a boat, Inessa noticed a beautiful water lily flower above the lake's surface. She came closer and it turned out that the lily was exactly $$$H$$$ centimeters above the water surface. Inessa grabbed the flower and sailed the distance of $$$L$$$ centimeters. Exactly at this point the flower touched the ... | Print a single number — the depth of the lake at point $$$A$$$. The absolute or relative error should not exceed $$$10^{-6}$$$. Formally, let your answer be $$$A$$$, and the jury's answer be $$$B$$$. Your answer is accepted if and only if $$$\frac{|A - B|}{\max{(1, |B|)}} \le 10^{-6}$$$. | C | 2cd5807e3f9685d4eff88f2283904f0d | 645ac2fe1bb826c28fed32c66db412f0 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"geometry",
"math"
] | 1564497300 | ["1 2", "3 5"] | null | PASSED | 1,000 | standard input | 1 second | The only line contains two integers $$$H$$$ and $$$L$$$ ($$$1 \le H < L \le 10^{6}$$$). | ["1.5000000000000", "2.6666666666667"] | #include<stdio.h>
int main()
{
float s,l,a;
scanf("%f%f",&s,&l);
a=((l*l)-(s*s))/(2*s);
printf("%f",a);
return 0;
}
| |
While sailing on a boat, Inessa noticed a beautiful water lily flower above the lake's surface. She came closer and it turned out that the lily was exactly $$$H$$$ centimeters above the water surface. Inessa grabbed the flower and sailed the distance of $$$L$$$ centimeters. Exactly at this point the flower touched the ... | Print a single number — the depth of the lake at point $$$A$$$. The absolute or relative error should not exceed $$$10^{-6}$$$. Formally, let your answer be $$$A$$$, and the jury's answer be $$$B$$$. Your answer is accepted if and only if $$$\frac{|A - B|}{\max{(1, |B|)}} \le 10^{-6}$$$. | C | 2cd5807e3f9685d4eff88f2283904f0d | 126e49c4bac83f2c35b7909a7d8e37c7 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"geometry",
"math"
] | 1564497300 | ["1 2", "3 5"] | null | PASSED | 1,000 | standard input | 1 second | The only line contains two integers $$$H$$$ and $$$L$$$ ($$$1 \le H < L \le 10^{6}$$$). | ["1.5000000000000", "2.6666666666667"] | #include<stdio.h>
int main(){
float h,l,x;
scanf("%f%f",&h,&l);
x=(l*l-h*h)/(2.0*h);
printf("%.13f",x);
return 0;
} | |
While sailing on a boat, Inessa noticed a beautiful water lily flower above the lake's surface. She came closer and it turned out that the lily was exactly $$$H$$$ centimeters above the water surface. Inessa grabbed the flower and sailed the distance of $$$L$$$ centimeters. Exactly at this point the flower touched the ... | Print a single number — the depth of the lake at point $$$A$$$. The absolute or relative error should not exceed $$$10^{-6}$$$. Formally, let your answer be $$$A$$$, and the jury's answer be $$$B$$$. Your answer is accepted if and only if $$$\frac{|A - B|}{\max{(1, |B|)}} \le 10^{-6}$$$. | C | 2cd5807e3f9685d4eff88f2283904f0d | ae008be0d663149e6c222d5f95b34d86 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"geometry",
"math"
] | 1564497300 | ["1 2", "3 5"] | null | PASSED | 1,000 | standard input | 1 second | The only line contains two integers $$$H$$$ and $$$L$$$ ($$$1 \le H < L \le 10^{6}$$$). | ["1.5000000000000", "2.6666666666667"] | #include <stdio.h>
int main()
{
float a, b;
scanf("%f %f", &a, &b);
printf("%f\n", (b * b - a * a) / (2 * a));
}
| |
While sailing on a boat, Inessa noticed a beautiful water lily flower above the lake's surface. She came closer and it turned out that the lily was exactly $$$H$$$ centimeters above the water surface. Inessa grabbed the flower and sailed the distance of $$$L$$$ centimeters. Exactly at this point the flower touched the ... | Print a single number — the depth of the lake at point $$$A$$$. The absolute or relative error should not exceed $$$10^{-6}$$$. Formally, let your answer be $$$A$$$, and the jury's answer be $$$B$$$. Your answer is accepted if and only if $$$\frac{|A - B|}{\max{(1, |B|)}} \le 10^{-6}$$$. | C | 2cd5807e3f9685d4eff88f2283904f0d | 159c6497a102cd53146e763dd39f1577 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"geometry",
"math"
] | 1564497300 | ["1 2", "3 5"] | null | PASSED | 1,000 | standard input | 1 second | The only line contains two integers $$$H$$$ and $$$L$$$ ($$$1 \le H < L \le 10^{6}$$$). | ["1.5000000000000", "2.6666666666667"] | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
int main()
{
float h, l, a;
scanf("%f %f", &h, &l);
a = (l*l-h*h)/(2*h);
printf("%.12f\n", a);
}
| |
While sailing on a boat, Inessa noticed a beautiful water lily flower above the lake's surface. She came closer and it turned out that the lily was exactly $$$H$$$ centimeters above the water surface. Inessa grabbed the flower and sailed the distance of $$$L$$$ centimeters. Exactly at this point the flower touched the ... | Print a single number — the depth of the lake at point $$$A$$$. The absolute or relative error should not exceed $$$10^{-6}$$$. Formally, let your answer be $$$A$$$, and the jury's answer be $$$B$$$. Your answer is accepted if and only if $$$\frac{|A - B|}{\max{(1, |B|)}} \le 10^{-6}$$$. | C | 2cd5807e3f9685d4eff88f2283904f0d | fba5b4e2f3437ba7ea78ca70f0b99e78 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"geometry",
"math"
] | 1564497300 | ["1 2", "3 5"] | null | PASSED | 1,000 | standard input | 1 second | The only line contains two integers $$$H$$$ and $$$L$$$ ($$$1 \le H < L \le 10^{6}$$$). | ["1.5000000000000", "2.6666666666667"] | #include<stdio.h>
#include<math.h>
#include<stdlib.h>
int main()
{
int h,l;
float a;
scanf("%d %d",&h,&l);
a=l*tan(atan(1.0*h/l)-atan(1.0*l/h));
if(a<0)
a=-a;
printf("%.10f",a);
return 0;
}
| |
While sailing on a boat, Inessa noticed a beautiful water lily flower above the lake's surface. She came closer and it turned out that the lily was exactly $$$H$$$ centimeters above the water surface. Inessa grabbed the flower and sailed the distance of $$$L$$$ centimeters. Exactly at this point the flower touched the ... | Print a single number — the depth of the lake at point $$$A$$$. The absolute or relative error should not exceed $$$10^{-6}$$$. Formally, let your answer be $$$A$$$, and the jury's answer be $$$B$$$. Your answer is accepted if and only if $$$\frac{|A - B|}{\max{(1, |B|)}} \le 10^{-6}$$$. | C | 2cd5807e3f9685d4eff88f2283904f0d | ccd3d653f06ce24c0246a92fdeb72b26 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"geometry",
"math"
] | 1564497300 | ["1 2", "3 5"] | null | PASSED | 1,000 | standard input | 1 second | The only line contains two integers $$$H$$$ and $$$L$$$ ($$$1 \le H < L \le 10^{6}$$$). | ["1.5000000000000", "2.6666666666667"] | #include<stdio.h>
int main()
{
float h,l;
scanf("%f %f",&h,&l);
printf("%.13f",(l*l-h*h)/2/h);
}
| |
While sailing on a boat, Inessa noticed a beautiful water lily flower above the lake's surface. She came closer and it turned out that the lily was exactly $$$H$$$ centimeters above the water surface. Inessa grabbed the flower and sailed the distance of $$$L$$$ centimeters. Exactly at this point the flower touched the ... | Print a single number — the depth of the lake at point $$$A$$$. The absolute or relative error should not exceed $$$10^{-6}$$$. Formally, let your answer be $$$A$$$, and the jury's answer be $$$B$$$. Your answer is accepted if and only if $$$\frac{|A - B|}{\max{(1, |B|)}} \le 10^{-6}$$$. | C | 2cd5807e3f9685d4eff88f2283904f0d | 26cd6c26ea4ba99ff2f92242d13d305d | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"geometry",
"math"
] | 1564497300 | ["1 2", "3 5"] | null | PASSED | 1,000 | standard input | 1 second | The only line contains two integers $$$H$$$ and $$$L$$$ ($$$1 \le H < L \le 10^{6}$$$). | ["1.5000000000000", "2.6666666666667"] | main(h,l){scanf("%d%d",&h,&l);printf("%.9f",l/2.0*l/h-h/2.0);} | |
DZY loves colors, and he enjoys painting.On a colorful day, DZY gets a colorful ribbon, which consists of n units (they are numbered from 1 to n from left to right). The color of the i-th unit of the ribbon is i at first. It is colorful enough, but we still consider that the colorfulness of each unit is 0 at first.DZY ... | For each operation 2, print a line containing the answer — sum of colorfulness. | C | 562656bfc27b7cf06f7c4a373c6bc029 | c9b7e0f17aa0d9429704fff539ea2278 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"data structures"
] | 1404651900 | ["3 3\n1 1 2 4\n1 2 3 5\n2 1 3", "3 4\n1 1 3 4\n2 1 1\n2 2 2\n2 3 3", "10 6\n1 1 5 3\n1 2 7 9\n1 10 10 11\n1 3 8 12\n1 1 10 3\n2 1 10"] | NoteIn the first sample, the color of each unit is initially [1, 2, 3], and the colorfulness is [0, 0, 0].After the first operation, colors become [4, 4, 3], colorfulness become [3, 2, 0].After the second operation, colors become [4, 5, 5], colorfulness become [3, 3, 2].So the answer to the only operation of type 2 is ... | PASSED | 2,400 | standard input | 2 seconds | The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105). Each of the next m lines begins with a integer type (1 ≤ type ≤ 2), which represents the type of this operation. If type = 1, there will be 3 more integers l, r, x (1 ≤ l ≤ r ≤ n; 1 ≤ x ≤ 108) in this line, describing an operation 1. If type = ... | ["8", "3\n2\n1", "129"] | #include <stdio.h>
#include <string.h>
#include <math.h>
#define ll __int64
#define in(a) scanf("%d", &a)
#define out(b) printf("%I64d\n", b)
#define maxn 100000 + 4
#define lson l, mid, rt << 1
#define rson mid + 1, r, rt << 1 | 1
ll sum[maxn << 2], lazy[maxn << 2];
int color[maxn << 2];
void pushUp(int rt) {
sum[r... | |
DZY loves colors, and he enjoys painting.On a colorful day, DZY gets a colorful ribbon, which consists of n units (they are numbered from 1 to n from left to right). The color of the i-th unit of the ribbon is i at first. It is colorful enough, but we still consider that the colorfulness of each unit is 0 at first.DZY ... | For each operation 2, print a line containing the answer — sum of colorfulness. | C | 562656bfc27b7cf06f7c4a373c6bc029 | 7acece5f0fff48c680030f5323270290 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"data structures"
] | 1404651900 | ["3 3\n1 1 2 4\n1 2 3 5\n2 1 3", "3 4\n1 1 3 4\n2 1 1\n2 2 2\n2 3 3", "10 6\n1 1 5 3\n1 2 7 9\n1 10 10 11\n1 3 8 12\n1 1 10 3\n2 1 10"] | NoteIn the first sample, the color of each unit is initially [1, 2, 3], and the colorfulness is [0, 0, 0].After the first operation, colors become [4, 4, 3], colorfulness become [3, 2, 0].After the second operation, colors become [4, 5, 5], colorfulness become [3, 3, 2].So the answer to the only operation of type 2 is ... | PASSED | 2,400 | standard input | 2 seconds | The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105). Each of the next m lines begins with a integer type (1 ≤ type ≤ 2), which represents the type of this operation. If type = 1, there will be 3 more integers l, r, x (1 ≤ l ≤ r ≤ n; 1 ≤ x ≤ 108) in this line, describing an operation 1. If type = ... | ["8", "3\n2\n1", "129"] | #include <stdio.h>
#include <string.h>
#include <math.h>
#define ll __int64
#define in(a) scanf("%d", &a)
#define out(b) printf("%I64d\n", b)
#define maxn 100000 + 4
#define lson l, mid, rt << 1
#define rson mid + 1, r, rt << 1 | 1
ll sum[maxn << 2], lazy[maxn << 2];
int color[maxn << 2];
void pushUp(int rt) {
sum[r... | |
An array of integers $$$p_1, p_2, \dots, p_n$$$ is called a permutation if it contains each number from $$$1$$$ to $$$n$$$ exactly once. For example, the following arrays are permutations: $$$[3, 1, 2]$$$, $$$[1]$$$, $$$[1, 2, 3, 4, 5]$$$ and $$$[4, 3, 1, 2]$$$. The following arrays are not permutations: $$$[2]$$$, $$$... | Print the integer -1 if there is no such permutation of length $$$n$$$ which corresponds to the given array $$$q$$$. Otherwise, if it exists, print $$$p_1, p_2, \dots, p_n$$$. Print any such permutation if there are many of them. | C | b6ac7c30b7efdc7206dbbad5cfb86db7 | 247f7086c1862b81923713aa42151741 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1553006100 | ["3\n-2 1", "5\n1 1 1 1", "4\n-1 2 2"] | null | PASSED | 1,500 | standard input | 2 seconds | The first line contains the integer $$$n$$$ ($$$2 \le n \le 2\cdot10^5$$$) — the length of the permutation to restore. The second line contains $$$n-1$$$ integers $$$q_1, q_2, \dots, q_{n-1}$$$ ($$$-n < q_i < n$$$). | ["3 1 2", "1 2 3 4 5", "-1"] | #include<stdio.h>
#include<stdlib.h>
#define size 2*100000
main()
{
long long int n,i,k=0;
long long int a[size+1];
long long int ans[size+2];
long long int cnt[size+1]={0};
long long int sum=0;
scanf("%I64d",&n);
for(i=0;i<n-1;++i)
{
scanf("%I64d",&a[i]);
sum+=a[i];
}
if(sum==0)
{
printf("-1");
}
else
{... | |
An array of integers $$$p_1, p_2, \dots, p_n$$$ is called a permutation if it contains each number from $$$1$$$ to $$$n$$$ exactly once. For example, the following arrays are permutations: $$$[3, 1, 2]$$$, $$$[1]$$$, $$$[1, 2, 3, 4, 5]$$$ and $$$[4, 3, 1, 2]$$$. The following arrays are not permutations: $$$[2]$$$, $$$... | Print the integer -1 if there is no such permutation of length $$$n$$$ which corresponds to the given array $$$q$$$. Otherwise, if it exists, print $$$p_1, p_2, \dots, p_n$$$. Print any such permutation if there are many of them. | C | b6ac7c30b7efdc7206dbbad5cfb86db7 | 3b42ec776d137bcb1975d6cbc81c4a5a | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1553006100 | ["3\n-2 1", "5\n1 1 1 1", "4\n-1 2 2"] | null | PASSED | 1,500 | standard input | 2 seconds | The first line contains the integer $$$n$$$ ($$$2 \le n \le 2\cdot10^5$$$) — the length of the permutation to restore. The second line contains $$$n-1$$$ integers $$$q_1, q_2, \dots, q_{n-1}$$$ ($$$-n < q_i < n$$$). | ["3 1 2", "1 2 3 4 5", "-1"] | #include <stdio.h>
#include <stdint.h>
#include <string.h>
#define P_SIZE 200000 + 4
#define ABS(x) (((x)^((x) >> 31)) + (1&((x) >> 31)))
#define PREFIX_ID(id) (id+1)
uint32_t n;
int32_t ready[P_SIZE];
int32_t p[P_SIZE+1];
uint8_t exists[P_SIZE];
#define LEFT_BIT_ONE (1 << 31)
struct sub_sum {
uint32_t left;
... | |
An array of integers $$$p_1, p_2, \dots, p_n$$$ is called a permutation if it contains each number from $$$1$$$ to $$$n$$$ exactly once. For example, the following arrays are permutations: $$$[3, 1, 2]$$$, $$$[1]$$$, $$$[1, 2, 3, 4, 5]$$$ and $$$[4, 3, 1, 2]$$$. The following arrays are not permutations: $$$[2]$$$, $$$... | Print the integer -1 if there is no such permutation of length $$$n$$$ which corresponds to the given array $$$q$$$. Otherwise, if it exists, print $$$p_1, p_2, \dots, p_n$$$. Print any such permutation if there are many of them. | C | b6ac7c30b7efdc7206dbbad5cfb86db7 | ae0f7be4ed34f06d6bb8d904b1c05fe0 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1553006100 | ["3\n-2 1", "5\n1 1 1 1", "4\n-1 2 2"] | null | PASSED | 1,500 | standard input | 2 seconds | The first line contains the integer $$$n$$$ ($$$2 \le n \le 2\cdot10^5$$$) — the length of the permutation to restore. The second line contains $$$n-1$$$ integers $$$q_1, q_2, \dots, q_{n-1}$$$ ($$$-n < q_i < n$$$). | ["3 1 2", "1 2 3 4 5", "-1"] | #include<stdio.h>
#include<math.h>
long long arr[200010]={};
int main(){
long long n;int inarr[200010];
scanf("%lld",&n);
for(int i=1;i<n ; i++){
scanf("%d",&inarr[i]);
arr[i]=arr[i-1]+inarr[i];
}
long long sum=0;
for(int i=1;i<n; i++){
sum+=arr[i];
arr[i]=0;
}
inarr[0... | |
An array of integers $$$p_1, p_2, \dots, p_n$$$ is called a permutation if it contains each number from $$$1$$$ to $$$n$$$ exactly once. For example, the following arrays are permutations: $$$[3, 1, 2]$$$, $$$[1]$$$, $$$[1, 2, 3, 4, 5]$$$ and $$$[4, 3, 1, 2]$$$. The following arrays are not permutations: $$$[2]$$$, $$$... | Print the integer -1 if there is no such permutation of length $$$n$$$ which corresponds to the given array $$$q$$$. Otherwise, if it exists, print $$$p_1, p_2, \dots, p_n$$$. Print any such permutation if there are many of them. | C | b6ac7c30b7efdc7206dbbad5cfb86db7 | 6f998298cadc7d9c46dd67ddd2ced1c9 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1553006100 | ["3\n-2 1", "5\n1 1 1 1", "4\n-1 2 2"] | null | PASSED | 1,500 | standard input | 2 seconds | The first line contains the integer $$$n$$$ ($$$2 \le n \le 2\cdot10^5$$$) — the length of the permutation to restore. The second line contains $$$n-1$$$ integers $$$q_1, q_2, \dots, q_{n-1}$$$ ($$$-n < q_i < n$$$). | ["3 1 2", "1 2 3 4 5", "-1"] | #include <stdio.h>
#include <stdlib.h>
int cmpfunc (const void * a, const void * b) {
return ( *(int*)a - *(int*)b );
}
int main()
{
int i, b, c, d, e, f,check=0,check1 =0,min =1;
scanf("%d", &i);
int br[i], cr[i+1], dr[i+1];
cr[0] = 1;
for(b=0; b<i-1; b++)
{
scanf("%d", &br[b]);
cr[b+1] = cr[b] + br[b];
... | |
An array of integers $$$p_1, p_2, \dots, p_n$$$ is called a permutation if it contains each number from $$$1$$$ to $$$n$$$ exactly once. For example, the following arrays are permutations: $$$[3, 1, 2]$$$, $$$[1]$$$, $$$[1, 2, 3, 4, 5]$$$ and $$$[4, 3, 1, 2]$$$. The following arrays are not permutations: $$$[2]$$$, $$$... | Print the integer -1 if there is no such permutation of length $$$n$$$ which corresponds to the given array $$$q$$$. Otherwise, if it exists, print $$$p_1, p_2, \dots, p_n$$$. Print any such permutation if there are many of them. | C | b6ac7c30b7efdc7206dbbad5cfb86db7 | 11f85dcf9b7b9dd06a47c9fb255a42aa | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1553006100 | ["3\n-2 1", "5\n1 1 1 1", "4\n-1 2 2"] | null | PASSED | 1,500 | standard input | 2 seconds | The first line contains the integer $$$n$$$ ($$$2 \le n \le 2\cdot10^5$$$) — the length of the permutation to restore. The second line contains $$$n-1$$$ integers $$$q_1, q_2, \dots, q_{n-1}$$$ ($$$-n < q_i < n$$$). | ["3 1 2", "1 2 3 4 5", "-1"] | #include <stdio.h>
#include <stdlib.h>
#define SWAP(a , b) *a = *a ^ *b; *b = *a ^ *b; *a = *a ^ *b;
#define INP_INT_ARA(ara_ads , size) for(int i = 0; i < size ; i++) scanf("%d",(ara_ads + i));
double qSum = 0 , tempP , tempN ;
int n , p[200000] = {0} , q[199999] = {0} , flag[200001] = {0};
int main(void) {
sc... | |
An array of integers $$$p_1, p_2, \dots, p_n$$$ is called a permutation if it contains each number from $$$1$$$ to $$$n$$$ exactly once. For example, the following arrays are permutations: $$$[3, 1, 2]$$$, $$$[1]$$$, $$$[1, 2, 3, 4, 5]$$$ and $$$[4, 3, 1, 2]$$$. The following arrays are not permutations: $$$[2]$$$, $$$... | Print the integer -1 if there is no such permutation of length $$$n$$$ which corresponds to the given array $$$q$$$. Otherwise, if it exists, print $$$p_1, p_2, \dots, p_n$$$. Print any such permutation if there are many of them. | C | b6ac7c30b7efdc7206dbbad5cfb86db7 | 46a5b3f2c009e760e7acccb59dfad2b1 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1553006100 | ["3\n-2 1", "5\n1 1 1 1", "4\n-1 2 2"] | null | PASSED | 1,500 | standard input | 2 seconds | The first line contains the integer $$$n$$$ ($$$2 \le n \le 2\cdot10^5$$$) — the length of the permutation to restore. The second line contains $$$n-1$$$ integers $$$q_1, q_2, \dots, q_{n-1}$$$ ($$$-n < q_i < n$$$). | ["3 1 2", "1 2 3 4 5", "-1"] | #include<stdio.h>
#include<math.h>
int y[200001]={0};
int main()
{
int n,i,j,k=0,min=0;
scanf("%d",&n);
int a[n],b[n],c[n];
for(i=1;i<n;i++)
{
scanf("%d",&a[i]);
k=k+a[i];
if(k>n || k<-n)
{
printf("-1");
return 0;
}
if(k<min)
... | |
An array of integers $$$p_1, p_2, \dots, p_n$$$ is called a permutation if it contains each number from $$$1$$$ to $$$n$$$ exactly once. For example, the following arrays are permutations: $$$[3, 1, 2]$$$, $$$[1]$$$, $$$[1, 2, 3, 4, 5]$$$ and $$$[4, 3, 1, 2]$$$. The following arrays are not permutations: $$$[2]$$$, $$$... | Print the integer -1 if there is no such permutation of length $$$n$$$ which corresponds to the given array $$$q$$$. Otherwise, if it exists, print $$$p_1, p_2, \dots, p_n$$$. Print any such permutation if there are many of them. | C | b6ac7c30b7efdc7206dbbad5cfb86db7 | 6bbc91cff589c33041eafafec45f1480 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1553006100 | ["3\n-2 1", "5\n1 1 1 1", "4\n-1 2 2"] | null | PASSED | 1,500 | standard input | 2 seconds | The first line contains the integer $$$n$$$ ($$$2 \le n \le 2\cdot10^5$$$) — the length of the permutation to restore. The second line contains $$$n-1$$$ integers $$$q_1, q_2, \dots, q_{n-1}$$$ ($$$-n < q_i < n$$$). | ["3 1 2", "1 2 3 4 5", "-1"] | #include<stdio.h>
void merge(int arr[], int l, int m, int r)
{
int n1 = m - l + 1;
int n2 = r - m;
// Create temp arrays
int L[n1], R[n2];
// Copy data to temp arrays L[] and R[]
for(int i = 0; i < n1; i++)
L[i] = arr[l + i];
for(int j = 0; j < n2; j++)
R[j] = arr[m + 1... | |
An array of integers $$$p_1, p_2, \dots, p_n$$$ is called a permutation if it contains each number from $$$1$$$ to $$$n$$$ exactly once. For example, the following arrays are permutations: $$$[3, 1, 2]$$$, $$$[1]$$$, $$$[1, 2, 3, 4, 5]$$$ and $$$[4, 3, 1, 2]$$$. The following arrays are not permutations: $$$[2]$$$, $$$... | Print the integer -1 if there is no such permutation of length $$$n$$$ which corresponds to the given array $$$q$$$. Otherwise, if it exists, print $$$p_1, p_2, \dots, p_n$$$. Print any such permutation if there are many of them. | C | b6ac7c30b7efdc7206dbbad5cfb86db7 | 6237585f78791139468d2bd2ba907e9c | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1553006100 | ["3\n-2 1", "5\n1 1 1 1", "4\n-1 2 2"] | null | PASSED | 1,500 | standard input | 2 seconds | The first line contains the integer $$$n$$$ ($$$2 \le n \le 2\cdot10^5$$$) — the length of the permutation to restore. The second line contains $$$n-1$$$ integers $$$q_1, q_2, \dots, q_{n-1}$$$ ($$$-n < q_i < n$$$). | ["3 1 2", "1 2 3 4 5", "-1"] | #include <stdio.h>
#include <string.h>
int main() {
int a[200010], test[200010];
int N, i, temp, MAX = 0, p1;
scanf("%d", &N);
a[0] = 0;
for(i = 1; i < N; i++) {
scanf("%d", &temp);
a[i] = a[i - 1] + temp;
if(a[i] > N || a[i] < 1 - N) {
printf("-1\n");
return 0;
}
if(a[i] > MAX) MAX = a[i];
}
m... | |
An array of integers $$$p_1, p_2, \dots, p_n$$$ is called a permutation if it contains each number from $$$1$$$ to $$$n$$$ exactly once. For example, the following arrays are permutations: $$$[3, 1, 2]$$$, $$$[1]$$$, $$$[1, 2, 3, 4, 5]$$$ and $$$[4, 3, 1, 2]$$$. The following arrays are not permutations: $$$[2]$$$, $$$... | Print the integer -1 if there is no such permutation of length $$$n$$$ which corresponds to the given array $$$q$$$. Otherwise, if it exists, print $$$p_1, p_2, \dots, p_n$$$. Print any such permutation if there are many of them. | C | b6ac7c30b7efdc7206dbbad5cfb86db7 | 8240756ba16220791fbb9279672a8be4 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1553006100 | ["3\n-2 1", "5\n1 1 1 1", "4\n-1 2 2"] | null | PASSED | 1,500 | standard input | 2 seconds | The first line contains the integer $$$n$$$ ($$$2 \le n \le 2\cdot10^5$$$) — the length of the permutation to restore. The second line contains $$$n-1$$$ integers $$$q_1, q_2, \dots, q_{n-1}$$$ ($$$-n < q_i < n$$$). | ["3 1 2", "1 2 3 4 5", "-1"] | #include<stdio.h>
void merge(int a[],int l,int m,int r)
{
int i=0,j=m+1,k=l;
int size1=m-l+1;
int size2=r-m;
int leftArr[size1],rightArr[size2];
for(int i=0;i<size1;i++){
leftArr[i]=a[l+i];
}
for(int i=0;i<size2;i++){
rightArr[i]=a[m+1+i];
}
i=0;
j=0;
while(i<size1&&j<size2)
... | |
An array of integers $$$p_1, p_2, \dots, p_n$$$ is called a permutation if it contains each number from $$$1$$$ to $$$n$$$ exactly once. For example, the following arrays are permutations: $$$[3, 1, 2]$$$, $$$[1]$$$, $$$[1, 2, 3, 4, 5]$$$ and $$$[4, 3, 1, 2]$$$. The following arrays are not permutations: $$$[2]$$$, $$$... | Print the integer -1 if there is no such permutation of length $$$n$$$ which corresponds to the given array $$$q$$$. Otherwise, if it exists, print $$$p_1, p_2, \dots, p_n$$$. Print any such permutation if there are many of them. | C | b6ac7c30b7efdc7206dbbad5cfb86db7 | ef0e65673016cfaab9c8b29d6c9011ee | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1553006100 | ["3\n-2 1", "5\n1 1 1 1", "4\n-1 2 2"] | null | PASSED | 1,500 | standard input | 2 seconds | The first line contains the integer $$$n$$$ ($$$2 \le n \le 2\cdot10^5$$$) — the length of the permutation to restore. The second line contains $$$n-1$$$ integers $$$q_1, q_2, \dots, q_{n-1}$$$ ($$$-n < q_i < n$$$). | ["3 1 2", "1 2 3 4 5", "-1"] | /// Property of vipulks \\
#include <stdio.h>
#include <limits.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
int main(){
ll t,n,m,i,j,k,cnt;
t=1;
//scanf("%lld",&t);
while(t--){
bool ok=true;
scanf("%lld",&n);
ll q[n+2],p[n+2],pref[n+3];
for(i=1;i<... | |
An array of integers $$$p_1, p_2, \dots, p_n$$$ is called a permutation if it contains each number from $$$1$$$ to $$$n$$$ exactly once. For example, the following arrays are permutations: $$$[3, 1, 2]$$$, $$$[1]$$$, $$$[1, 2, 3, 4, 5]$$$ and $$$[4, 3, 1, 2]$$$. The following arrays are not permutations: $$$[2]$$$, $$$... | Print the integer -1 if there is no such permutation of length $$$n$$$ which corresponds to the given array $$$q$$$. Otherwise, if it exists, print $$$p_1, p_2, \dots, p_n$$$. Print any such permutation if there are many of them. | C | b6ac7c30b7efdc7206dbbad5cfb86db7 | 29d4f0def3f05548f7e3549a2b3b5381 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1553006100 | ["3\n-2 1", "5\n1 1 1 1", "4\n-1 2 2"] | null | PASSED | 1,500 | standard input | 2 seconds | The first line contains the integer $$$n$$$ ($$$2 \le n \le 2\cdot10^5$$$) — the length of the permutation to restore. The second line contains $$$n-1$$$ integers $$$q_1, q_2, \dots, q_{n-1}$$$ ($$$-n < q_i < n$$$). | ["3 1 2", "1 2 3 4 5", "-1"] | #include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#define maxn 200001
int min(int a, int b){
return (a < b ? a : b);
}
void quick_sort(int a[], int l, int r){
int i = l, j = r, mid, tmp;
mid = a[(l + r + 1) / 2];
do{
while(a[i] < mid) i++;
while(mid < a[j]) j--;
if(i <... | |
An array of integers $$$p_1, p_2, \dots, p_n$$$ is called a permutation if it contains each number from $$$1$$$ to $$$n$$$ exactly once. For example, the following arrays are permutations: $$$[3, 1, 2]$$$, $$$[1]$$$, $$$[1, 2, 3, 4, 5]$$$ and $$$[4, 3, 1, 2]$$$. The following arrays are not permutations: $$$[2]$$$, $$$... | Print the integer -1 if there is no such permutation of length $$$n$$$ which corresponds to the given array $$$q$$$. Otherwise, if it exists, print $$$p_1, p_2, \dots, p_n$$$. Print any such permutation if there are many of them. | C | b6ac7c30b7efdc7206dbbad5cfb86db7 | d1ed764dfc81ccf9884b9018103f2184 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1553006100 | ["3\n-2 1", "5\n1 1 1 1", "4\n-1 2 2"] | null | PASSED | 1,500 | standard input | 2 seconds | The first line contains the integer $$$n$$$ ($$$2 \le n \le 2\cdot10^5$$$) — the length of the permutation to restore. The second line contains $$$n-1$$$ integers $$$q_1, q_2, \dots, q_{n-1}$$$ ($$$-n < q_i < n$$$). | ["3 1 2", "1 2 3 4 5", "-1"] | # include <stdio.h>
long long cun[200010];
long long fang[200010];
long long cha[200010];
int main ()
{
long long max,xu,a,b,c,d,e,i,j,k,n;
scanf("%lld",&n);
max=0;
xu=1;
c=0;
fang[1]=0;
for(i=1;i<=n;i++)
{
cha[i]=0;
if(i<n)
scanf("%lld",&cun[i]);
if(i!=n)
{
fang[i+1]=fang[i]+cun[i];
if(fang[i+1]... | |
An array of integers $$$p_1, p_2, \dots, p_n$$$ is called a permutation if it contains each number from $$$1$$$ to $$$n$$$ exactly once. For example, the following arrays are permutations: $$$[3, 1, 2]$$$, $$$[1]$$$, $$$[1, 2, 3, 4, 5]$$$ and $$$[4, 3, 1, 2]$$$. The following arrays are not permutations: $$$[2]$$$, $$$... | Print the integer -1 if there is no such permutation of length $$$n$$$ which corresponds to the given array $$$q$$$. Otherwise, if it exists, print $$$p_1, p_2, \dots, p_n$$$. Print any such permutation if there are many of them. | C | b6ac7c30b7efdc7206dbbad5cfb86db7 | 3c510c6d00612eb04f0afd678aaa9a3f | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1553006100 | ["3\n-2 1", "5\n1 1 1 1", "4\n-1 2 2"] | null | PASSED | 1,500 | standard input | 2 seconds | The first line contains the integer $$$n$$$ ($$$2 \le n \le 2\cdot10^5$$$) — the length of the permutation to restore. The second line contains $$$n-1$$$ integers $$$q_1, q_2, \dots, q_{n-1}$$$ ($$$-n < q_i < n$$$). | ["3 1 2", "1 2 3 4 5", "-1"] | #include <stdio.h>
#include <limits.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
typedef long long i64;
i64 min(i64 a, i64 b) {
return a < b ? a : b;
}
i64 max(i64 a, i64 b) {
return a > b ? a : b;
}
i64 minimum(i64* a, int n) {
i64 m = LLONG_MAX;
while(n-- > 0)
m = min(m, *a++);
return m;
... | |
An array of integers $$$p_1, p_2, \dots, p_n$$$ is called a permutation if it contains each number from $$$1$$$ to $$$n$$$ exactly once. For example, the following arrays are permutations: $$$[3, 1, 2]$$$, $$$[1]$$$, $$$[1, 2, 3, 4, 5]$$$ and $$$[4, 3, 1, 2]$$$. The following arrays are not permutations: $$$[2]$$$, $$$... | Print the integer -1 if there is no such permutation of length $$$n$$$ which corresponds to the given array $$$q$$$. Otherwise, if it exists, print $$$p_1, p_2, \dots, p_n$$$. Print any such permutation if there are many of them. | C | b6ac7c30b7efdc7206dbbad5cfb86db7 | da3f04d8264b7e17d13a4582188bf4d4 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1553006100 | ["3\n-2 1", "5\n1 1 1 1", "4\n-1 2 2"] | null | PASSED | 1,500 | standard input | 2 seconds | The first line contains the integer $$$n$$$ ($$$2 \le n \le 2\cdot10^5$$$) — the length of the permutation to restore. The second line contains $$$n-1$$$ integers $$$q_1, q_2, \dots, q_{n-1}$$$ ($$$-n < q_i < n$$$). | ["3 1 2", "1 2 3 4 5", "-1"] | #include <stdio.h>
#include <stdlib.h>
int com(const void *a, const void *b)
{
return (*(int *)a - *(int *)b);
}
int main()
{
int n, m, i;
scanf("%d", &n);
int p[n], q[n-1], v[n];
p[0]=2;
for(i=0; i<(n-1); i++){
scanf("%d", &q[i]);
p[i+1]=q[i]+p[i];
}
for(i=0; i<n; i++)... | |
Vasya owns three big integers — $$$a, l, r$$$. Let's define a partition of $$$x$$$ such a sequence of strings $$$s_1, s_2, \dots, s_k$$$ that $$$s_1 + s_2 + \dots + s_k = x$$$, where $$$+$$$ is a concatanation of strings. $$$s_i$$$ is the $$$i$$$-th element of the partition. For example, number $$$12345$$$ has the foll... | Print a single integer — the amount of partitions of number $$$a$$$ such that they match all the given requirements modulo $$$998244353$$$. | C | 0d212ea4fc9f03fdd682289fca9b517e | 164465db3c1b11861cac17b14b8712b7 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"hashing",
"data structures",
"binary search",
"strings"
] | 1537454700 | ["135\n1\n15", "10000\n0\n9"] | NoteIn the first test case, there are two good partitions $$$13+5$$$ and $$$1+3+5$$$.In the second test case, there is one good partition $$$1+0+0+0+0$$$. | PASSED | 2,600 | standard input | 1 second | The first line contains a single integer $$$a~(1 \le a \le 10^{1000000})$$$. The second line contains a single integer $$$l~(0 \le l \le 10^{1000000})$$$. The third line contains a single integer $$$r~(0 \le r \le 10^{1000000})$$$. It is guaranteed that $$$l \le r$$$. It is also guaranteed that numbers $$$a, l, r$$$ co... | ["2", "1"] | /* practice with Dukkha */
#include <stdio.h>
#include <string.h>
#define N 1000001
#define MD 998244353
int min(int a, int b) { return a < b ? a : b; }
void zzz(char *cc, int n, int *zz) {
int i, l, r;
for (i = 1, l = r = 0; i < n; i++)
if (i + zz[i - l] < r)
zz[i] = zz[i - l];
else {
l = i;
if (r <... | |
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem — the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | e724c7f28fbeadd9b5c5811b54608d00 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1 ≤ n, m ≤ 100). Each of the next n lines contains m integers — the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≤ aij ≤ 1) — the i-th row of the matrix a. | ["2", "3", "2"] | #include<stdio.h>
//#include<conio.h>
int main()
{
int n,m,mid,i,temp1,temp2,found=0,j,count=0,ans=0;
int str[105][105];
// printf("enter the value of n and m:");
scanf("%d %d",&n,&m);
for(i=1;i<=n;i++)
{
for(j=1;j<=m;j++)
scanf("%d",&str[i][j]);
}
ans=n;
if(n%2==1)
mid=n;
else
{
do
{
mid=ans/2;... | |
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem — the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | d30e3382c21e7d27b09a7c1d6ef3176c | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1 ≤ n, m ≤ 100). Each of the next n lines contains m integers — the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≤ aij ≤ 1) — the i-th row of the matrix a. | ["2", "3", "2"] | #include<stdio.h>
int main(){
int i,j,n,m,a[100][100],ans;
scanf("%d%d",&n,&m);
for(i=0;i<n;i++){
for(j=0;j<m;j++){
scanf("%d",&a[i][j]);
}
}
while(n>0){
ans=n;
if(n%2==0){
for(i=n/2;i<n;i++){
for(j=0;j<m;j++){
... | |
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem — the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | 089bdd13539a0b55156633f76b2b68d2 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1 ≤ n, m ≤ 100). Each of the next n lines contains m integers — the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≤ aij ≤ 1) — the i-th row of the matrix a. | ["2", "3", "2"] | #include<stdio.h>
int main()
{
int n,m;
scanf("%d %d",&n,&m);
int i,j,arr[105][105];
for(i=0;i<n;++i)
{
for(j=0;j<m;++j)
{
scanf("%d",&arr[i][j]);
}
}
if(n%2==1)
printf("%d",n);
else
{
int prev=1;
int ch=0;
int div=2... | |
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem — the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | f01f468746f888b7cc8cfcf0fac7a576 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1 ≤ n, m ≤ 100). Each of the next n lines contains m integers — the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≤ aij ≤ 1) — the i-th row of the matrix a. | ["2", "3", "2"] | #include <stdio.h>
#include<stdio.h>
#include<math.h>
#include<string.h>
int main(void)
{
int n,m,matrix[102][102],min=0,i,j,k;
scanf("%d%d",&n,&m);
for(i=1;i<=n;i++)
{
for(j=1;j<=m;j++)
scanf("%d",&matrix[i][j]);
}
min=n;
if(n%2==1){
printf("%d",n);
return 0;
}
i=n/2;
j=(n/2)+1;
while(n... | |
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem — the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | 5350a8c13d7f88ba522442bc0218fa3f | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1 ≤ n, m ≤ 100). Each of the next n lines contains m integers — the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≤ aij ≤ 1) — the i-th row of the matrix a. | ["2", "3", "2"] | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <ctype.h>
#define MAXN 1005
#define N 205
#define INF 1<<30
#define eps 1.0e-10
#define For(i,m,n) for(i=(m);i<n;i++)
#define MAX(x,y) (x)>(y)?(x):(y)
#define MIN(x,y) (x)<(y)?(x):(y)
int a[N][N], n, m;
int judge(int t)
{
int ... | |
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem — the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | 1540fca066f6fb8b02e72193374f765e | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1 ≤ n, m ≤ 100). Each of the next n lines contains m integers — the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≤ aij ≤ 1) — the i-th row of the matrix a. | ["2", "3", "2"] | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
int ma[110][110];
bool equals(int a,int b,int length)
{
int j;
for (j=1;j<=length;j++)
{
if (ma[a][j] != ma[b][j])
{
return false;
} else {
if (j==length) return true;
}
}
return fal... | |
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem — the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | 5b2a084c8a788ab4f985c72ef164b343 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1 ≤ n, m ≤ 100). Each of the next n lines contains m integers — the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≤ aij ≤ 1) — the i-th row of the matrix a. | ["2", "3", "2"] | #include <stdio.h>
#define maxlen 105
int N;
int check(int s,int e,int col,int mx[][maxlen])
{
int upi,downi,j,ok=0;
if(e&1) return N;
upi=(s+e)/2,downi=upi+1;
while(upi>=1)
{
for(j=1;j<=col;j++)
if(mx[upi][j]!=mx[downi][j]) {ok=1;break;}
if(ok) break;
upi--,downi++;... | |
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem — the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | 3605a548477cede2fcba276b15232ff2 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1 ≤ n, m ≤ 100). Each of the next n lines contains m integers — the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≤ aij ≤ 1) — the i-th row of the matrix a. | ["2", "3", "2"] | #include <stdio.h>
int main(int argc, char *argv[])
{
int n, m, a[100][100] = {}, num;
int i, j, l;
scanf("%d%d", &n, &m);
num = n;
for(i = 0; i < n; i++)
for( j = 0; j < m; j++)
scanf("%d", &a[i][j]);
for(;num > 1; )
{
if(num%2 == 1)
{
... | |
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem — the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | ee8c3083baa309ef00b6c94fcce40d0e | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1 ≤ n, m ≤ 100). Each of the next n lines contains m integers — the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≤ aij ≤ 1) — the i-th row of the matrix a. | ["2", "3", "2"] | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
char str[100+1][10000+10];
int main()
{
int n,k;
scanf("%d%d",&n,&k);
getchar();
int i,j;
for(i=0;i<n;i++)
gets(str[i]);
if(n&1)
printf("%d",n);
else
{
int rows = n;
int flag = 0;
for(i=0... | |
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem — the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | 361c87640a7b7d60e2b8bd83ecd7d0e0 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1 ≤ n, m ≤ 100). Each of the next n lines contains m integers — the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≤ aij ≤ 1) — the i-th row of the matrix a. | ["2", "3", "2"] | #include<stdio.h>
int A[105][105];
int divide(int n, int m)
{
if(n == 1)
return n;
if(n%2 != 0)
return n;
int i,j,flag;
for(i=n/2;i<n;++i)
{
flag = 1;
for(j=0;j<m;++j)
{
if(A[i][j] != A[n-i-1][j])
{
flag = 0;
break;
}
}
if(flag == 0)
break;
}
if(flag == 0)
return n;
else
re... | |
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem — the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | 41db76f8bea9ef0d0e0b6cf0085a04cb | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1 ≤ n, m ≤ 100). Each of the next n lines contains m integers — the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≤ aij ≤ 1) — the i-th row of the matrix a. | ["2", "3", "2"] | #include <stdio.h>
#include <math.h>
int main(void)
{
int n, m, i, j, k;
scanf("%d %d", &n, &m);
if( n % 2 != 0) {
printf("%d", n);
return 0;
}
int numbers[100][100];
for(i = 0; i < n; i++)
{
for(j = 0; j < m; j++)
{
scanf("%d", &numbers[i][j]);
}
}
int max = n / 2;
int row = 0;
for(i = 1; ... | |
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem — the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | c97f2e970988800ce26837a61d2a6029 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1 ≤ n, m ≤ 100). Each of the next n lines contains m integers — the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≤ aij ≤ 1) — the i-th row of the matrix a. | ["2", "3", "2"] | #include <stdio.h>
#include <math.h>
int main(void)
{
int n, m, i, j, k;
int numbers[100][100];
scanf("%d %d", &n, &m);
for(i = 0; i < n; i++)
{
for(j = 0; j < m; j++)
{
scanf("%d", &numbers[i][j]);
}
}
int max = n / 2;
int row = 0;
for(i = 1; i <= max; i++)
{
if((n / (int)pow(2, i - 1)) % 2 != ... | |
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem — the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | a85934f15a94f76329d43b582cea7b51 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1 ≤ n, m ≤ 100). Each of the next n lines contains m integers — the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≤ aij ≤ 1) — the i-th row of the matrix a. | ["2", "3", "2"] | #include<stdio.h>
#include<math.h>
int main()
{
int n,i,j,m,k,pass,count,A[101][101];
int temp,count_col;
scanf("%d%d",&n,&m);
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
scanf("%d",&A[i][j]);
}
pass=0;
count=0;
temp=(int)(log(n)/log(2));
// printf("%d temp\n",temp);
if(n%2==0)
{
while(pass<=temp)
{
i=0;
... | |
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem — the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | 6645079925745d13dca5c8a901e9476a | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1 ≤ n, m ≤ 100). Each of the next n lines contains m integers — the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≤ aij ≤ 1) — the i-th row of the matrix a. | ["2", "3", "2"] | #include <stdio.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#include <stdlib.h>
int main(void){
long n, m, a[101][101],
i, j, nn, ans, ii;
scanf("%d %d", &n, &m);
for (i = 0; i < n; i++)
for (j = 0; j < m; j++)
scanf("%d", &a[i][j]);
ans = n;
nn = n;
while (nn % 2 == 0){
i... | |
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem — the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | ab5860d8c4ca896b571610fb40b67a43 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1 ≤ n, m ≤ 100). Each of the next n lines contains m integers — the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≤ aij ≤ 1) — the i-th row of the matrix a. | ["2", "3", "2"] | #include<stdio.h>
/*int compare(int** array, int index, int n,int m)
{
int x,y,z;
for(x=index-1,y=index;x>=0;x--,y++)
{
for( z=0;z<m;z++)
{
if(array[x][z]!= array[y][z])
{
return 0;
}
}
}
return 1;
}
*/
int main()... | |
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem — the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | 2c6cc7ad4dd2cd0ea0c913874ec242e4 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1 ≤ n, m ≤ 100). Each of the next n lines contains m integers — the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≤ aij ≤ 1) — the i-th row of the matrix a. | ["2", "3", "2"] | #include <stdio.h>
int find(int x,int y,int *a,int col){
int i,j,k;
for(i=x; i>0;){
int flag=1;
for(j=1;flag&&j*i<x;j++){
if(j%2==0)
for(k=0;k<i;k++){
if(a[j*i+k]!=a[k]){
flag=0;
break;
}
}
if(j%2==1)
for(k=0;k<i;k++){
if(a[j*i+k]!=a[i-1-k]){
flag=0;
break;
}
... | |
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem — the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | 881d9083c24937231b9a0c127aeb49a7 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1 ≤ n, m ≤ 100). Each of the next n lines contains m integers — the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≤ aij ≤ 1) — the i-th row of the matrix a. | ["2", "3", "2"] | /*
* =====================================================================================
*
* Filename: sm.cpp
*
* Description: j
*
* Version: 1.0
* Created: Friday, May 09, 2014 09:39:11 HKT
* Revision: none
* Compiler: gcc
*
* Author: YOUR NAME (),
* ... | |
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem — the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | f5abd0c37fea68a0199b9c0966bcb2d7 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1 ≤ n, m ≤ 100). Each of the next n lines contains m integers — the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≤ aij ≤ 1) — the i-th row of the matrix a. | ["2", "3", "2"] | #include<stdio.h>
int main()
{
int n,m,a[101][101],i,j,ch,flag,flag1,ans;
scanf("%d %d",&n,&m);
for(i=1;i<=n;i++)
{
for(j=1;j<=m;j++)
{
scanf("%d",&a[i][j]);
}
}
if(n%2==1)
printf("%d",n);
else
{
flag=1;
ch=n;
while(flag)
... | |
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem — the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | 5959e159c21656cad48b5dbc12574824 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1 ≤ n, m ≤ 100). Each of the next n lines contains m integers — the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≤ aij ≤ 1) — the i-th row of the matrix a. | ["2", "3", "2"] | #include <stdio.h>
int map[101][101] = {0}, m, n;
int is_symmetric(int row){
int i, j;
// if(row%2 == 1)return 0;
for(i=0; i<row/2; i++){
for(j=0; j<m; j++){
if(map[i][j] != map[row-i-1][j])return 0;
}
}
return 1;
}
int main(){
int i, j, ans = 0;
scanf("%d %d", &... | |
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem — the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | 3b8737b55b2fdaf4eebad5576bd712be | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1 ≤ n, m ≤ 100). Each of the next n lines contains m integers — the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≤ aij ≤ 1) — the i-th row of the matrix a. | ["2", "3", "2"] | #include<stdio.h>
#define SZ 128
int v[SZ][SZ], n, m;
int solve(int[][SZ], int);
int main(void) {
int i, j;
scanf("%d%d", &n, &m);
for(i=0; i<n; ++i) {
for(j=0; j<m; ++j) scanf("%d", &v[i][j]);
}
printf("%d\n", n>>solve(v, n));
return 0;
}
int check(int i, int j) {
int k;
for(k=0; k... | |
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem — the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | 660fc051b7b5aad8455b48e0da63a32e | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1 ≤ n, m ≤ 100). Each of the next n lines contains m integers — the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≤ aij ≤ 1) — the i-th row of the matrix a. | ["2", "3", "2"] | #include <stdio.h>
#define MAX 100
int filaNI(int a[MAX], int b[MAX], int m)
{
int i;
for (i = 0; i < m; ++i)
{
if (a[i]!=b[i])
{
return 1;
}
}
return 0;
}
int rec(int a[MAX][MAX], int n, int m)
{
int p,i;
if (n%2==0)
{
p = n/2;
for (i = 0; i < p; ++i)
{
if (filaNI(a[i],a[n-i-1],m))
{
... | |
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f... | In the single line, print the answer to the problem — the minimum number of rows of matrix b. | C | 90125e9d42c6dcb0bf3b2b5e4d0f845e | bca75b057596840607eaf988dd3762ea | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1398612600 | ["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"] | NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001 | PASSED | 1,300 | standard input | 1 second | The first line contains two integers, n and m (1 ≤ n, m ≤ 100). Each of the next n lines contains m integers — the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≤ aij ≤ 1) — the i-th row of the matrix a. | ["2", "3", "2"] | #include <stdio.h>
int main()
{
int i,j,n,k,x,y,h,z,flag=0,count=0,flag2=0;
scanf("%d %d", &n, &k);
int a[n][k];
for(i=0;i<n;i++)
{
for(j=0;j<k;j++)
scanf("%d", &a[i][j]);
}
h=n;
if(h%2==1)
printf("%d", h);
else
{
for(i=0,j=h-1; i<h/2; i++,j--... | |
Slastyona and her loyal dog Pushok are playing a meaningless game that is indeed very interesting.The game consists of multiple rounds. Its rules are very simple: in each round, a natural number k is chosen. Then, the one who says (or barks) it faster than the other wins the round. After that, the winner's score is m... | For each pair of scores, answer "Yes" if it's possible for a game to finish with given score, and "No" otherwise. You can output each letter in arbitrary case (upper or lower). | C | 933135ef124b35028c1f309d69515e44 | f6d01cc2dff2c11610c7a5cca4ff9860 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1501425300 | ["6\n2 4\n75 45\n8 8\n16 16\n247 994\n1000000000 1000000"] | NoteFirst game might have been consisted of one round, in which the number 2 would have been chosen and Pushok would have won.The second game needs exactly two rounds to finish with such result: in the first one, Slastyona would have said the number 5, and in the second one, Pushok would have barked the number 3. | PASSED | 1,700 | standard input | 1 second | In the first string, the number of games n (1 ≤ n ≤ 350000) is given. Each game is represented by a pair of scores a, b (1 ≤ a, b ≤ 109) – the results of Slastyona and Pushok, correspondingly. | ["Yes\nYes\nYes\nNo\nNo\nYes"] | #include<stdio.h>
#include<math.h>
int gcd(int a,int b)
{
int c;
while(a%b!=0)
{
c=b;
b=a%b;
a=c;
}
return b;
}
int main()
{
int M,n,i,j,k,a,b,condition,gc,gcd_a,gcd_b;
long long int cubic_root,cube;
scanf("%d",&n);
for(k=1;k<=n;k++)
{
condition=1;
scanf("%d %d",&a,&b... | |
Slastyona and her loyal dog Pushok are playing a meaningless game that is indeed very interesting.The game consists of multiple rounds. Its rules are very simple: in each round, a natural number k is chosen. Then, the one who says (or barks) it faster than the other wins the round. After that, the winner's score is m... | For each pair of scores, answer "Yes" if it's possible for a game to finish with given score, and "No" otherwise. You can output each letter in arbitrary case (upper or lower). | C | 933135ef124b35028c1f309d69515e44 | 887054aa1695921a2656f1eac3a4f328 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1501425300 | ["6\n2 4\n75 45\n8 8\n16 16\n247 994\n1000000000 1000000"] | NoteFirst game might have been consisted of one round, in which the number 2 would have been chosen and Pushok would have won.The second game needs exactly two rounds to finish with such result: in the first one, Slastyona would have said the number 5, and in the second one, Pushok would have barked the number 3. | PASSED | 1,700 | standard input | 1 second | In the first string, the number of games n (1 ≤ n ≤ 350000) is given. Each game is represented by a pair of scores a, b (1 ≤ a, b ≤ 109) – the results of Slastyona and Pushok, correspondingly. | ["Yes\nYes\nYes\nNo\nNo\nYes"] | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#include <string.h>
int main(int argc, char const *argv[])
{
int n;
scanf("%d",&n);
while(n--){
int flag=0;
long long a,b;
scanf("%I64d %I64d",&a,&b);
long long x=a*b;
long long l=1,r=1000000,m;
m=(l+r)/2;
... | |
Slastyona and her loyal dog Pushok are playing a meaningless game that is indeed very interesting.The game consists of multiple rounds. Its rules are very simple: in each round, a natural number k is chosen. Then, the one who says (or barks) it faster than the other wins the round. After that, the winner's score is m... | For each pair of scores, answer "Yes" if it's possible for a game to finish with given score, and "No" otherwise. You can output each letter in arbitrary case (upper or lower). | C | 933135ef124b35028c1f309d69515e44 | 13b7d3c7da8aecbec4c0939ccfb0da0c | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1501425300 | ["6\n2 4\n75 45\n8 8\n16 16\n247 994\n1000000000 1000000"] | NoteFirst game might have been consisted of one round, in which the number 2 would have been chosen and Pushok would have won.The second game needs exactly two rounds to finish with such result: in the first one, Slastyona would have said the number 5, and in the second one, Pushok would have barked the number 3. | PASSED | 1,700 | standard input | 1 second | In the first string, the number of games n (1 ≤ n ≤ 350000) is given. Each game is represented by a pair of scores a, b (1 ≤ a, b ≤ 109) – the results of Slastyona and Pushok, correspondingly. | ["Yes\nYes\nYes\nNo\nNo\nYes"] | #include <stdio.h>
int s[1001];
int get(int n)
{
int lo = 1;
int hi = 1000;
int mid;
while(lo <=hi)
{
mid = (lo + hi)/2;
if(s[mid]==n)return 1;
if(s[mid]<n)lo= mid + 1;
else hi = mid - 1;
}
return 0;
}
int gcd(int a, int b)
{
int t;
while(a%b... | |
Slastyona and her loyal dog Pushok are playing a meaningless game that is indeed very interesting.The game consists of multiple rounds. Its rules are very simple: in each round, a natural number k is chosen. Then, the one who says (or barks) it faster than the other wins the round. After that, the winner's score is m... | For each pair of scores, answer "Yes" if it's possible for a game to finish with given score, and "No" otherwise. You can output each letter in arbitrary case (upper or lower). | C | 933135ef124b35028c1f309d69515e44 | 12719ed035a877b5ce9c6354369f412d | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1501425300 | ["6\n2 4\n75 45\n8 8\n16 16\n247 994\n1000000000 1000000"] | NoteFirst game might have been consisted of one round, in which the number 2 would have been chosen and Pushok would have won.The second game needs exactly two rounds to finish with such result: in the first one, Slastyona would have said the number 5, and in the second one, Pushok would have barked the number 3. | PASSED | 1,700 | standard input | 1 second | In the first string, the number of games n (1 ≤ n ≤ 350000) is given. Each game is represented by a pair of scores a, b (1 ≤ a, b ≤ 109) – the results of Slastyona and Pushok, correspondingly. | ["Yes\nYes\nYes\nNo\nNo\nYes"] | #include <stdio.h>
#include <math.h>
int main () {
int n;
int i;
(void) scanf ("%d", &n);
for (i = 0; i < n; i++) {
int A, B;
int ab, a, b;
(void) scanf ("%d%d", &A, &B);
ab = (int) round (cbrtl ((long double) A * B));
a = A / ab;
b = B / ... | |
Slastyona and her loyal dog Pushok are playing a meaningless game that is indeed very interesting.The game consists of multiple rounds. Its rules are very simple: in each round, a natural number k is chosen. Then, the one who says (or barks) it faster than the other wins the round. After that, the winner's score is m... | For each pair of scores, answer "Yes" if it's possible for a game to finish with given score, and "No" otherwise. You can output each letter in arbitrary case (upper or lower). | C | 933135ef124b35028c1f309d69515e44 | 15fb248b1d8cad2bd0be0b6b93199b86 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1501425300 | ["6\n2 4\n75 45\n8 8\n16 16\n247 994\n1000000000 1000000"] | NoteFirst game might have been consisted of one round, in which the number 2 would have been chosen and Pushok would have won.The second game needs exactly two rounds to finish with such result: in the first one, Slastyona would have said the number 5, and in the second one, Pushok would have barked the number 3. | PASSED | 1,700 | standard input | 1 second | In the first string, the number of games n (1 ≤ n ≤ 350000) is given. Each game is represented by a pair of scores a, b (1 ≤ a, b ≤ 109) – the results of Slastyona and Pushok, correspondingly. | ["Yes\nYes\nYes\nNo\nNo\nYes"] | #include <stdio.h>
#include <math.h>
#include <stdio.h>
int main()
{
int i, n;
long long n1, n2, n3, t1, t2, t;
scanf("%d",&n);
for (i = 1; i <= n; i++){
scanf("%lld",&n1);
scanf("%lld",&n2);
t1 = n1 % 2;
t2 = n2 % 2;
if (n1 + n2 == 1){
printf("No\n");
continue;
}
n3 = n1*n... | |
Slastyona and her loyal dog Pushok are playing a meaningless game that is indeed very interesting.The game consists of multiple rounds. Its rules are very simple: in each round, a natural number k is chosen. Then, the one who says (or barks) it faster than the other wins the round. After that, the winner's score is m... | For each pair of scores, answer "Yes" if it's possible for a game to finish with given score, and "No" otherwise. You can output each letter in arbitrary case (upper or lower). | C | 933135ef124b35028c1f309d69515e44 | c75e702ade03a1189d9ddc8d7ac1126c | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1501425300 | ["6\n2 4\n75 45\n8 8\n16 16\n247 994\n1000000000 1000000"] | NoteFirst game might have been consisted of one round, in which the number 2 would have been chosen and Pushok would have won.The second game needs exactly two rounds to finish with such result: in the first one, Slastyona would have said the number 5, and in the second one, Pushok would have barked the number 3. | PASSED | 1,700 | standard input | 1 second | In the first string, the number of games n (1 ≤ n ≤ 350000) is given. Each game is represented by a pair of scores a, b (1 ≤ a, b ≤ 109) – the results of Slastyona and Pushok, correspondingly. | ["Yes\nYes\nYes\nNo\nNo\nYes"] | #include <stdio.h>
#include <stdlib.h>
#define MAXPOSS 1000
int main()
{
int primes[MAXPOSS];
int counted[MAXPOSS+1];
int i,j,k,n,a,b,p,prime,aDiv,bDiv,possible,nPrimes;
for(i=0;i<=MAXPOSS;i++) {
counted[i]=0;
}
j=0;
for(i=2;i<MAXPOSS;i++) {
if(counted[i]==0) ... | |
Slastyona and her loyal dog Pushok are playing a meaningless game that is indeed very interesting.The game consists of multiple rounds. Its rules are very simple: in each round, a natural number k is chosen. Then, the one who says (or barks) it faster than the other wins the round. After that, the winner's score is m... | For each pair of scores, answer "Yes" if it's possible for a game to finish with given score, and "No" otherwise. You can output each letter in arbitrary case (upper or lower). | C | 933135ef124b35028c1f309d69515e44 | c01f4fc1f481a93192adfa3e2a2f3e87 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1501425300 | ["6\n2 4\n75 45\n8 8\n16 16\n247 994\n1000000000 1000000"] | NoteFirst game might have been consisted of one round, in which the number 2 would have been chosen and Pushok would have won.The second game needs exactly two rounds to finish with such result: in the first one, Slastyona would have said the number 5, and in the second one, Pushok would have barked the number 3. | PASSED | 1,700 | standard input | 1 second | In the first string, the number of games n (1 ≤ n ≤ 350000) is given. Each game is represented by a pair of scores a, b (1 ≤ a, b ≤ 109) – the results of Slastyona and Pushok, correspondingly. | ["Yes\nYes\nYes\nNo\nNo\nYes"] | #include <math.h>
#include <stdio.h>
/* http://codeforces.com/contest/834/submission/29026742 (Dukkha) */
int check(int a, int b, int d) {
int p, q, r, s;
p = 0;
while (a % d == 0) {
p++;
a /= d;
}
q = 0;
while (b % d == 0) {
q++;
b /= d;
}
r = (p + q) / 3;
s = p - q + r;
return s >= 0 && s % 2 == ... | |
Slastyona and her loyal dog Pushok are playing a meaningless game that is indeed very interesting.The game consists of multiple rounds. Its rules are very simple: in each round, a natural number k is chosen. Then, the one who says (or barks) it faster than the other wins the round. After that, the winner's score is m... | For each pair of scores, answer "Yes" if it's possible for a game to finish with given score, and "No" otherwise. You can output each letter in arbitrary case (upper or lower). | C | 933135ef124b35028c1f309d69515e44 | fe6c622a6197c7b703b557b1166edca0 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1501425300 | ["6\n2 4\n75 45\n8 8\n16 16\n247 994\n1000000000 1000000"] | NoteFirst game might have been consisted of one round, in which the number 2 would have been chosen and Pushok would have won.The second game needs exactly two rounds to finish with such result: in the first one, Slastyona would have said the number 5, and in the second one, Pushok would have barked the number 3. | PASSED | 1,700 | standard input | 1 second | In the first string, the number of games n (1 ≤ n ≤ 350000) is given. Each game is represented by a pair of scores a, b (1 ≤ a, b ≤ 109) – the results of Slastyona and Pushok, correspondingly. | ["Yes\nYes\nYes\nNo\nNo\nYes"] | #include <stdio.h>
int main ()
{
int t, i;
scanf("%d", &t);
for(i = 0; i < t; i++)
{
long long a, b, j, x, ans = -1, mid, lo = 0, hi = 1000000;
scanf("%lld %lld", &a, &b);
while(lo <= hi)
{
mid = (lo + hi) / 2;
x = mid * mid * mid;
... | |
Slastyona and her loyal dog Pushok are playing a meaningless game that is indeed very interesting.The game consists of multiple rounds. Its rules are very simple: in each round, a natural number k is chosen. Then, the one who says (or barks) it faster than the other wins the round. After that, the winner's score is m... | For each pair of scores, answer "Yes" if it's possible for a game to finish with given score, and "No" otherwise. You can output each letter in arbitrary case (upper or lower). | C | 933135ef124b35028c1f309d69515e44 | 1c3cf48d43e9f83b083ab57770fe9b1b | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1501425300 | ["6\n2 4\n75 45\n8 8\n16 16\n247 994\n1000000000 1000000"] | NoteFirst game might have been consisted of one round, in which the number 2 would have been chosen and Pushok would have won.The second game needs exactly two rounds to finish with such result: in the first one, Slastyona would have said the number 5, and in the second one, Pushok would have barked the number 3. | PASSED | 1,700 | standard input | 1 second | In the first string, the number of games n (1 ≤ n ≤ 350000) is given. Each game is represented by a pair of scores a, b (1 ≤ a, b ≤ 109) – the results of Slastyona and Pushok, correspondingly. | ["Yes\nYes\nYes\nNo\nNo\nYes"] | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
#define maxn 31663
long zhi[10000],ans=0;
bool vis[maxn+1];
void GetZhi()
{
long i,j;
for (i=2;i<=maxn;i++)
vis[i]=true;
for (i=2;i<=maxn;i++)
{
if (vis[i])
{
ans++;
zhi[ans]=i... | |
Slastyona and her loyal dog Pushok are playing a meaningless game that is indeed very interesting.The game consists of multiple rounds. Its rules are very simple: in each round, a natural number k is chosen. Then, the one who says (or barks) it faster than the other wins the round. After that, the winner's score is m... | For each pair of scores, answer "Yes" if it's possible for a game to finish with given score, and "No" otherwise. You can output each letter in arbitrary case (upper or lower). | C | 933135ef124b35028c1f309d69515e44 | 150362b0d6eb92443a78b12e14632f6c | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1501425300 | ["6\n2 4\n75 45\n8 8\n16 16\n247 994\n1000000000 1000000"] | NoteFirst game might have been consisted of one round, in which the number 2 would have been chosen and Pushok would have won.The second game needs exactly two rounds to finish with such result: in the first one, Slastyona would have said the number 5, and in the second one, Pushok would have barked the number 3. | PASSED | 1,700 | standard input | 1 second | In the first string, the number of games n (1 ≤ n ≤ 350000) is given. Each game is represented by a pair of scores a, b (1 ≤ a, b ≤ 109) – the results of Slastyona and Pushok, correspondingly. | ["Yes\nYes\nYes\nNo\nNo\nYes"] | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
long long int n, a, b, i, x, y;
int main(void) {
scanf("%I64d", &n);
for(i = 0; i < n; i++) {
scanf("%I64d%I64d", &a, &b);
if(a*a%b != 0 || b*b%a != 0) {
goto no;
}
x = (long long int) (pow(a*a/b, 1.0/3.0)+0.5);
y = (long long int) (pow(b*b/a, 1.... | |
Slastyona and her loyal dog Pushok are playing a meaningless game that is indeed very interesting.The game consists of multiple rounds. Its rules are very simple: in each round, a natural number k is chosen. Then, the one who says (or barks) it faster than the other wins the round. After that, the winner's score is m... | For each pair of scores, answer "Yes" if it's possible for a game to finish with given score, and "No" otherwise. You can output each letter in arbitrary case (upper or lower). | C | 933135ef124b35028c1f309d69515e44 | f6438a0b44141f600c3bd9256ed29c75 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1501425300 | ["6\n2 4\n75 45\n8 8\n16 16\n247 994\n1000000000 1000000"] | NoteFirst game might have been consisted of one round, in which the number 2 would have been chosen and Pushok would have won.The second game needs exactly two rounds to finish with such result: in the first one, Slastyona would have said the number 5, and in the second one, Pushok would have barked the number 3. | PASSED | 1,700 | standard input | 1 second | In the first string, the number of games n (1 ≤ n ≤ 350000) is given. Each game is represented by a pair of scores a, b (1 ≤ a, b ≤ 109) – the results of Slastyona and Pushok, correspondingly. | ["Yes\nYes\nYes\nNo\nNo\nYes"] | #include <ctype.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MOD 1000000007
#define ll long long
int main(){
int n;
scanf("%d",&n);
while(n--){
ll a,b;
scanf("%lld %lld",&a,&b);
ll product = a * b;
long double third = cbrtl((long do... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.