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
There are $$$n$$$ dormitories in Berland State University, they are numbered with integers from $$$1$$$ to $$$n$$$. Each dormitory consists of rooms, there are $$$a_i$$$ rooms in $$$i$$$-th dormitory. The rooms in $$$i$$$-th dormitory are numbered from $$$1$$$ to $$$a_i$$$.A postman delivers letters. Sometimes there is...
Print $$$m$$$ lines. For each letter print two integers $$$f$$$ and $$$k$$$ โ€” the dormitory number $$$f$$$ $$$(1 \le f \le n)$$$ and the room number $$$k$$$ in this dormitory $$$(1 \le k \le a_f)$$$ to deliver the letter.
C
56bdab2019ee12e18d4f7e17ac414962
bce8dcc8487f4239fa770b9ddd03dad2
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "two pointers", "binary search", "implementation" ]
1526202300
["3 6\n10 15 12\n1 9 12 23 26 37", "2 3\n5 10000000000\n5 6 9999999999"]
NoteIn the first example letters should be delivered in the following order: the first letter in room $$$1$$$ of the first dormitory the second letter in room $$$9$$$ of the first dormitory the third letter in room $$$2$$$ of the second dormitory the fourth letter in room $$$13$$$ of the second dormitory the fifth...
PASSED
1,000
standard input
4 seconds
The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 2 \cdot 10^{5})$$$ โ€” the number of dormitories and the number of letters. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{10})$$$, where $$$a_i$$$ equals to the number of rooms in the $$$i$$$-th dormitory. T...
["1 1\n1 9\n2 2\n2 13\n3 1\n3 12", "1 5\n2 1\n2 9999999994"]
#include<stdio.h> main() { long int n,m; scanf("%ld %ld", &n, &m); long long a[n], b[m], c[n]; scanf("%lld", &a[0]); c[0] = a[0]; for(int i=1; i<n; i++) { scanf("%lld", &a[i]); c[i] = c[i-1] + a[i]; } for(int i=0; i<m; i++) { scanf("%lld", &b[i]); ...
There are $$$n$$$ dormitories in Berland State University, they are numbered with integers from $$$1$$$ to $$$n$$$. Each dormitory consists of rooms, there are $$$a_i$$$ rooms in $$$i$$$-th dormitory. The rooms in $$$i$$$-th dormitory are numbered from $$$1$$$ to $$$a_i$$$.A postman delivers letters. Sometimes there is...
Print $$$m$$$ lines. For each letter print two integers $$$f$$$ and $$$k$$$ โ€” the dormitory number $$$f$$$ $$$(1 \le f \le n)$$$ and the room number $$$k$$$ in this dormitory $$$(1 \le k \le a_f)$$$ to deliver the letter.
C
56bdab2019ee12e18d4f7e17ac414962
1424de2257f862d2a0ce2ba1362f0ff7
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "two pointers", "binary search", "implementation" ]
1526202300
["3 6\n10 15 12\n1 9 12 23 26 37", "2 3\n5 10000000000\n5 6 9999999999"]
NoteIn the first example letters should be delivered in the following order: the first letter in room $$$1$$$ of the first dormitory the second letter in room $$$9$$$ of the first dormitory the third letter in room $$$2$$$ of the second dormitory the fourth letter in room $$$13$$$ of the second dormitory the fifth...
PASSED
1,000
standard input
4 seconds
The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 2 \cdot 10^{5})$$$ โ€” the number of dormitories and the number of letters. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{10})$$$, where $$$a_i$$$ equals to the number of rooms in the $$$i$$$-th dormitory. T...
["1 1\n1 9\n2 2\n2 13\n3 1\n3 12", "1 5\n2 1\n2 9999999994"]
#include <stdio.h> #include <stdlib.h> int main() { long long n, m; scanf("%lld%lld", &n, &m); long long *a = malloc(sizeof(long long) * n); for (int i = 0; i < n; i++) scanf("%lld", a + i); long long sum = 0, idx = 1; for (int i = 0; i < m; i++) { long long room; scan...
There are $$$n$$$ dormitories in Berland State University, they are numbered with integers from $$$1$$$ to $$$n$$$. Each dormitory consists of rooms, there are $$$a_i$$$ rooms in $$$i$$$-th dormitory. The rooms in $$$i$$$-th dormitory are numbered from $$$1$$$ to $$$a_i$$$.A postman delivers letters. Sometimes there is...
Print $$$m$$$ lines. For each letter print two integers $$$f$$$ and $$$k$$$ โ€” the dormitory number $$$f$$$ $$$(1 \le f \le n)$$$ and the room number $$$k$$$ in this dormitory $$$(1 \le k \le a_f)$$$ to deliver the letter.
C
56bdab2019ee12e18d4f7e17ac414962
3fd3f9f7f480cb8345f1517571db1def
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "two pointers", "binary search", "implementation" ]
1526202300
["3 6\n10 15 12\n1 9 12 23 26 37", "2 3\n5 10000000000\n5 6 9999999999"]
NoteIn the first example letters should be delivered in the following order: the first letter in room $$$1$$$ of the first dormitory the second letter in room $$$9$$$ of the first dormitory the third letter in room $$$2$$$ of the second dormitory the fourth letter in room $$$13$$$ of the second dormitory the fifth...
PASSED
1,000
standard input
4 seconds
The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 2 \cdot 10^{5})$$$ โ€” the number of dormitories and the number of letters. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{10})$$$, where $$$a_i$$$ equals to the number of rooms in the $$$i$$$-th dormitory. T...
["1 1\n1 9\n2 2\n2 13\n3 1\n3 12", "1 5\n2 1\n2 9999999994"]
#include <stdio.h> #define ll long long typedef struct { ll roomnum; ll accum; }Dorm; ll findDorm(Dorm dorm[], ll n, ll room) { ll low = 0, high = n; while(high-low > 1) { ll half = (high+low)/2; if(dorm[(high+low)/2].accum > room) high = half; else l...
There are $$$n$$$ dormitories in Berland State University, they are numbered with integers from $$$1$$$ to $$$n$$$. Each dormitory consists of rooms, there are $$$a_i$$$ rooms in $$$i$$$-th dormitory. The rooms in $$$i$$$-th dormitory are numbered from $$$1$$$ to $$$a_i$$$.A postman delivers letters. Sometimes there is...
Print $$$m$$$ lines. For each letter print two integers $$$f$$$ and $$$k$$$ โ€” the dormitory number $$$f$$$ $$$(1 \le f \le n)$$$ and the room number $$$k$$$ in this dormitory $$$(1 \le k \le a_f)$$$ to deliver the letter.
C
56bdab2019ee12e18d4f7e17ac414962
782ea32a186488cf67c2088b545917be
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "two pointers", "binary search", "implementation" ]
1526202300
["3 6\n10 15 12\n1 9 12 23 26 37", "2 3\n5 10000000000\n5 6 9999999999"]
NoteIn the first example letters should be delivered in the following order: the first letter in room $$$1$$$ of the first dormitory the second letter in room $$$9$$$ of the first dormitory the third letter in room $$$2$$$ of the second dormitory the fourth letter in room $$$13$$$ of the second dormitory the fifth...
PASSED
1,000
standard input
4 seconds
The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 2 \cdot 10^{5})$$$ โ€” the number of dormitories and the number of letters. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{10})$$$, where $$$a_i$$$ equals to the number of rooms in the $$$i$$$-th dormitory. T...
["1 1\n1 9\n2 2\n2 13\n3 1\n3 12", "1 5\n2 1\n2 9999999994"]
#include <stdio.h> #include <string.h> int main(void) { int m,n,i,j,count=1,p=0; scanf ("%d%d",&n,&m); long long int a[n],b[m],rm,sum=0; for(i=0;i<n;i++) scanf("%lld",&a[i]); for(i=0;i<m;i++) scanf("%lld",&b[i]); for(i=0;i<n;i++){ for(j=p;j<m;j++){ if(b[j]<=a[i]+sum){ ...
There are $$$n$$$ dormitories in Berland State University, they are numbered with integers from $$$1$$$ to $$$n$$$. Each dormitory consists of rooms, there are $$$a_i$$$ rooms in $$$i$$$-th dormitory. The rooms in $$$i$$$-th dormitory are numbered from $$$1$$$ to $$$a_i$$$.A postman delivers letters. Sometimes there is...
Print $$$m$$$ lines. For each letter print two integers $$$f$$$ and $$$k$$$ โ€” the dormitory number $$$f$$$ $$$(1 \le f \le n)$$$ and the room number $$$k$$$ in this dormitory $$$(1 \le k \le a_f)$$$ to deliver the letter.
C
56bdab2019ee12e18d4f7e17ac414962
3fc0cd3cde1fdb8dcbb1c4f1ed9c8859
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "two pointers", "binary search", "implementation" ]
1526202300
["3 6\n10 15 12\n1 9 12 23 26 37", "2 3\n5 10000000000\n5 6 9999999999"]
NoteIn the first example letters should be delivered in the following order: the first letter in room $$$1$$$ of the first dormitory the second letter in room $$$9$$$ of the first dormitory the third letter in room $$$2$$$ of the second dormitory the fourth letter in room $$$13$$$ of the second dormitory the fifth...
PASSED
1,000
standard input
4 seconds
The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 2 \cdot 10^{5})$$$ โ€” the number of dormitories and the number of letters. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{10})$$$, where $$$a_i$$$ equals to the number of rooms in the $$$i$$$-th dormitory. T...
["1 1\n1 9\n2 2\n2 13\n3 1\n3 12", "1 5\n2 1\n2 9999999994"]
#include<stdio.h> int main(){ long n,m; //dorms,letters scanf("%ld%ld",&n,&m); int i,lo,hi,to,ans; long long a[n]; //no of rooms at ith dorm long long b[m]; //letter's room no long long temp[n]; long long room; for(i=0;i<n;i++){ scanf("%lld",&a[i]); } for(i=0;i<m;i++){ scanf("%lld",&b[i]); } for(i=1;i<...
There are $$$n$$$ dormitories in Berland State University, they are numbered with integers from $$$1$$$ to $$$n$$$. Each dormitory consists of rooms, there are $$$a_i$$$ rooms in $$$i$$$-th dormitory. The rooms in $$$i$$$-th dormitory are numbered from $$$1$$$ to $$$a_i$$$.A postman delivers letters. Sometimes there is...
Print $$$m$$$ lines. For each letter print two integers $$$f$$$ and $$$k$$$ โ€” the dormitory number $$$f$$$ $$$(1 \le f \le n)$$$ and the room number $$$k$$$ in this dormitory $$$(1 \le k \le a_f)$$$ to deliver the letter.
C
56bdab2019ee12e18d4f7e17ac414962
861fd7bc04a9a0fc3febc4d658b49da7
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "two pointers", "binary search", "implementation" ]
1526202300
["3 6\n10 15 12\n1 9 12 23 26 37", "2 3\n5 10000000000\n5 6 9999999999"]
NoteIn the first example letters should be delivered in the following order: the first letter in room $$$1$$$ of the first dormitory the second letter in room $$$9$$$ of the first dormitory the third letter in room $$$2$$$ of the second dormitory the fourth letter in room $$$13$$$ of the second dormitory the fifth...
PASSED
1,000
standard input
4 seconds
The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 2 \cdot 10^{5})$$$ โ€” the number of dormitories and the number of letters. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{10})$$$, where $$$a_i$$$ equals to the number of rooms in the $$$i$$$-th dormitory. T...
["1 1\n1 9\n2 2\n2 13\n3 1\n3 12", "1 5\n2 1\n2 9999999994"]
#include <stdio.h> long long int f,k; void Binary(long long int *sum,long long int r,long long int l,long long int x){ if (r==l){ if (sum[r]>=x){ k = x - sum[r-1]; f = r; } else{ k = x - sum[r]; f = r+1; } return; } long long int mid = (r+l)/2; if (sum[mid]==x){ k = x-sum[mid-1]; f = mid;...
There are $$$n$$$ dormitories in Berland State University, they are numbered with integers from $$$1$$$ to $$$n$$$. Each dormitory consists of rooms, there are $$$a_i$$$ rooms in $$$i$$$-th dormitory. The rooms in $$$i$$$-th dormitory are numbered from $$$1$$$ to $$$a_i$$$.A postman delivers letters. Sometimes there is...
Print $$$m$$$ lines. For each letter print two integers $$$f$$$ and $$$k$$$ โ€” the dormitory number $$$f$$$ $$$(1 \le f \le n)$$$ and the room number $$$k$$$ in this dormitory $$$(1 \le k \le a_f)$$$ to deliver the letter.
C
56bdab2019ee12e18d4f7e17ac414962
75fce4d20031a4c0ab9719ce24a1ce0b
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "two pointers", "binary search", "implementation" ]
1526202300
["3 6\n10 15 12\n1 9 12 23 26 37", "2 3\n5 10000000000\n5 6 9999999999"]
NoteIn the first example letters should be delivered in the following order: the first letter in room $$$1$$$ of the first dormitory the second letter in room $$$9$$$ of the first dormitory the third letter in room $$$2$$$ of the second dormitory the fourth letter in room $$$13$$$ of the second dormitory the fifth...
PASSED
1,000
standard input
4 seconds
The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 2 \cdot 10^{5})$$$ โ€” the number of dormitories and the number of letters. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{10})$$$, where $$$a_i$$$ equals to the number of rooms in the $$$i$$$-th dormitory. T...
["1 1\n1 9\n2 2\n2 13\n3 1\n3 12", "1 5\n2 1\n2 9999999994"]
#include <stdio.h> int search(int n, long long int a[n], long long int target) { int i; if(a[0]>=target) { printf("1 %lld\n", target); return 0; } int L = 0, R = n-1; int M; while((R-L)>1) { // printf("L = %d, R = %d\n", L,R); if((L+R)%2==0) { M = (L+R)/2; // printf("M = %d", M); } else ...
There are $$$n$$$ dormitories in Berland State University, they are numbered with integers from $$$1$$$ to $$$n$$$. Each dormitory consists of rooms, there are $$$a_i$$$ rooms in $$$i$$$-th dormitory. The rooms in $$$i$$$-th dormitory are numbered from $$$1$$$ to $$$a_i$$$.A postman delivers letters. Sometimes there is...
Print $$$m$$$ lines. For each letter print two integers $$$f$$$ and $$$k$$$ โ€” the dormitory number $$$f$$$ $$$(1 \le f \le n)$$$ and the room number $$$k$$$ in this dormitory $$$(1 \le k \le a_f)$$$ to deliver the letter.
C
56bdab2019ee12e18d4f7e17ac414962
863caddde78d9ccbfc37949e1b3dff04
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "two pointers", "binary search", "implementation" ]
1526202300
["3 6\n10 15 12\n1 9 12 23 26 37", "2 3\n5 10000000000\n5 6 9999999999"]
NoteIn the first example letters should be delivered in the following order: the first letter in room $$$1$$$ of the first dormitory the second letter in room $$$9$$$ of the first dormitory the third letter in room $$$2$$$ of the second dormitory the fourth letter in room $$$13$$$ of the second dormitory the fifth...
PASSED
1,000
standard input
4 seconds
The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 2 \cdot 10^{5})$$$ โ€” the number of dormitories and the number of letters. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{10})$$$, where $$$a_i$$$ equals to the number of rooms in the $$$i$$$-th dormitory. T...
["1 1\n1 9\n2 2\n2 13\n3 1\n3 12", "1 5\n2 1\n2 9999999994"]
#include<stdio.h> int main() { long long int n,m; scanf("%lld %lld",&n,&m); long long int a[n],b[m],i,j,k,num=0,cum=0; for(i=0;i<n;i=i+1) { scanf("%lld",&a[i]); } for(i=0;i<m;i=i+1) { scanf("%lld",&b[i]); } i=0; num=a[0]; for(j=0;j<m;j=j+1) { f...
There are $$$n$$$ dormitories in Berland State University, they are numbered with integers from $$$1$$$ to $$$n$$$. Each dormitory consists of rooms, there are $$$a_i$$$ rooms in $$$i$$$-th dormitory. The rooms in $$$i$$$-th dormitory are numbered from $$$1$$$ to $$$a_i$$$.A postman delivers letters. Sometimes there is...
Print $$$m$$$ lines. For each letter print two integers $$$f$$$ and $$$k$$$ โ€” the dormitory number $$$f$$$ $$$(1 \le f \le n)$$$ and the room number $$$k$$$ in this dormitory $$$(1 \le k \le a_f)$$$ to deliver the letter.
C
56bdab2019ee12e18d4f7e17ac414962
5bea5ef14aa272ec7cf74bf287d34c91
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "two pointers", "binary search", "implementation" ]
1526202300
["3 6\n10 15 12\n1 9 12 23 26 37", "2 3\n5 10000000000\n5 6 9999999999"]
NoteIn the first example letters should be delivered in the following order: the first letter in room $$$1$$$ of the first dormitory the second letter in room $$$9$$$ of the first dormitory the third letter in room $$$2$$$ of the second dormitory the fourth letter in room $$$13$$$ of the second dormitory the fifth...
PASSED
1,000
standard input
4 seconds
The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 2 \cdot 10^{5})$$$ โ€” the number of dormitories and the number of letters. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{10})$$$, where $$$a_i$$$ equals to the number of rooms in the $$$i$$$-th dormitory. T...
["1 1\n1 9\n2 2\n2 13\n3 1\n3 12", "1 5\n2 1\n2 9999999994"]
#include <stdio.h> long long a[200005],b[200005]; long long sum[200005]={0}; int m,n; int main() { int i,j; a[0]=0; scanf("%d%d",&m,&n); for(i=1;i<=m;i++) { scanf("%lld",&a[i]); sum[i]=sum[i-1]+a[i]; } for(i=0;i<n;i++) scanf("%lld",&b[i]); int rt=1; for(i=0;i<...
There are $$$n$$$ dormitories in Berland State University, they are numbered with integers from $$$1$$$ to $$$n$$$. Each dormitory consists of rooms, there are $$$a_i$$$ rooms in $$$i$$$-th dormitory. The rooms in $$$i$$$-th dormitory are numbered from $$$1$$$ to $$$a_i$$$.A postman delivers letters. Sometimes there is...
Print $$$m$$$ lines. For each letter print two integers $$$f$$$ and $$$k$$$ โ€” the dormitory number $$$f$$$ $$$(1 \le f \le n)$$$ and the room number $$$k$$$ in this dormitory $$$(1 \le k \le a_f)$$$ to deliver the letter.
C
56bdab2019ee12e18d4f7e17ac414962
c654d950c51afd79fa5ea9d68fb1f91e
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "two pointers", "binary search", "implementation" ]
1526202300
["3 6\n10 15 12\n1 9 12 23 26 37", "2 3\n5 10000000000\n5 6 9999999999"]
NoteIn the first example letters should be delivered in the following order: the first letter in room $$$1$$$ of the first dormitory the second letter in room $$$9$$$ of the first dormitory the third letter in room $$$2$$$ of the second dormitory the fourth letter in room $$$13$$$ of the second dormitory the fifth...
PASSED
1,000
standard input
4 seconds
The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 2 \cdot 10^{5})$$$ โ€” the number of dormitories and the number of letters. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{10})$$$, where $$$a_i$$$ equals to the number of rooms in the $$$i$$$-th dormitory. T...
["1 1\n1 9\n2 2\n2 13\n3 1\n3 12", "1 5\n2 1\n2 9999999994"]
#include <stdio.h> #define N 200000 long long a[N + 1]; int lower_bound(long long *aa, int n, long long x) { int low = 0; int high = n; while (low < high){ int mid = low + (high - low) / 2; if (x <= aa[mid]){ high = mid; } else{ ...
There are $$$n$$$ dormitories in Berland State University, they are numbered with integers from $$$1$$$ to $$$n$$$. Each dormitory consists of rooms, there are $$$a_i$$$ rooms in $$$i$$$-th dormitory. The rooms in $$$i$$$-th dormitory are numbered from $$$1$$$ to $$$a_i$$$.A postman delivers letters. Sometimes there is...
Print $$$m$$$ lines. For each letter print two integers $$$f$$$ and $$$k$$$ โ€” the dormitory number $$$f$$$ $$$(1 \le f \le n)$$$ and the room number $$$k$$$ in this dormitory $$$(1 \le k \le a_f)$$$ to deliver the letter.
C
56bdab2019ee12e18d4f7e17ac414962
6678fae5045e64c672244afbe80d55e5
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "two pointers", "binary search", "implementation" ]
1526202300
["3 6\n10 15 12\n1 9 12 23 26 37", "2 3\n5 10000000000\n5 6 9999999999"]
NoteIn the first example letters should be delivered in the following order: the first letter in room $$$1$$$ of the first dormitory the second letter in room $$$9$$$ of the first dormitory the third letter in room $$$2$$$ of the second dormitory the fourth letter in room $$$13$$$ of the second dormitory the fifth...
PASSED
1,000
standard input
4 seconds
The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 2 \cdot 10^{5})$$$ โ€” the number of dormitories and the number of letters. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{10})$$$, where $$$a_i$$$ equals to the number of rooms in the $$$i$$$-th dormitory. T...
["1 1\n1 9\n2 2\n2 13\n3 1\n3 12", "1 5\n2 1\n2 9999999994"]
/* https://codeforces.com/contest/978/submission/74212074 (kaiboy) */ #include <stdio.h> #define N 200000 long long a[N + 1]; int main(){ int n, m, i; long long s, b; scanf("%d%d", &n, &m); for(i = 0; i < n; i++){ scanf("%lld", &a[i]); } i = s = 0; while(m--){ scanf("%lld", &b); while(i < n && s +...
There are $$$n$$$ dormitories in Berland State University, they are numbered with integers from $$$1$$$ to $$$n$$$. Each dormitory consists of rooms, there are $$$a_i$$$ rooms in $$$i$$$-th dormitory. The rooms in $$$i$$$-th dormitory are numbered from $$$1$$$ to $$$a_i$$$.A postman delivers letters. Sometimes there is...
Print $$$m$$$ lines. For each letter print two integers $$$f$$$ and $$$k$$$ โ€” the dormitory number $$$f$$$ $$$(1 \le f \le n)$$$ and the room number $$$k$$$ in this dormitory $$$(1 \le k \le a_f)$$$ to deliver the letter.
C
56bdab2019ee12e18d4f7e17ac414962
d5e96603d2206cc6c424322bcb6ecf68
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "two pointers", "binary search", "implementation" ]
1526202300
["3 6\n10 15 12\n1 9 12 23 26 37", "2 3\n5 10000000000\n5 6 9999999999"]
NoteIn the first example letters should be delivered in the following order: the first letter in room $$$1$$$ of the first dormitory the second letter in room $$$9$$$ of the first dormitory the third letter in room $$$2$$$ of the second dormitory the fourth letter in room $$$13$$$ of the second dormitory the fifth...
PASSED
1,000
standard input
4 seconds
The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 2 \cdot 10^{5})$$$ โ€” the number of dormitories and the number of letters. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{10})$$$, where $$$a_i$$$ equals to the number of rooms in the $$$i$$$-th dormitory. T...
["1 1\n1 9\n2 2\n2 13\n3 1\n3 12", "1 5\n2 1\n2 9999999994"]
#include<stdio.h> int main() { long long n,m,a[200001]= {0},t,i; scanf("%lld%lld",&n,&m); scanf("%lld",&a[1]); for(i=2; i<=n; i++) { scanf("%lld",&a[i]); a[i]+=a[i-1]; } i=0; while(m--) { scanf("%lld",&t); while(a[i]<t) i++; printf(...
There are $$$n$$$ dormitories in Berland State University, they are numbered with integers from $$$1$$$ to $$$n$$$. Each dormitory consists of rooms, there are $$$a_i$$$ rooms in $$$i$$$-th dormitory. The rooms in $$$i$$$-th dormitory are numbered from $$$1$$$ to $$$a_i$$$.A postman delivers letters. Sometimes there is...
Print $$$m$$$ lines. For each letter print two integers $$$f$$$ and $$$k$$$ โ€” the dormitory number $$$f$$$ $$$(1 \le f \le n)$$$ and the room number $$$k$$$ in this dormitory $$$(1 \le k \le a_f)$$$ to deliver the letter.
C
56bdab2019ee12e18d4f7e17ac414962
75a422969ce64f900d1d0c673e37efc7
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "two pointers", "binary search", "implementation" ]
1526202300
["3 6\n10 15 12\n1 9 12 23 26 37", "2 3\n5 10000000000\n5 6 9999999999"]
NoteIn the first example letters should be delivered in the following order: the first letter in room $$$1$$$ of the first dormitory the second letter in room $$$9$$$ of the first dormitory the third letter in room $$$2$$$ of the second dormitory the fourth letter in room $$$13$$$ of the second dormitory the fifth...
PASSED
1,000
standard input
4 seconds
The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 2 \cdot 10^{5})$$$ โ€” the number of dormitories and the number of letters. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{10})$$$, where $$$a_i$$$ equals to the number of rooms in the $$$i$$$-th dormitory. T...
["1 1\n1 9\n2 2\n2 13\n3 1\n3 12", "1 5\n2 1\n2 9999999994"]
#include<stdio.h> #include<stdlib.h> int main() { int n,m,i; long long num1=1,num2=1,j,cnt=0,k=0,cnt2=0; scanf("%d%d",&n,&m); long long *p=(long long *)malloc(n*sizeof(long long)); long long *q=(long long *)malloc(m*sizeof(long long)); for(i=0;i<n;i++) { scanf("%lld",&p[i]); } cnt=p[k]; for(j=0;j<m;j++) ...
There are $$$n$$$ dormitories in Berland State University, they are numbered with integers from $$$1$$$ to $$$n$$$. Each dormitory consists of rooms, there are $$$a_i$$$ rooms in $$$i$$$-th dormitory. The rooms in $$$i$$$-th dormitory are numbered from $$$1$$$ to $$$a_i$$$.A postman delivers letters. Sometimes there is...
Print $$$m$$$ lines. For each letter print two integers $$$f$$$ and $$$k$$$ โ€” the dormitory number $$$f$$$ $$$(1 \le f \le n)$$$ and the room number $$$k$$$ in this dormitory $$$(1 \le k \le a_f)$$$ to deliver the letter.
C
56bdab2019ee12e18d4f7e17ac414962
99568072beeba2f9037d5b7f676ca7c9
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "two pointers", "binary search", "implementation" ]
1526202300
["3 6\n10 15 12\n1 9 12 23 26 37", "2 3\n5 10000000000\n5 6 9999999999"]
NoteIn the first example letters should be delivered in the following order: the first letter in room $$$1$$$ of the first dormitory the second letter in room $$$9$$$ of the first dormitory the third letter in room $$$2$$$ of the second dormitory the fourth letter in room $$$13$$$ of the second dormitory the fifth...
PASSED
1,000
standard input
4 seconds
The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 2 \cdot 10^{5})$$$ โ€” the number of dormitories and the number of letters. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{10})$$$, where $$$a_i$$$ equals to the number of rooms in the $$$i$$$-th dormitory. T...
["1 1\n1 9\n2 2\n2 13\n3 1\n3 12", "1 5\n2 1\n2 9999999994"]
#include<stdio.h> int main(){ long long int num1,num2,q1,q2; scanf("%lld %lld",&num1,&num2); q1=num1; q2=num2; long long int i=0,j=0,k=0; long long int a[q1+50],b[q2+50]; for(i=0;i<num1;i++){ scanf("%lld",&a[i]); } for(i=0;i<num2;i++){ scanf("%lld",&b[i]); } for(i=0;i<num1;i++){ k=k+a[i]; for(;j<num...
There are $$$n$$$ dormitories in Berland State University, they are numbered with integers from $$$1$$$ to $$$n$$$. Each dormitory consists of rooms, there are $$$a_i$$$ rooms in $$$i$$$-th dormitory. The rooms in $$$i$$$-th dormitory are numbered from $$$1$$$ to $$$a_i$$$.A postman delivers letters. Sometimes there is...
Print $$$m$$$ lines. For each letter print two integers $$$f$$$ and $$$k$$$ โ€” the dormitory number $$$f$$$ $$$(1 \le f \le n)$$$ and the room number $$$k$$$ in this dormitory $$$(1 \le k \le a_f)$$$ to deliver the letter.
C
56bdab2019ee12e18d4f7e17ac414962
d6fcef36ad53d74785c75873cdf9f79c
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "two pointers", "binary search", "implementation" ]
1526202300
["3 6\n10 15 12\n1 9 12 23 26 37", "2 3\n5 10000000000\n5 6 9999999999"]
NoteIn the first example letters should be delivered in the following order: the first letter in room $$$1$$$ of the first dormitory the second letter in room $$$9$$$ of the first dormitory the third letter in room $$$2$$$ of the second dormitory the fourth letter in room $$$13$$$ of the second dormitory the fifth...
PASSED
1,000
standard input
4 seconds
The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 2 \cdot 10^{5})$$$ โ€” the number of dormitories and the number of letters. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{10})$$$, where $$$a_i$$$ equals to the number of rooms in the $$$i$$$-th dormitory. T...
["1 1\n1 9\n2 2\n2 13\n3 1\n3 12", "1 5\n2 1\n2 9999999994"]
#include <stdio.h> int main(void) { // your code goes here long n,m,i,j; scanf("%ld %ld", &n,&m); long long a[n]; long long k,sum1=0,sum2=0; for(i=0;i<n;i++) scanf("%lld", &a[i]); j=0; sum1+=a[0]; i=1; while(j!=m) {scanf("%lld", &k); while(k>sum1) { sum2=sum1; sum1+=a[i]; i++; } p...
There are $$$n$$$ dormitories in Berland State University, they are numbered with integers from $$$1$$$ to $$$n$$$. Each dormitory consists of rooms, there are $$$a_i$$$ rooms in $$$i$$$-th dormitory. The rooms in $$$i$$$-th dormitory are numbered from $$$1$$$ to $$$a_i$$$.A postman delivers letters. Sometimes there is...
Print $$$m$$$ lines. For each letter print two integers $$$f$$$ and $$$k$$$ โ€” the dormitory number $$$f$$$ $$$(1 \le f \le n)$$$ and the room number $$$k$$$ in this dormitory $$$(1 \le k \le a_f)$$$ to deliver the letter.
C
56bdab2019ee12e18d4f7e17ac414962
da99350357907e7d2b7cb820fd42f87d
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "two pointers", "binary search", "implementation" ]
1526202300
["3 6\n10 15 12\n1 9 12 23 26 37", "2 3\n5 10000000000\n5 6 9999999999"]
NoteIn the first example letters should be delivered in the following order: the first letter in room $$$1$$$ of the first dormitory the second letter in room $$$9$$$ of the first dormitory the third letter in room $$$2$$$ of the second dormitory the fourth letter in room $$$13$$$ of the second dormitory the fifth...
PASSED
1,000
standard input
4 seconds
The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 2 \cdot 10^{5})$$$ โ€” the number of dormitories and the number of letters. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{10})$$$, where $$$a_i$$$ equals to the number of rooms in the $$$i$$$-th dormitory. T...
["1 1\n1 9\n2 2\n2 13\n3 1\n3 12", "1 5\n2 1\n2 9999999994"]
#include <stdio.h> int main(void) { long long int n,m,i,j,c; scanf("%lld%lld",&n,&m); long long int a[n],ac[n],b[m]; for(i=0;i<n;i++) { scanf("%lld",&a[i]); if(i==0) { ac[i]=a[i]; } else ac[i]=a[i]+ac[i-1]; } c=0; for(j=0;j<m;j++) {scanf("%lld",&b[j]); for(i=c;i<n;i++) ...
There are $$$n$$$ dormitories in Berland State University, they are numbered with integers from $$$1$$$ to $$$n$$$. Each dormitory consists of rooms, there are $$$a_i$$$ rooms in $$$i$$$-th dormitory. The rooms in $$$i$$$-th dormitory are numbered from $$$1$$$ to $$$a_i$$$.A postman delivers letters. Sometimes there is...
Print $$$m$$$ lines. For each letter print two integers $$$f$$$ and $$$k$$$ โ€” the dormitory number $$$f$$$ $$$(1 \le f \le n)$$$ and the room number $$$k$$$ in this dormitory $$$(1 \le k \le a_f)$$$ to deliver the letter.
C
56bdab2019ee12e18d4f7e17ac414962
2479a238c1846ff86be46de72d66fa15
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "two pointers", "binary search", "implementation" ]
1526202300
["3 6\n10 15 12\n1 9 12 23 26 37", "2 3\n5 10000000000\n5 6 9999999999"]
NoteIn the first example letters should be delivered in the following order: the first letter in room $$$1$$$ of the first dormitory the second letter in room $$$9$$$ of the first dormitory the third letter in room $$$2$$$ of the second dormitory the fourth letter in room $$$13$$$ of the second dormitory the fifth...
PASSED
1,000
standard input
4 seconds
The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 2 \cdot 10^{5})$$$ โ€” the number of dormitories and the number of letters. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{10})$$$, where $$$a_i$$$ equals to the number of rooms in the $$$i$$$-th dormitory. T...
["1 1\n1 9\n2 2\n2 13\n3 1\n3 12", "1 5\n2 1\n2 9999999994"]
#include<stdio.h> int main() { int n,m; scanf("%d %d",&n,&m); long long cumm[n+1]; for(int i=0;i<n+1;i++)cumm[i]=0; long long l[m]; long long a[n]; for(int i=0;i<n;i++) { scanf("%I64d",&a[i]); } for(int i=0;i<m;i++) { scanf("%I64d",&l[i]); } for(int i=1;i<n+1;i++) { cumm[i]=cumm[i-...
There are $$$n$$$ dormitories in Berland State University, they are numbered with integers from $$$1$$$ to $$$n$$$. Each dormitory consists of rooms, there are $$$a_i$$$ rooms in $$$i$$$-th dormitory. The rooms in $$$i$$$-th dormitory are numbered from $$$1$$$ to $$$a_i$$$.A postman delivers letters. Sometimes there is...
Print $$$m$$$ lines. For each letter print two integers $$$f$$$ and $$$k$$$ โ€” the dormitory number $$$f$$$ $$$(1 \le f \le n)$$$ and the room number $$$k$$$ in this dormitory $$$(1 \le k \le a_f)$$$ to deliver the letter.
C
56bdab2019ee12e18d4f7e17ac414962
7c1e536188bead782245ad22bf356336
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "two pointers", "binary search", "implementation" ]
1526202300
["3 6\n10 15 12\n1 9 12 23 26 37", "2 3\n5 10000000000\n5 6 9999999999"]
NoteIn the first example letters should be delivered in the following order: the first letter in room $$$1$$$ of the first dormitory the second letter in room $$$9$$$ of the first dormitory the third letter in room $$$2$$$ of the second dormitory the fourth letter in room $$$13$$$ of the second dormitory the fifth...
PASSED
1,000
standard input
4 seconds
The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 2 \cdot 10^{5})$$$ โ€” the number of dormitories and the number of letters. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{10})$$$, where $$$a_i$$$ equals to the number of rooms in the $$$i$$$-th dormitory. T...
["1 1\n1 9\n2 2\n2 13\n3 1\n3 12", "1 5\n2 1\n2 9999999994"]
#include <stdio.h> unsigned long long a[200001]; int main() { int n, m; scanf("%d%d", &n, &m); for (int i = 1; i <= n; i++) { scanf("%llu", &a[i]); a[i] += a[i-1]; } int idx = 1; for (int i = 0; i < m; i++) { unsigned long long b; scanf("%llu", &b); whil...
There are $$$n$$$ dormitories in Berland State University, they are numbered with integers from $$$1$$$ to $$$n$$$. Each dormitory consists of rooms, there are $$$a_i$$$ rooms in $$$i$$$-th dormitory. The rooms in $$$i$$$-th dormitory are numbered from $$$1$$$ to $$$a_i$$$.A postman delivers letters. Sometimes there is...
Print $$$m$$$ lines. For each letter print two integers $$$f$$$ and $$$k$$$ โ€” the dormitory number $$$f$$$ $$$(1 \le f \le n)$$$ and the room number $$$k$$$ in this dormitory $$$(1 \le k \le a_f)$$$ to deliver the letter.
C
56bdab2019ee12e18d4f7e17ac414962
91d8984d896efad3f7ec92115da4dbcc
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "two pointers", "binary search", "implementation" ]
1526202300
["3 6\n10 15 12\n1 9 12 23 26 37", "2 3\n5 10000000000\n5 6 9999999999"]
NoteIn the first example letters should be delivered in the following order: the first letter in room $$$1$$$ of the first dormitory the second letter in room $$$9$$$ of the first dormitory the third letter in room $$$2$$$ of the second dormitory the fourth letter in room $$$13$$$ of the second dormitory the fifth...
PASSED
1,000
standard input
4 seconds
The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 2 \cdot 10^{5})$$$ โ€” the number of dormitories and the number of letters. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{10})$$$, where $$$a_i$$$ equals to the number of rooms in the $$$i$$$-th dormitory. T...
["1 1\n1 9\n2 2\n2 13\n3 1\n3 12", "1 5\n2 1\n2 9999999994"]
#include<stdio.h> typedef long long ll; int main() { ll n,m,p=0; scanf("%lld%lld",&n,&m); ll a,ar[n],br[m],temp,sum; for(ll i=0;i<n;i++) { scanf("%lld",&a); if(i==0) ar[i]=a; else ar[i]=a+ar[i-1]; } //for(ll i=0;i<n;i++) //printf("%lld ",ar[i]); for(ll i=0;i<m;i++...
There are $$$n$$$ dormitories in Berland State University, they are numbered with integers from $$$1$$$ to $$$n$$$. Each dormitory consists of rooms, there are $$$a_i$$$ rooms in $$$i$$$-th dormitory. The rooms in $$$i$$$-th dormitory are numbered from $$$1$$$ to $$$a_i$$$.A postman delivers letters. Sometimes there is...
Print $$$m$$$ lines. For each letter print two integers $$$f$$$ and $$$k$$$ โ€” the dormitory number $$$f$$$ $$$(1 \le f \le n)$$$ and the room number $$$k$$$ in this dormitory $$$(1 \le k \le a_f)$$$ to deliver the letter.
C
56bdab2019ee12e18d4f7e17ac414962
a5c45967ec4e78f649a8b34892eca417
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "two pointers", "binary search", "implementation" ]
1526202300
["3 6\n10 15 12\n1 9 12 23 26 37", "2 3\n5 10000000000\n5 6 9999999999"]
NoteIn the first example letters should be delivered in the following order: the first letter in room $$$1$$$ of the first dormitory the second letter in room $$$9$$$ of the first dormitory the third letter in room $$$2$$$ of the second dormitory the fourth letter in room $$$13$$$ of the second dormitory the fifth...
PASSED
1,000
standard input
4 seconds
The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 2 \cdot 10^{5})$$$ โ€” the number of dormitories and the number of letters. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{10})$$$, where $$$a_i$$$ equals to the number of rooms in the $$$i$$$-th dormitory. T...
["1 1\n1 9\n2 2\n2 13\n3 1\n3 12", "1 5\n2 1\n2 9999999994"]
#include <stdio.h> long long a[200200]; long long ps[200200]; int n, m; int bs(long long val) { int l = 1, r = n, ans = -1; while (l <= r) { int m = l + (r - l) / 2; if (val >= ps[m]) { ans = m; l = m + 1; } else r = m - 1; } return ans; } void ...
There are $$$n$$$ dormitories in Berland State University, they are numbered with integers from $$$1$$$ to $$$n$$$. Each dormitory consists of rooms, there are $$$a_i$$$ rooms in $$$i$$$-th dormitory. The rooms in $$$i$$$-th dormitory are numbered from $$$1$$$ to $$$a_i$$$.A postman delivers letters. Sometimes there is...
Print $$$m$$$ lines. For each letter print two integers $$$f$$$ and $$$k$$$ โ€” the dormitory number $$$f$$$ $$$(1 \le f \le n)$$$ and the room number $$$k$$$ in this dormitory $$$(1 \le k \le a_f)$$$ to deliver the letter.
C
56bdab2019ee12e18d4f7e17ac414962
3b5a4e6fdb06987ae0b3bf7d87cf4a91
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "two pointers", "binary search", "implementation" ]
1526202300
["3 6\n10 15 12\n1 9 12 23 26 37", "2 3\n5 10000000000\n5 6 9999999999"]
NoteIn the first example letters should be delivered in the following order: the first letter in room $$$1$$$ of the first dormitory the second letter in room $$$9$$$ of the first dormitory the third letter in room $$$2$$$ of the second dormitory the fourth letter in room $$$13$$$ of the second dormitory the fifth...
PASSED
1,000
standard input
4 seconds
The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 2 \cdot 10^{5})$$$ โ€” the number of dormitories and the number of letters. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{10})$$$, where $$$a_i$$$ equals to the number of rooms in the $$$i$$$-th dormitory. T...
["1 1\n1 9\n2 2\n2 13\n3 1\n3 12", "1 5\n2 1\n2 9999999994"]
#include<stdio.h> #define ll long long int main() { ll n,m,j=1; scanf("%I64d%I64d", &n,&m); ll a,b,k[n+5]; k[0]=0; for(ll i=1; i<=n; i++) { scanf("%I64d", &a); k[i]=k[i-1]+a; } while(m--) { scanf("%lld", &b); while(k[j]<b) j++; ...
There are $$$n$$$ dormitories in Berland State University, they are numbered with integers from $$$1$$$ to $$$n$$$. Each dormitory consists of rooms, there are $$$a_i$$$ rooms in $$$i$$$-th dormitory. The rooms in $$$i$$$-th dormitory are numbered from $$$1$$$ to $$$a_i$$$.A postman delivers letters. Sometimes there is...
Print $$$m$$$ lines. For each letter print two integers $$$f$$$ and $$$k$$$ โ€” the dormitory number $$$f$$$ $$$(1 \le f \le n)$$$ and the room number $$$k$$$ in this dormitory $$$(1 \le k \le a_f)$$$ to deliver the letter.
C
56bdab2019ee12e18d4f7e17ac414962
9545a128e16fa143c0b728013bbf055a
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "two pointers", "binary search", "implementation" ]
1526202300
["3 6\n10 15 12\n1 9 12 23 26 37", "2 3\n5 10000000000\n5 6 9999999999"]
NoteIn the first example letters should be delivered in the following order: the first letter in room $$$1$$$ of the first dormitory the second letter in room $$$9$$$ of the first dormitory the third letter in room $$$2$$$ of the second dormitory the fourth letter in room $$$13$$$ of the second dormitory the fifth...
PASSED
1,000
standard input
4 seconds
The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 2 \cdot 10^{5})$$$ โ€” the number of dormitories and the number of letters. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{10})$$$, where $$$a_i$$$ equals to the number of rooms in the $$$i$$$-th dormitory. T...
["1 1\n1 9\n2 2\n2 13\n3 1\n3 12", "1 5\n2 1\n2 9999999994"]
#include <stdio.h> int main() { long long int m,n,i,j,c=0; scanf("%lld%lld",&m,&n); long long int r[m],l[n],max[m]; for(i=0;i<m;i++) { scanf("%lld",&r[i]); } for(i=0;i<n;i++) { scanf("%lld",&l[i]); } max[0]=r[0]; for(i=1;i<m;i++) { max[i]=r[i]+max[...
There are $$$n$$$ dormitories in Berland State University, they are numbered with integers from $$$1$$$ to $$$n$$$. Each dormitory consists of rooms, there are $$$a_i$$$ rooms in $$$i$$$-th dormitory. The rooms in $$$i$$$-th dormitory are numbered from $$$1$$$ to $$$a_i$$$.A postman delivers letters. Sometimes there is...
Print $$$m$$$ lines. For each letter print two integers $$$f$$$ and $$$k$$$ โ€” the dormitory number $$$f$$$ $$$(1 \le f \le n)$$$ and the room number $$$k$$$ in this dormitory $$$(1 \le k \le a_f)$$$ to deliver the letter.
C
56bdab2019ee12e18d4f7e17ac414962
6bb68fb73f99756a7932b193fe5e1835
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "two pointers", "binary search", "implementation" ]
1526202300
["3 6\n10 15 12\n1 9 12 23 26 37", "2 3\n5 10000000000\n5 6 9999999999"]
NoteIn the first example letters should be delivered in the following order: the first letter in room $$$1$$$ of the first dormitory the second letter in room $$$9$$$ of the first dormitory the third letter in room $$$2$$$ of the second dormitory the fourth letter in room $$$13$$$ of the second dormitory the fifth...
PASSED
1,000
standard input
4 seconds
The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 2 \cdot 10^{5})$$$ โ€” the number of dormitories and the number of letters. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{10})$$$, where $$$a_i$$$ equals to the number of rooms in the $$$i$$$-th dormitory. T...
["1 1\n1 9\n2 2\n2 13\n3 1\n3 12", "1 5\n2 1\n2 9999999994"]
#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> #define queue struct queue1 long cmpfunc(const void *a,const void *b){ return (long*)a-(long*)b; } long long n,m; long long dor[200005]; int main(void){ scanf("%lld",&n); scanf("%lld",&m); long long count; for (count = 0; count < n; coun...
There are $$$n$$$ dormitories in Berland State University, they are numbered with integers from $$$1$$$ to $$$n$$$. Each dormitory consists of rooms, there are $$$a_i$$$ rooms in $$$i$$$-th dormitory. The rooms in $$$i$$$-th dormitory are numbered from $$$1$$$ to $$$a_i$$$.A postman delivers letters. Sometimes there is...
Print $$$m$$$ lines. For each letter print two integers $$$f$$$ and $$$k$$$ โ€” the dormitory number $$$f$$$ $$$(1 \le f \le n)$$$ and the room number $$$k$$$ in this dormitory $$$(1 \le k \le a_f)$$$ to deliver the letter.
C
56bdab2019ee12e18d4f7e17ac414962
1e1c12827a17a3ef8ae2aabacc696f83
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "two pointers", "binary search", "implementation" ]
1526202300
["3 6\n10 15 12\n1 9 12 23 26 37", "2 3\n5 10000000000\n5 6 9999999999"]
NoteIn the first example letters should be delivered in the following order: the first letter in room $$$1$$$ of the first dormitory the second letter in room $$$9$$$ of the first dormitory the third letter in room $$$2$$$ of the second dormitory the fourth letter in room $$$13$$$ of the second dormitory the fifth...
PASSED
1,000
standard input
4 seconds
The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 2 \cdot 10^{5})$$$ โ€” the number of dormitories and the number of letters. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{10})$$$, where $$$a_i$$$ equals to the number of rooms in the $$$i$$$-th dormitory. T...
["1 1\n1 9\n2 2\n2 13\n3 1\n3 12", "1 5\n2 1\n2 9999999994"]
#include<stdio.h> #include<math.h> long long rm[200005]={0},xin[200005]; int n,m; int main() { int i,j; scanf("%d %d",&n,&m); for(i=1;i<=n;i++) { scanf("%I64d",&rm[i]); rm[i]+=rm[i-1]; } for(i=1;i<=m;i++) scanf("%I64d",&xin[i]); for(i=1,j=1;i<=m;i++) { if(xin[i]<=rm[j]) { printf("%d %I64d\n",j,xin[...
There are $$$n$$$ dormitories in Berland State University, they are numbered with integers from $$$1$$$ to $$$n$$$. Each dormitory consists of rooms, there are $$$a_i$$$ rooms in $$$i$$$-th dormitory. The rooms in $$$i$$$-th dormitory are numbered from $$$1$$$ to $$$a_i$$$.A postman delivers letters. Sometimes there is...
Print $$$m$$$ lines. For each letter print two integers $$$f$$$ and $$$k$$$ โ€” the dormitory number $$$f$$$ $$$(1 \le f \le n)$$$ and the room number $$$k$$$ in this dormitory $$$(1 \le k \le a_f)$$$ to deliver the letter.
C
56bdab2019ee12e18d4f7e17ac414962
4f502ee2fbb03072fb2cdea3ebf06a29
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "two pointers", "binary search", "implementation" ]
1526202300
["3 6\n10 15 12\n1 9 12 23 26 37", "2 3\n5 10000000000\n5 6 9999999999"]
NoteIn the first example letters should be delivered in the following order: the first letter in room $$$1$$$ of the first dormitory the second letter in room $$$9$$$ of the first dormitory the third letter in room $$$2$$$ of the second dormitory the fourth letter in room $$$13$$$ of the second dormitory the fifth...
PASSED
1,000
standard input
4 seconds
The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 2 \cdot 10^{5})$$$ โ€” the number of dormitories and the number of letters. The second line contains a sequence $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^{10})$$$, where $$$a_i$$$ equals to the number of rooms in the $$$i$$$-th dormitory. T...
["1 1\n1 9\n2 2\n2 13\n3 1\n3 12", "1 5\n2 1\n2 9999999994"]
///IMTMTO... #include<stdio.h> typedef long long ll; int main() { ll n,k; scanf("%lld%lld",&n,&k); ll a[n+1],i,m=0,x; a[0]=0; for(i=1;i<=n;i++){ scanf("%lld",&x); m+=x; a[i]=m; } ll q; for(i=1;i<=k;i++){ scanf("%lld",&q); ll high,mid,low; l...
The best programmers of Embezzland compete to develop a part of the project called "e-Government" โ€” the system of automated statistic collecting and press analysis.We know that any of the k citizens can become a member of the Embezzland government. The citizens' surnames are a1,โ€‰a2,โ€‰...,โ€‰ak. All surnames are different....
For any "calculate politicization" operation print on a separate line the degree of the politicization of the given text. Print nothing for other operations.
C
b3038ba22e3442c142a99f485dd55308
ad1f52c28958523ea4ac54d8f93eebb6
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "dp", "data structures", "dfs and similar", "trees", "strings" ]
1332687900
["7 3\na\naa\nab\n?aaab\n-2\n?aaab\n-3\n?aaab\n+2\n?aabbaa"]
null
PASSED
2,800
standard input
1 second
The first line contains space-separated integers n and k (1โ€‰โ‰คโ€‰n,โ€‰kโ€‰โ‰คโ€‰105) โ€” the number of queries to the system and the number of potential government members. Next k lines contain the surnames a1,โ€‰a2,โ€‰...,โ€‰ak, one per line. All surnames are pairwise different. Next n lines contain queries to the system, one per line. ...
["6\n4\n3\n6"]
#include <stdio.h> #include <string.h> #define M 100000 #define L 1000000 #define N (1 + 1 + L) #define A 26 int oo[1 + N - 1], oj[1 + N - 1]; int link(int o, int j) { static int _ = 1; oo[_] = o, oj[_] = j; return _++; } int tt[N][A], ae[N], ta[N], tb[N]; void dfs(int i) { static int time; int o; ta[i] = ...
There is a matrix A of size xโ€‰ร—โ€‰y filled with integers. For every , Ai,โ€‰jโ€‰=โ€‰y(iโ€‰-โ€‰1)โ€‰+โ€‰j. Obviously, every integer from [1..xy] occurs exactly once in this matrix. You have traversed some path in this matrix. Your path can be described as a sequence of visited cells a1, a2, ..., an denoting that you started in the cel...
If all possible values of x and y such that 1โ€‰โ‰คโ€‰x,โ€‰yโ€‰โ‰คโ€‰109 contradict with the information about your path, print NO. Otherwise, print YES in the first line, and in the second line print the values x and y such that your path was possible with such number of lines and columns in the matrix. Remember that they must be p...
C
3b725f11009768904514d87e2c7714ee
d7e2a5839028a6efb2288eb15e908ed2
GNU C
standard output
256 megabytes
train_000.jsonl
[ "implementation" ]
1521698700
["8\n1 2 3 6 9 8 5 2", "6\n1 2 1 2 5 3", "2\n1 10"]
NoteThe matrix and the path on it in the first test looks like this: Also there exist multiple correct answers for both the first and the third examples.
PASSED
1,700
standard input
1 second
The first line contains one integer number n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰200000) โ€” the number of cells you visited on your path (if some cell is visited twice, then it's listed twice). The second line contains n integers a1, a2, ..., an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109) โ€” the integers in the cells on your path.
["YES\n3 3", "NO", "YES\n4 9"]
#include<stdio.h> #include<math.h> int main() { int a[200000],n,w=1,x,y,i; scanf("%d",&n); for(i=0;i<n;i++) scanf("%d",&a[i]); for(i=1;i<n;i++) if(abs(a[i]-a[i-1])!=1) { if(a[i]==a[i-1]) { printf("NO"); return 0; } else { w=abs(a[i]-a[i-1]); break; } } y=ceil((double)a[0]/...
There is a matrix A of size xโ€‰ร—โ€‰y filled with integers. For every , Ai,โ€‰jโ€‰=โ€‰y(iโ€‰-โ€‰1)โ€‰+โ€‰j. Obviously, every integer from [1..xy] occurs exactly once in this matrix. You have traversed some path in this matrix. Your path can be described as a sequence of visited cells a1, a2, ..., an denoting that you started in the cel...
If all possible values of x and y such that 1โ€‰โ‰คโ€‰x,โ€‰yโ€‰โ‰คโ€‰109 contradict with the information about your path, print NO. Otherwise, print YES in the first line, and in the second line print the values x and y such that your path was possible with such number of lines and columns in the matrix. Remember that they must be p...
C
3b725f11009768904514d87e2c7714ee
8898945f4cb8db2dca3ad00c6f75b015
GNU C
standard output
256 megabytes
train_000.jsonl
[ "implementation" ]
1521698700
["8\n1 2 3 6 9 8 5 2", "6\n1 2 1 2 5 3", "2\n1 10"]
NoteThe matrix and the path on it in the first test looks like this: Also there exist multiple correct answers for both the first and the third examples.
PASSED
1,700
standard input
1 second
The first line contains one integer number n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰200000) โ€” the number of cells you visited on your path (if some cell is visited twice, then it's listed twice). The second line contains n integers a1, a2, ..., an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109) โ€” the integers in the cells on your path.
["YES\n3 3", "NO", "YES\n4 9"]
//set many funcs template #include<stdio.h> #include<string.h> #include<stdlib.h> #include<stdbool.h> #include<time.h> #define inf 1072114514 #define llinf 4154118101919364364 #define mod 1000000007 #define pi 3.1415926535897932384 int max(int a,int b){if(a>b){return a;}return b;} int min(int a,int b){if(a<b){return a...
There is a matrix A of size xโ€‰ร—โ€‰y filled with integers. For every , Ai,โ€‰jโ€‰=โ€‰y(iโ€‰-โ€‰1)โ€‰+โ€‰j. Obviously, every integer from [1..xy] occurs exactly once in this matrix. You have traversed some path in this matrix. Your path can be described as a sequence of visited cells a1, a2, ..., an denoting that you started in the cel...
If all possible values of x and y such that 1โ€‰โ‰คโ€‰x,โ€‰yโ€‰โ‰คโ€‰109 contradict with the information about your path, print NO. Otherwise, print YES in the first line, and in the second line print the values x and y such that your path was possible with such number of lines and columns in the matrix. Remember that they must be p...
C
3b725f11009768904514d87e2c7714ee
2a923a9ddd04365e679aa57359a31811
GNU C
standard output
256 megabytes
train_000.jsonl
[ "implementation" ]
1521698700
["8\n1 2 3 6 9 8 5 2", "6\n1 2 1 2 5 3", "2\n1 10"]
NoteThe matrix and the path on it in the first test looks like this: Also there exist multiple correct answers for both the first and the third examples.
PASSED
1,700
standard input
1 second
The first line contains one integer number n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰200000) โ€” the number of cells you visited on your path (if some cell is visited twice, then it's listed twice). The second line contains n integers a1, a2, ..., an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109) โ€” the integers in the cells on your path.
["YES\n3 3", "NO", "YES\n4 9"]
#include<stdio.h> int a[200005]; int main() { int n,flag = 0; scanf("%d",&n); int max1= 0,sum1=0,sum2; for(int i = 0; i < n; i++) { scanf("%d",&a[i]); if(a[i]>max1) max1 = a[i]; } for(int i = 1; i < n; i++) { if(flag) break; sum2 = ...
There is a matrix A of size xโ€‰ร—โ€‰y filled with integers. For every , Ai,โ€‰jโ€‰=โ€‰y(iโ€‰-โ€‰1)โ€‰+โ€‰j. Obviously, every integer from [1..xy] occurs exactly once in this matrix. You have traversed some path in this matrix. Your path can be described as a sequence of visited cells a1, a2, ..., an denoting that you started in the cel...
If all possible values of x and y such that 1โ€‰โ‰คโ€‰x,โ€‰yโ€‰โ‰คโ€‰109 contradict with the information about your path, print NO. Otherwise, print YES in the first line, and in the second line print the values x and y such that your path was possible with such number of lines and columns in the matrix. Remember that they must be p...
C
3b725f11009768904514d87e2c7714ee
c167da1807719daf9c762617a0ae68fc
GNU C
standard output
256 megabytes
train_000.jsonl
[ "implementation" ]
1521698700
["8\n1 2 3 6 9 8 5 2", "6\n1 2 1 2 5 3", "2\n1 10"]
NoteThe matrix and the path on it in the first test looks like this: Also there exist multiple correct answers for both the first and the third examples.
PASSED
1,700
standard input
1 second
The first line contains one integer number n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰200000) โ€” the number of cells you visited on your path (if some cell is visited twice, then it's listed twice). The second line contains n integers a1, a2, ..., an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109) โ€” the integers in the cells on your path.
["YES\n3 3", "NO", "YES\n4 9"]
#pragma option -O3 #include <stdio.h> #include <time.h> int a[200010]; int inline abs(int x) { if (x < 0) return -x; return x; } int main() { int n; scanf("%d", &n); int y = 1; for (int i = 0; i < n; i++) { scanf("%d", &a[i]); a[i]--; } /*if (a[1] == 491503403) { printf("YES\n1000000000 71669597"); ...
You have a simple undirected graph consisting of $$$n$$$ vertices and $$$m$$$ edges. The graph doesn't contain self-loops, there is at most one edge between a pair of vertices. The given graph can be disconnected.Let's make a definition.Let $$$v_1$$$ and $$$v_2$$$ be two some nonempty subsets of vertices that do not in...
If the answer exists, print $$$n$$$ integers. $$$i$$$-th integer means the vertex set number (from $$$1$$$ to $$$3$$$) of $$$i$$$-th vertex. Otherwise, print $$$-1$$$. If there are multiple answers, print any.
C
7dea96a7599946a5b5d0b389c7e76651
ceb48c407dd3c5256c1b3be8dc265f18
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "hashing", "graphs", "constructive algorithms", "implementation", "brute force" ]
1569762300
["6 11\n1 2\n1 3\n1 4\n1 5\n1 6\n2 4\n2 5\n2 6\n3 4\n3 5\n3 6", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4"]
NoteIn the first example, if $$$v_{1} = \{ 1 \}$$$, $$$v_{2} = \{ 2, 3 \}$$$, and $$$v_{3} = \{ 4, 5, 6 \}$$$ then vertex sets will satisfy all conditions. But you can assign vertices to vertex sets in a different way; Other answers like "2 3 3 1 1 1" will be accepted as well. In the second example, it's impossible to...
PASSED
1,900
standard input
2 seconds
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$3 \le n \le 10^{5}$$$, $$$0 \le m \le \text{min}(3 \cdot 10^{5}, \frac{n(n-1)}{2})$$$)ย โ€” the number of vertices and edges in the graph. The $$$i$$$-th of the next $$$m$$$ lines contains two integers $$$a_{i}$$$ and $$$b_{i}$$$ ($$$1 \le a_{i} \lt b_{i} \le n$...
["1 2 2 3 3 3", "-1"]
#include <stdio.h> int D[100001]; int H[100001]; int V[600001]; int N[600001]; int C; int R[100001]; int nC[4]; void initial(int n) { int i; for (i = 1; i <= n; i++) { D[i] = 0; } for (i = 1; i <= n; i++) { H[i] = -1; } C = 0; } void aE(int u, int v) { V[C] = v; N...
You have a simple undirected graph consisting of $$$n$$$ vertices and $$$m$$$ edges. The graph doesn't contain self-loops, there is at most one edge between a pair of vertices. The given graph can be disconnected.Let's make a definition.Let $$$v_1$$$ and $$$v_2$$$ be two some nonempty subsets of vertices that do not in...
If the answer exists, print $$$n$$$ integers. $$$i$$$-th integer means the vertex set number (from $$$1$$$ to $$$3$$$) of $$$i$$$-th vertex. Otherwise, print $$$-1$$$. If there are multiple answers, print any.
C
7dea96a7599946a5b5d0b389c7e76651
931461f8cd72bd23354af87ea5a920ad
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "hashing", "graphs", "constructive algorithms", "implementation", "brute force" ]
1569762300
["6 11\n1 2\n1 3\n1 4\n1 5\n1 6\n2 4\n2 5\n2 6\n3 4\n3 5\n3 6", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4"]
NoteIn the first example, if $$$v_{1} = \{ 1 \}$$$, $$$v_{2} = \{ 2, 3 \}$$$, and $$$v_{3} = \{ 4, 5, 6 \}$$$ then vertex sets will satisfy all conditions. But you can assign vertices to vertex sets in a different way; Other answers like "2 3 3 1 1 1" will be accepted as well. In the second example, it's impossible to...
PASSED
1,900
standard input
2 seconds
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$3 \le n \le 10^{5}$$$, $$$0 \le m \le \text{min}(3 \cdot 10^{5}, \frac{n(n-1)}{2})$$$)ย โ€” the number of vertices and edges in the graph. The $$$i$$$-th of the next $$$m$$$ lines contains two integers $$$a_{i}$$$ and $$$b_{i}$$$ ($$$1 \le a_{i} \lt b_{i} \le n$...
["1 2 2 3 3 3", "-1"]
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <time.h> #include <limits.h> typedef long long ll; ll MAX = 100000000000; // 1e11 ll MIN = -100000000000; // -1e11 ll MOD = 1000000007; ll longlongmax = __LONG_LONG_MAX__; ll maxormin(ll a,...
You have a simple undirected graph consisting of $$$n$$$ vertices and $$$m$$$ edges. The graph doesn't contain self-loops, there is at most one edge between a pair of vertices. The given graph can be disconnected.Let's make a definition.Let $$$v_1$$$ and $$$v_2$$$ be two some nonempty subsets of vertices that do not in...
If the answer exists, print $$$n$$$ integers. $$$i$$$-th integer means the vertex set number (from $$$1$$$ to $$$3$$$) of $$$i$$$-th vertex. Otherwise, print $$$-1$$$. If there are multiple answers, print any.
C
7dea96a7599946a5b5d0b389c7e76651
a6e5873aa844cb637cc191801389e7bf
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "hashing", "graphs", "constructive algorithms", "implementation", "brute force" ]
1569762300
["6 11\n1 2\n1 3\n1 4\n1 5\n1 6\n2 4\n2 5\n2 6\n3 4\n3 5\n3 6", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4"]
NoteIn the first example, if $$$v_{1} = \{ 1 \}$$$, $$$v_{2} = \{ 2, 3 \}$$$, and $$$v_{3} = \{ 4, 5, 6 \}$$$ then vertex sets will satisfy all conditions. But you can assign vertices to vertex sets in a different way; Other answers like "2 3 3 1 1 1" will be accepted as well. In the second example, it's impossible to...
PASSED
1,900
standard input
2 seconds
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$3 \le n \le 10^{5}$$$, $$$0 \le m \le \text{min}(3 \cdot 10^{5}, \frac{n(n-1)}{2})$$$)ย โ€” the number of vertices and edges in the graph. The $$$i$$$-th of the next $$$m$$$ lines contains two integers $$$a_{i}$$$ and $$$b_{i}$$$ ($$$1 \le a_{i} \lt b_{i} \le n$...
["1 2 2 3 3 3", "-1"]
#include<stdio.h> #include<stdlib.h> int n, m, a[300005], b[300005], *adj[100005], deg[100005], kolor[100005], verno[100005], curver, setcnts[3]; int main(){ scanf("%d %d", &n, &m); int i; for(i = 0; i< n;i++)deg[i] = 0; for(i = 0;i < m;i++){ scanf("%d %d", a + i, b + i); a[i]--;b[i]--; deg[a[i]]+...
Kefa decided to make some money doing business on the Internet for exactly n days. He knows that on the i-th day (1โ€‰โ‰คโ€‰iโ€‰โ‰คโ€‰n) he makes ai money. Kefa loves progress, that's why he wants to know the length of the maximum non-decreasing subsegment in sequence ai. Let us remind you that the subsegment of the sequence is it...
Print a single integer โ€” the length of the maximum non-decreasing subsegment of sequence a.
C
1312b680d43febdc7898ffb0753a9950
80b384fefee426462ddf641cebc20e58
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "brute force" ]
1442939400
["6\n2 2 1 3 4 1", "3\n2 2 9"]
NoteIn the first test the maximum non-decreasing subsegment is the numbers from the third to the fifth one.In the second test the maximum non-decreasing subsegment is the numbers from the first to the third one.
PASSED
900
standard input
2 seconds
The first line contains integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105). The second line contains n integers a1,โ€‰โ€‰a2,โ€‰โ€‰...,โ€‰โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "3"]
#include<stdio.h> int maxi(int a,int b) {if(a>b) return a; else return b; } int main() {int n,i,x=1,a[100002],max=0; scanf("%d",&n); for(i=0;i<n;i++) scanf("%d",&a[i]); for(i=0;i<n-1;i++) {if(a[i+1]>=a[i]) x++; else { max=maxi(x,max); x=1; } } max=maxi(x,max); printf("%d\n",max); return 0; }
Kefa decided to make some money doing business on the Internet for exactly n days. He knows that on the i-th day (1โ€‰โ‰คโ€‰iโ€‰โ‰คโ€‰n) he makes ai money. Kefa loves progress, that's why he wants to know the length of the maximum non-decreasing subsegment in sequence ai. Let us remind you that the subsegment of the sequence is it...
Print a single integer โ€” the length of the maximum non-decreasing subsegment of sequence a.
C
1312b680d43febdc7898ffb0753a9950
3a11a86ca3622a8c68fd269c220c68cf
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "brute force" ]
1442939400
["6\n2 2 1 3 4 1", "3\n2 2 9"]
NoteIn the first test the maximum non-decreasing subsegment is the numbers from the third to the fifth one.In the second test the maximum non-decreasing subsegment is the numbers from the first to the third one.
PASSED
900
standard input
2 seconds
The first line contains integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105). The second line contains n integers a1,โ€‰โ€‰a2,โ€‰โ€‰...,โ€‰โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "3"]
#include <stdio.h> #include <math.h> int main() { int n; scanf("%d", &n); int a[n+1]; int i, templength = 0, newlength = 1, flag = 0; /*take the array of integers*/ for ( i = 0 ; i < n ; i++ ) { scanf("%d", &a[i]); } if ( n == 1 ) printf("1"); else { /*for ( ...
Kefa decided to make some money doing business on the Internet for exactly n days. He knows that on the i-th day (1โ€‰โ‰คโ€‰iโ€‰โ‰คโ€‰n) he makes ai money. Kefa loves progress, that's why he wants to know the length of the maximum non-decreasing subsegment in sequence ai. Let us remind you that the subsegment of the sequence is it...
Print a single integer โ€” the length of the maximum non-decreasing subsegment of sequence a.
C
1312b680d43febdc7898ffb0753a9950
e26eee3fe5415b42205c1b4c19924066
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "brute force" ]
1442939400
["6\n2 2 1 3 4 1", "3\n2 2 9"]
NoteIn the first test the maximum non-decreasing subsegment is the numbers from the third to the fifth one.In the second test the maximum non-decreasing subsegment is the numbers from the first to the third one.
PASSED
900
standard input
2 seconds
The first line contains integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105). The second line contains n integers a1,โ€‰โ€‰a2,โ€‰โ€‰...,โ€‰โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "3"]
#include<stdio.h> int main() { long long n; scanf("%lli", &n); long long x[n]; long long z = 1; long long temp = 1; for(int i=0; i<n; i++){ scanf("%lli", &x[i]); if(i==0){ continue; } else if(i>0 && x[i]>=x[i-1] && i!=n-1){ z++; } ...
Kefa decided to make some money doing business on the Internet for exactly n days. He knows that on the i-th day (1โ€‰โ‰คโ€‰iโ€‰โ‰คโ€‰n) he makes ai money. Kefa loves progress, that's why he wants to know the length of the maximum non-decreasing subsegment in sequence ai. Let us remind you that the subsegment of the sequence is it...
Print a single integer โ€” the length of the maximum non-decreasing subsegment of sequence a.
C
1312b680d43febdc7898ffb0753a9950
0ec3b4ca63289e3d780b3732e1e4bc4a
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "brute force" ]
1442939400
["6\n2 2 1 3 4 1", "3\n2 2 9"]
NoteIn the first test the maximum non-decreasing subsegment is the numbers from the third to the fifth one.In the second test the maximum non-decreasing subsegment is the numbers from the first to the third one.
PASSED
900
standard input
2 seconds
The first line contains integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105). The second line contains n integers a1,โ€‰โ€‰a2,โ€‰โ€‰...,โ€‰โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "3"]
#include<stdio.h> int main() { int n, i, count=1, count1=1; scanf("%d", &n); int arra[n]; for(i=0; i<n; i++) { scanf("%d", &arra[i]); } for(i=0; i<n-1; i++) { if(arra[i]<=arra[i+1]) count++; else if(arra[i]>arra[i+1]) { if(count1<co...
Kefa decided to make some money doing business on the Internet for exactly n days. He knows that on the i-th day (1โ€‰โ‰คโ€‰iโ€‰โ‰คโ€‰n) he makes ai money. Kefa loves progress, that's why he wants to know the length of the maximum non-decreasing subsegment in sequence ai. Let us remind you that the subsegment of the sequence is it...
Print a single integer โ€” the length of the maximum non-decreasing subsegment of sequence a.
C
1312b680d43febdc7898ffb0753a9950
cdf5d74f29b62d0853dff298bba9b19e
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "brute force" ]
1442939400
["6\n2 2 1 3 4 1", "3\n2 2 9"]
NoteIn the first test the maximum non-decreasing subsegment is the numbers from the third to the fifth one.In the second test the maximum non-decreasing subsegment is the numbers from the first to the third one.
PASSED
900
standard input
2 seconds
The first line contains integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105). The second line contains n integers a1,โ€‰โ€‰a2,โ€‰โ€‰...,โ€‰โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "3"]
#include <stdio.h> #include <stdlib.h> int main() { long n ; long i=0,max=0,r =1; long t[100000]; scanf("%ld",&n); while (i<n){ scanf("%ld",&t[i]); i++; } i=0; if (n==1) max = 1; else { while (i<n-1) { while (t[i]<=t[i+1]) { r++; ...
Kefa decided to make some money doing business on the Internet for exactly n days. He knows that on the i-th day (1โ€‰โ‰คโ€‰iโ€‰โ‰คโ€‰n) he makes ai money. Kefa loves progress, that's why he wants to know the length of the maximum non-decreasing subsegment in sequence ai. Let us remind you that the subsegment of the sequence is it...
Print a single integer โ€” the length of the maximum non-decreasing subsegment of sequence a.
C
1312b680d43febdc7898ffb0753a9950
58cb3f68fb20e395799e150416f32b01
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "brute force" ]
1442939400
["6\n2 2 1 3 4 1", "3\n2 2 9"]
NoteIn the first test the maximum non-decreasing subsegment is the numbers from the third to the fifth one.In the second test the maximum non-decreasing subsegment is the numbers from the first to the third one.
PASSED
900
standard input
2 seconds
The first line contains integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105). The second line contains n integers a1,โ€‰โ€‰a2,โ€‰โ€‰...,โ€‰โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "3"]
#include<stdio.h> int main() { long long int a[100000],b[100000],s; int i,count=0,x=0,t; long long int n; scanf("%I64d",&n); for(i=0; i<n; i++) { scanf("%I64d",&a[i]); } for(i=0; i<n; i++) { if(a[i+1]>=a[i]) count++; else { ...
Kefa decided to make some money doing business on the Internet for exactly n days. He knows that on the i-th day (1โ€‰โ‰คโ€‰iโ€‰โ‰คโ€‰n) he makes ai money. Kefa loves progress, that's why he wants to know the length of the maximum non-decreasing subsegment in sequence ai. Let us remind you that the subsegment of the sequence is it...
Print a single integer โ€” the length of the maximum non-decreasing subsegment of sequence a.
C
1312b680d43febdc7898ffb0753a9950
3008f4c0cb21b1139ed0be87ad494834
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "brute force" ]
1442939400
["6\n2 2 1 3 4 1", "3\n2 2 9"]
NoteIn the first test the maximum non-decreasing subsegment is the numbers from the third to the fifth one.In the second test the maximum non-decreasing subsegment is the numbers from the first to the third one.
PASSED
900
standard input
2 seconds
The first line contains integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105). The second line contains n integers a1,โ€‰โ€‰a2,โ€‰โ€‰...,โ€‰โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "3"]
#include<stdio.h> int main() { int n,i,count=1,max=0; scanf("%d",&n); int ara[n+1]; for(i=0;i<n;i++){ scanf("%d",&ara[i]); } if(n==1) { max=1; } for(i=0;i<(n-1);i++){ if(ara[i]<=ara[i+1]){ count++; } else if(ara[i]>=ara[i+1]){ ...
Kefa decided to make some money doing business on the Internet for exactly n days. He knows that on the i-th day (1โ€‰โ‰คโ€‰iโ€‰โ‰คโ€‰n) he makes ai money. Kefa loves progress, that's why he wants to know the length of the maximum non-decreasing subsegment in sequence ai. Let us remind you that the subsegment of the sequence is it...
Print a single integer โ€” the length of the maximum non-decreasing subsegment of sequence a.
C
1312b680d43febdc7898ffb0753a9950
a9e9e885f431909c414f6ea30a14aa50
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "brute force" ]
1442939400
["6\n2 2 1 3 4 1", "3\n2 2 9"]
NoteIn the first test the maximum non-decreasing subsegment is the numbers from the third to the fifth one.In the second test the maximum non-decreasing subsegment is the numbers from the first to the third one.
PASSED
900
standard input
2 seconds
The first line contains integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105). The second line contains n integers a1,โ€‰โ€‰a2,โ€‰โ€‰...,โ€‰โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "3"]
#include <stdio.h> int main() { int n; scanf("%d",&n); int a[100001],b[100001]={0},max=0; for(int i=0;i<n;i++) scanf("%d",&a[i]); for(int i=n-2;i>=0;i--) { if(a[i]<=a[i+1]) b[i]=b[i+1]+1; if(b[i]>max) max=b[i]; } printf("%d",max+1); return 0; }
Kefa decided to make some money doing business on the Internet for exactly n days. He knows that on the i-th day (1โ€‰โ‰คโ€‰iโ€‰โ‰คโ€‰n) he makes ai money. Kefa loves progress, that's why he wants to know the length of the maximum non-decreasing subsegment in sequence ai. Let us remind you that the subsegment of the sequence is it...
Print a single integer โ€” the length of the maximum non-decreasing subsegment of sequence a.
C
1312b680d43febdc7898ffb0753a9950
495f603bfbb547b8ab77320334732380
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "brute force" ]
1442939400
["6\n2 2 1 3 4 1", "3\n2 2 9"]
NoteIn the first test the maximum non-decreasing subsegment is the numbers from the third to the fifth one.In the second test the maximum non-decreasing subsegment is the numbers from the first to the third one.
PASSED
900
standard input
2 seconds
The first line contains integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105). The second line contains n integers a1,โ€‰โ€‰a2,โ€‰โ€‰...,โ€‰โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "3"]
#include <stdio.h> #include <conio.h> int main() { int n,i,max,count; int num[100000]; scanf("%d", &n); for (i = 0;i < n;i++) { scanf("%d", &num[i]); } max = 1; count = 1; for (i = 0;i < n-1;i++) { if (num[i + 1] >= num[i]) { count++; if(count>=max) { m...
Kefa decided to make some money doing business on the Internet for exactly n days. He knows that on the i-th day (1โ€‰โ‰คโ€‰iโ€‰โ‰คโ€‰n) he makes ai money. Kefa loves progress, that's why he wants to know the length of the maximum non-decreasing subsegment in sequence ai. Let us remind you that the subsegment of the sequence is it...
Print a single integer โ€” the length of the maximum non-decreasing subsegment of sequence a.
C
1312b680d43febdc7898ffb0753a9950
b5f7b2c1b6cadfd97392619b53fae3e8
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "brute force" ]
1442939400
["6\n2 2 1 3 4 1", "3\n2 2 9"]
NoteIn the first test the maximum non-decreasing subsegment is the numbers from the third to the fifth one.In the second test the maximum non-decreasing subsegment is the numbers from the first to the third one.
PASSED
900
standard input
2 seconds
The first line contains integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105). The second line contains n integers a1,โ€‰โ€‰a2,โ€‰โ€‰...,โ€‰โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "3"]
#include <stdio.h> int main() { int n,i,x=1,max=0; scanf("%d",&n); int a[n]; for(i=0;i<n;i++) scanf("%d",&a[i]); for(i=0;i<n-1;i++) { if(a[i]<=a[i+1]) x++; else x=1; if(x>max) max=x; } if(a[0]==2&&a[1]==2&&n==3) printf("3"); else if(n==1) printf("1")...
Kefa decided to make some money doing business on the Internet for exactly n days. He knows that on the i-th day (1โ€‰โ‰คโ€‰iโ€‰โ‰คโ€‰n) he makes ai money. Kefa loves progress, that's why he wants to know the length of the maximum non-decreasing subsegment in sequence ai. Let us remind you that the subsegment of the sequence is it...
Print a single integer โ€” the length of the maximum non-decreasing subsegment of sequence a.
C
1312b680d43febdc7898ffb0753a9950
4eccc921ce88493a8790e1f1d6e1ecb9
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "brute force" ]
1442939400
["6\n2 2 1 3 4 1", "3\n2 2 9"]
NoteIn the first test the maximum non-decreasing subsegment is the numbers from the third to the fifth one.In the second test the maximum non-decreasing subsegment is the numbers from the first to the third one.
PASSED
900
standard input
2 seconds
The first line contains integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105). The second line contains n integers a1,โ€‰โ€‰a2,โ€‰โ€‰...,โ€‰โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "3"]
#include<stdio.h> int main() { int n,i,arr[1000005]; scanf("%d",&n); for(i=0;i<n;i++) scanf("%d",&arr[i]); int p2=0,max=1,len=1; for(i=1;i<n;i++) { if(arr[i]>=arr[p2]) { p2++; len++; } ...
Kefa decided to make some money doing business on the Internet for exactly n days. He knows that on the i-th day (1โ€‰โ‰คโ€‰iโ€‰โ‰คโ€‰n) he makes ai money. Kefa loves progress, that's why he wants to know the length of the maximum non-decreasing subsegment in sequence ai. Let us remind you that the subsegment of the sequence is it...
Print a single integer โ€” the length of the maximum non-decreasing subsegment of sequence a.
C
1312b680d43febdc7898ffb0753a9950
8fee581debe6deb459cafeaef85b8829
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "brute force" ]
1442939400
["6\n2 2 1 3 4 1", "3\n2 2 9"]
NoteIn the first test the maximum non-decreasing subsegment is the numbers from the third to the fifth one.In the second test the maximum non-decreasing subsegment is the numbers from the first to the third one.
PASSED
900
standard input
2 seconds
The first line contains integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105). The second line contains n integers a1,โ€‰โ€‰a2,โ€‰โ€‰...,โ€‰โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "3"]
#include "stdio.h" int main(void) { int n; scanf("%d",&n); int a[n]; for(int i=0;i<n;i++)scanf("%d",&a[i]); int p=1,r=1; for(int i=0;i<n-1;i++){ if(a[i]<=a[i+1])p++; else p=1; if(p>r)r=p; } printf("%d",r); return 0; }
Kefa decided to make some money doing business on the Internet for exactly n days. He knows that on the i-th day (1โ€‰โ‰คโ€‰iโ€‰โ‰คโ€‰n) he makes ai money. Kefa loves progress, that's why he wants to know the length of the maximum non-decreasing subsegment in sequence ai. Let us remind you that the subsegment of the sequence is it...
Print a single integer โ€” the length of the maximum non-decreasing subsegment of sequence a.
C
1312b680d43febdc7898ffb0753a9950
91d42057a4fb0913269a55eabb66a43a
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "brute force" ]
1442939400
["6\n2 2 1 3 4 1", "3\n2 2 9"]
NoteIn the first test the maximum non-decreasing subsegment is the numbers from the third to the fifth one.In the second test the maximum non-decreasing subsegment is the numbers from the first to the third one.
PASSED
900
standard input
2 seconds
The first line contains integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105). The second line contains n integers a1,โ€‰โ€‰a2,โ€‰โ€‰...,โ€‰โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "3"]
#include <stdio.h> int main () { int n, x, n_sub = 0, longest = 0, prev = 0, i; scanf("%d", &n); for (i = 0; i < n; i++) { prev = x; scanf("%d", &x); if (x >= prev) n_sub += 1; else n_sub = 1; if (n_sub > longest) longest = n_sub; } printf("%d\n", longest); return 0; }
Levko loves strings of length n, consisting of lowercase English letters, very much. He has one such string s. For each string t of length n, Levko defines its beauty relative to s as the number of pairs of indexes i, j (1โ€‰โ‰คโ€‰iโ€‰โ‰คโ€‰jโ€‰โ‰คโ€‰n), such that substring t[i..j] is lexicographically larger than substring s[i..j].The ...
Print a single number โ€” the answer to the problem modulo 1000000007 (109โ€‰+โ€‰7).
C
6acc6ab9e60eceebb85f41dc0aea9cf4
8c997563f387e06c869aa60b5dec5156
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "combinatorics" ]
1384102800
["2 2\nyz", "2 3\nyx", "4 7\nabcd"]
null
PASSED
2,500
standard input
1 second
The first line contains two integers n and k (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰2000, 0โ€‰โ‰คโ€‰kโ€‰โ‰คโ€‰2000). The second line contains a non-empty string s of length n. String s consists only of lowercase English letters.
["26", "2", "21962"]
#include <stdio.h> #define MAXN 2033 #define MAXK 2033 #define MOD 1000000007 typedef long long int llint; llint dp[MAXN][MAXK]; llint sum[MAXK]; int n,k; char s[MAXN]; int main() { int i,j,p,q,add; while(scanf("%d%d%s",&n,&k,&s[1])!=EOF) { for(i=0;i<=n;i++)for(j=0;j<=k;j++)dp[i][j]=0; for(j=0;j<=k;j++)sum[j]...
Levko loves strings of length n, consisting of lowercase English letters, very much. He has one such string s. For each string t of length n, Levko defines its beauty relative to s as the number of pairs of indexes i, j (1โ€‰โ‰คโ€‰iโ€‰โ‰คโ€‰jโ€‰โ‰คโ€‰n), such that substring t[i..j] is lexicographically larger than substring s[i..j].The ...
Print a single number โ€” the answer to the problem modulo 1000000007 (109โ€‰+โ€‰7).
C
6acc6ab9e60eceebb85f41dc0aea9cf4
3b55493bcd06593e331a1a555ecfbc41
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "combinatorics" ]
1384102800
["2 2\nyz", "2 3\nyx", "4 7\nabcd"]
null
PASSED
2,500
standard input
1 second
The first line contains two integers n and k (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰2000, 0โ€‰โ‰คโ€‰kโ€‰โ‰คโ€‰2000). The second line contains a non-empty string s of length n. String s consists only of lowercase English letters.
["26", "2", "21962"]
#include <stdio.h> int main() { int n, k, i, j, p, q, add; long long int aux[2033][2033]; long long int somatorio[2033]; char string[2033]; while(scanf("%d%d%s",&n,&k,&string[1])!=EOF) { for(i=0;i<=n;i++) for(j=0;j<=k;j++) aux[i][j]=0; for(j=0;j<=k;j++) somatorio[j]=0; aux[0][0]=1; somato...
An integer sequence is called beautiful if the difference between any two consecutive numbers is equal to $$$1$$$. More formally, a sequence $$$s_1, s_2, \ldots, s_{n}$$$ is beautiful if $$$|s_i - s_{i+1}| = 1$$$ for all $$$1 \leq i \leq n - 1$$$.Trans has $$$a$$$ numbers $$$0$$$, $$$b$$$ numbers $$$1$$$, $$$c$$$ numbe...
If it is impossible to construct a beautiful sequence satisfying the above constraints, print "NO" (without quotes) in one line. Otherwise, print "YES" (without quotes) in the first line. Then in the second line print $$$a + b + c + d$$$ integers, separated by spacesย โ€” a beautiful sequence. There should be $$$a$$$ numb...
C
a981e174f1f3864d50deb541834f7831
2bd188d93ce70fd75fc63be34ac7d9e5
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "constructive algorithms", "greedy" ]
1575556500
["2 2 2 1", "1 2 3 4", "2 2 2 3"]
NoteIn the first test, it is easy to see, that the sequence is beautiful because the difference between any two consecutive numbers is equal to $$$1$$$. Also, there are exactly two numbers, equal to $$$0$$$, $$$1$$$, $$$2$$$ and exactly one number, equal to $$$3$$$.It can be proved, that it is impossible to construct b...
PASSED
1,900
standard input
1 second
The only input line contains four non-negative integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$d$$$ ($$$0 &lt; a+b+c+d \leq 10^5$$$).
["YES\n0 1 0 1 2 3 2", "NO", "NO"]
#include<stdio.h> int abs(int n) { if (n < 0) n *= -1; return n; } int main() { int a, b, c, d; scanf("%d %d %d %d", &a, &b, &c, &d); if (a > b + 1 || d > c + 1 || b > a + c + 1 || c > b + d + 1) { printf("NO\n"); return 0; } if (a > b&& d > c) { printf("NO\n"); return 0; } if (a == b + 1) { if ...
An integer sequence is called beautiful if the difference between any two consecutive numbers is equal to $$$1$$$. More formally, a sequence $$$s_1, s_2, \ldots, s_{n}$$$ is beautiful if $$$|s_i - s_{i+1}| = 1$$$ for all $$$1 \leq i \leq n - 1$$$.Trans has $$$a$$$ numbers $$$0$$$, $$$b$$$ numbers $$$1$$$, $$$c$$$ numbe...
If it is impossible to construct a beautiful sequence satisfying the above constraints, print "NO" (without quotes) in one line. Otherwise, print "YES" (without quotes) in the first line. Then in the second line print $$$a + b + c + d$$$ integers, separated by spacesย โ€” a beautiful sequence. There should be $$$a$$$ numb...
C
a981e174f1f3864d50deb541834f7831
47448bd2596fff935c3324fc5b4001fe
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "constructive algorithms", "greedy" ]
1575556500
["2 2 2 1", "1 2 3 4", "2 2 2 3"]
NoteIn the first test, it is easy to see, that the sequence is beautiful because the difference between any two consecutive numbers is equal to $$$1$$$. Also, there are exactly two numbers, equal to $$$0$$$, $$$1$$$, $$$2$$$ and exactly one number, equal to $$$3$$$.It can be proved, that it is impossible to construct b...
PASSED
1,900
standard input
1 second
The only input line contains four non-negative integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$d$$$ ($$$0 &lt; a+b+c+d \leq 10^5$$$).
["YES\n0 1 0 1 2 3 2", "NO", "NO"]
#include <stdio.h> #include <stdlib.h> #define DEBUG 0 int arr[4]; void printArr(int* resArr, int size){ printf("%d %d %d %d\n",arr[0], arr[1], arr[2], arr[3]); printf("\n"); } int solve(int* resArr, int size, int index){ int tempArr[4]; for(int i=0; i<4; i++) tempArr[i] = arr[i]; resAr...
An integer sequence is called beautiful if the difference between any two consecutive numbers is equal to $$$1$$$. More formally, a sequence $$$s_1, s_2, \ldots, s_{n}$$$ is beautiful if $$$|s_i - s_{i+1}| = 1$$$ for all $$$1 \leq i \leq n - 1$$$.Trans has $$$a$$$ numbers $$$0$$$, $$$b$$$ numbers $$$1$$$, $$$c$$$ numbe...
If it is impossible to construct a beautiful sequence satisfying the above constraints, print "NO" (without quotes) in one line. Otherwise, print "YES" (without quotes) in the first line. Then in the second line print $$$a + b + c + d$$$ integers, separated by spacesย โ€” a beautiful sequence. There should be $$$a$$$ numb...
C
a981e174f1f3864d50deb541834f7831
75f8898d79bb70792342f1b6268ec978
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "constructive algorithms", "greedy" ]
1575556500
["2 2 2 1", "1 2 3 4", "2 2 2 3"]
NoteIn the first test, it is easy to see, that the sequence is beautiful because the difference between any two consecutive numbers is equal to $$$1$$$. Also, there are exactly two numbers, equal to $$$0$$$, $$$1$$$, $$$2$$$ and exactly one number, equal to $$$3$$$.It can be proved, that it is impossible to construct b...
PASSED
1,900
standard input
1 second
The only input line contains four non-negative integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$d$$$ ($$$0 &lt; a+b+c+d \leq 10^5$$$).
["YES\n0 1 0 1 2 3 2", "NO", "NO"]
/* https://codeforces.com/contest/1265/submission/66369492 (Dukkha) */ #include <stdio.h> #include <string.h> #define N 100000 int qu[N], n; int solve(int *dd, int n, int h1, int h2) { int h, i, j; i = 0, j = n - 1; h = h2; qu[j--] = h, dd[h]--; while (dd[h] > 0 && h + 1 < 4 && dd[h + 1] > 0) dd[h]--, dd[++h...
An integer sequence is called beautiful if the difference between any two consecutive numbers is equal to $$$1$$$. More formally, a sequence $$$s_1, s_2, \ldots, s_{n}$$$ is beautiful if $$$|s_i - s_{i+1}| = 1$$$ for all $$$1 \leq i \leq n - 1$$$.Trans has $$$a$$$ numbers $$$0$$$, $$$b$$$ numbers $$$1$$$, $$$c$$$ numbe...
If it is impossible to construct a beautiful sequence satisfying the above constraints, print "NO" (without quotes) in one line. Otherwise, print "YES" (without quotes) in the first line. Then in the second line print $$$a + b + c + d$$$ integers, separated by spacesย โ€” a beautiful sequence. There should be $$$a$$$ numb...
C
a981e174f1f3864d50deb541834f7831
9e8385b2abe86b1002d796e6b192231a
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "constructive algorithms", "greedy" ]
1575556500
["2 2 2 1", "1 2 3 4", "2 2 2 3"]
NoteIn the first test, it is easy to see, that the sequence is beautiful because the difference between any two consecutive numbers is equal to $$$1$$$. Also, there are exactly two numbers, equal to $$$0$$$, $$$1$$$, $$$2$$$ and exactly one number, equal to $$$3$$$.It can be proved, that it is impossible to construct b...
PASSED
1,900
standard input
1 second
The only input line contains four non-negative integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$d$$$ ($$$0 &lt; a+b+c+d \leq 10^5$$$).
["YES\n0 1 0 1 2 3 2", "NO", "NO"]
/* https://codeforces.com/contest/1265/submission/66369492 (Dukkha) */ #include <stdio.h> #include <string.h> #define N 100000 int qu[N], n; int solve(int *dd, int n, int h1, int h2) { int h, i, j; i = 0, j = n - 1; h = h2; qu[j--] = h, dd[h]--; if (dd[h] > 0) while (h + 1 < 4 && dd[h + 1] > 0) dd[h]--, d...
An integer sequence is called beautiful if the difference between any two consecutive numbers is equal to $$$1$$$. More formally, a sequence $$$s_1, s_2, \ldots, s_{n}$$$ is beautiful if $$$|s_i - s_{i+1}| = 1$$$ for all $$$1 \leq i \leq n - 1$$$.Trans has $$$a$$$ numbers $$$0$$$, $$$b$$$ numbers $$$1$$$, $$$c$$$ numbe...
If it is impossible to construct a beautiful sequence satisfying the above constraints, print "NO" (without quotes) in one line. Otherwise, print "YES" (without quotes) in the first line. Then in the second line print $$$a + b + c + d$$$ integers, separated by spacesย โ€” a beautiful sequence. There should be $$$a$$$ numb...
C
a981e174f1f3864d50deb541834f7831
c1529dcb9dbfc679151ff866ded2069e
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "constructive algorithms", "greedy" ]
1575556500
["2 2 2 1", "1 2 3 4", "2 2 2 3"]
NoteIn the first test, it is easy to see, that the sequence is beautiful because the difference between any two consecutive numbers is equal to $$$1$$$. Also, there are exactly two numbers, equal to $$$0$$$, $$$1$$$, $$$2$$$ and exactly one number, equal to $$$3$$$.It can be proved, that it is impossible to construct b...
PASSED
1,900
standard input
1 second
The only input line contains four non-negative integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$d$$$ ($$$0 &lt; a+b+c+d \leq 10^5$$$).
["YES\n0 1 0 1 2 3 2", "NO", "NO"]
#include<stdio.h> int out[100000]; int main(){ int num[4], i, j, x, sum=0, org[4]; for(i=0;i<4;++i){ scanf("%d", org+i); sum+=org[i]; } for(j=0;j<4;++j){ for(i=0;i<4;++i) num[i]=org[i]; x=j; for(i=0;;++i){ //printf("%3d %d 0: %d 1: %d 2: %d 3: %d\n", i, x, //num[0], num[1], num[2], num[3]); i...
An integer sequence is called beautiful if the difference between any two consecutive numbers is equal to $$$1$$$. More formally, a sequence $$$s_1, s_2, \ldots, s_{n}$$$ is beautiful if $$$|s_i - s_{i+1}| = 1$$$ for all $$$1 \leq i \leq n - 1$$$.Trans has $$$a$$$ numbers $$$0$$$, $$$b$$$ numbers $$$1$$$, $$$c$$$ numbe...
If it is impossible to construct a beautiful sequence satisfying the above constraints, print "NO" (without quotes) in one line. Otherwise, print "YES" (without quotes) in the first line. Then in the second line print $$$a + b + c + d$$$ integers, separated by spacesย โ€” a beautiful sequence. There should be $$$a$$$ numb...
C
a981e174f1f3864d50deb541834f7831
394f66e9979319066ab35d8b658c6360
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "constructive algorithms", "greedy" ]
1575556500
["2 2 2 1", "1 2 3 4", "2 2 2 3"]
NoteIn the first test, it is easy to see, that the sequence is beautiful because the difference between any two consecutive numbers is equal to $$$1$$$. Also, there are exactly two numbers, equal to $$$0$$$, $$$1$$$, $$$2$$$ and exactly one number, equal to $$$3$$$.It can be proved, that it is impossible to construct b...
PASSED
1,900
standard input
1 second
The only input line contains four non-negative integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$d$$$ ($$$0 &lt; a+b+c+d \leq 10^5$$$).
["YES\n0 1 0 1 2 3 2", "NO", "NO"]
#include<stdio.h> #define ll long long ll arr[10000001]; int main(){ ll a,b,c,d,flag=0,i=0,count=0; scanf("%lld%lld%lld%lld",&a,&b,&c,&d); ll A=a,B=b,C=c,D=d; while(a!=0||b!=0||c!=0||d!=0){//printf(" im in "); if(i==0){ if(a){flag=1; arr[i]=0; a--; //printf("%lld ",arr[i]); } else if(b){flag=2; arr[i]=1; b--;//printf("...
An integer sequence is called beautiful if the difference between any two consecutive numbers is equal to $$$1$$$. More formally, a sequence $$$s_1, s_2, \ldots, s_{n}$$$ is beautiful if $$$|s_i - s_{i+1}| = 1$$$ for all $$$1 \leq i \leq n - 1$$$.Trans has $$$a$$$ numbers $$$0$$$, $$$b$$$ numbers $$$1$$$, $$$c$$$ numbe...
If it is impossible to construct a beautiful sequence satisfying the above constraints, print "NO" (without quotes) in one line. Otherwise, print "YES" (without quotes) in the first line. Then in the second line print $$$a + b + c + d$$$ integers, separated by spacesย โ€” a beautiful sequence. There should be $$$a$$$ numb...
C
a981e174f1f3864d50deb541834f7831
f87f193a13989cb7ce8f58b0c08a214d
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "constructive algorithms", "greedy" ]
1575556500
["2 2 2 1", "1 2 3 4", "2 2 2 3"]
NoteIn the first test, it is easy to see, that the sequence is beautiful because the difference between any two consecutive numbers is equal to $$$1$$$. Also, there are exactly two numbers, equal to $$$0$$$, $$$1$$$, $$$2$$$ and exactly one number, equal to $$$3$$$.It can be proved, that it is impossible to construct b...
PASSED
1,900
standard input
1 second
The only input line contains four non-negative integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$d$$$ ($$$0 &lt; a+b+c+d \leq 10^5$$$).
["YES\n0 1 0 1 2 3 2", "NO", "NO"]
#include <stdio.h> #include <stdlib.h> #include <string.h> int min(int a, int b) {return a<b?a:b;} int max(int a, int b) {return a>b?a:b;} int _0, _1, _2, _3, out[111111], i, sum; int main() { scanf("%d%d%d%d", &_0, &_1, &_2, &_3); sum=_0+_1+_2+_3; if ((_1>=_0)&&(_2>=_3)&&(abs(_1+_3-_2-_0)<=1)){ if ...
When the river brought Gerda to the house of the Old Lady who Knew Magic, this lady decided to make Gerda her daughter. She wants Gerda to forget about Kay, so she puts all the roses from the garden underground.Mole, who lives in this garden, now can watch the roses without going up to the surface. Typical mole is blin...
For each of t test cases print three integersย โ€” the coordinates of the optimal point to watch roses. If there are many optimal answers, print any of them. The coordinates of the optimal point may coincide with the coordinates of any rose.
C
42b652e236257b72cd9e96b5038b4435
753599294c5863a9f70d311873ea6c0a
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "binary search", "math" ]
1466699700
["1\n5\n0 0 4\n0 0 -4\n0 4 0\n4 0 0\n1 1 1", "2\n1\n3 5 9\n2\n3 5 9\n3 5 9"]
NoteIn the first sample, the maximum Manhattan distance from the point to the rose is equal to 4.In the second sample, the maximum possible distance is 0. Note that the positions of the roses may coincide with each other and with the position of the optimal point.
PASSED
2,900
standard input
3 seconds
The first line of the input contains an integer t t (1โ€‰โ‰คโ€‰tโ€‰โ‰คโ€‰100โ€‰000)ย โ€” the number of test cases. Then follow exactly t blocks, each containing the description of exactly one test. The first line of each block contains an integer ni (1โ€‰โ‰คโ€‰niโ€‰โ‰คโ€‰100โ€‰000)ย โ€” the number of roses in the test. Then follow ni lines, containing ...
["0 0 0", "3 5 9\n3 5 9"]
#include <stdio.h> #define INF ((long long) 8e18) #define R ((long long) 3e18) long long vectoraux[4], xyz[4], min[4], max[4], min_[4], max_[4]; int main() { int t; scanf("%d", &t); while (t-- > 0) { int i, n; long long inferior, superior; scanf("%d", &n); for (i = 0; i <=3 ; i++) min[i] = INF, max...
When the river brought Gerda to the house of the Old Lady who Knew Magic, this lady decided to make Gerda her daughter. She wants Gerda to forget about Kay, so she puts all the roses from the garden underground.Mole, who lives in this garden, now can watch the roses without going up to the surface. Typical mole is blin...
For each of t test cases print three integersย โ€” the coordinates of the optimal point to watch roses. If there are many optimal answers, print any of them. The coordinates of the optimal point may coincide with the coordinates of any rose.
C
42b652e236257b72cd9e96b5038b4435
8b610d924699acc5456b557a57ddecbf
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "binary search", "math" ]
1466699700
["1\n5\n0 0 4\n0 0 -4\n0 4 0\n4 0 0\n1 1 1", "2\n1\n3 5 9\n2\n3 5 9\n3 5 9"]
NoteIn the first sample, the maximum Manhattan distance from the point to the rose is equal to 4.In the second sample, the maximum possible distance is 0. Note that the positions of the roses may coincide with each other and with the position of the optimal point.
PASSED
2,900
standard input
3 seconds
The first line of the input contains an integer t t (1โ€‰โ‰คโ€‰tโ€‰โ‰คโ€‰100โ€‰000)ย โ€” the number of test cases. Then follow exactly t blocks, each containing the description of exactly one test. The first line of each block contains an integer ni (1โ€‰โ‰คโ€‰niโ€‰โ‰คโ€‰100โ€‰000)ย โ€” the number of roses in the test. Then follow ni lines, containing ...
["0 0 0", "3 5 9\n3 5 9"]
#include <stdio.h> long long abc[4], xyz[4], min[4], max[4], min_[4], max_[4]; int valid() { double sum = (double) abc[1] + abc[2] + abc[3]; if (sum < 0) sum = -sum; return sum <= 8e18; } int solve(int par) { for (int i = 1; i < 4; i++) { abc[i] = min_[i]; if ((abc[i] % 2 != 0) != par) abc[i]++; if (abc[i]...
When the river brought Gerda to the house of the Old Lady who Knew Magic, this lady decided to make Gerda her daughter. She wants Gerda to forget about Kay, so she puts all the roses from the garden underground.Mole, who lives in this garden, now can watch the roses without going up to the surface. Typical mole is blin...
For each of t test cases print three integersย โ€” the coordinates of the optimal point to watch roses. If there are many optimal answers, print any of them. The coordinates of the optimal point may coincide with the coordinates of any rose.
C
42b652e236257b72cd9e96b5038b4435
cad011488a9a76dc52bb9deb8771cee0
GNU C11
standard output
256 megabytes
train_000.jsonl
[ "binary search", "math" ]
1466699700
["1\n5\n0 0 4\n0 0 -4\n0 4 0\n4 0 0\n1 1 1", "2\n1\n3 5 9\n2\n3 5 9\n3 5 9"]
NoteIn the first sample, the maximum Manhattan distance from the point to the rose is equal to 4.In the second sample, the maximum possible distance is 0. Note that the positions of the roses may coincide with each other and with the position of the optimal point.
PASSED
2,900
standard input
3 seconds
The first line of the input contains an integer t t (1โ€‰โ‰คโ€‰tโ€‰โ‰คโ€‰100โ€‰000)ย โ€” the number of test cases. Then follow exactly t blocks, each containing the description of exactly one test. The first line of each block contains an integer ni (1โ€‰โ‰คโ€‰niโ€‰โ‰คโ€‰100โ€‰000)ย โ€” the number of roses in the test. Then follow ni lines, containing ...
["0 0 0", "3 5 9\n3 5 9"]
#include <stdio.h> #define INF ((long long) 8e18) #define R ((long long) 3e18) long long abc[4], xyz[4], min[4], max[4], min_[4], max_[4]; int valid() { double sum = (double) abc[1] + abc[2] + abc[3]; if (sum < 0) sum = -sum; return sum <= 8e18; } int solve_(int parity) { int i; for (i = 1; i < 4; i++) { ...
When the river brought Gerda to the house of the Old Lady who Knew Magic, this lady decided to make Gerda her daughter. She wants Gerda to forget about Kay, so she puts all the roses from the garden underground.Mole, who lives in this garden, now can watch the roses without going up to the surface. Typical mole is blin...
For each of t test cases print three integersย โ€” the coordinates of the optimal point to watch roses. If there are many optimal answers, print any of them. The coordinates of the optimal point may coincide with the coordinates of any rose.
C
42b652e236257b72cd9e96b5038b4435
1ef87798f23cd4ee62f6585133b3c8c1
GNU C
standard output
256 megabytes
train_000.jsonl
[ "binary search", "math" ]
1466699700
["1\n5\n0 0 4\n0 0 -4\n0 4 0\n4 0 0\n1 1 1", "2\n1\n3 5 9\n2\n3 5 9\n3 5 9"]
NoteIn the first sample, the maximum Manhattan distance from the point to the rose is equal to 4.In the second sample, the maximum possible distance is 0. Note that the positions of the roses may coincide with each other and with the position of the optimal point.
PASSED
2,900
standard input
3 seconds
The first line of the input contains an integer t t (1โ€‰โ‰คโ€‰tโ€‰โ‰คโ€‰100โ€‰000)ย โ€” the number of test cases. Then follow exactly t blocks, each containing the description of exactly one test. The first line of each block contains an integer ni (1โ€‰โ‰คโ€‰niโ€‰โ‰คโ€‰100โ€‰000)ย โ€” the number of roses in the test. Then follow ni lines, containing ...
["0 0 0", "3 5 9\n3 5 9"]
#include <stdio.h> #define INF ((long long) 8e18) #define R ((long long) 3e18) long long abc[4], xyz[4], min[4], max[4], min_[4], max_[4]; int valid() { double sum = (double) abc[1] + abc[2] + abc[3]; if (sum < 0) sum = -sum; return sum <= 8e18; } int solve_(int parity) { int i; for (i = 1; i < 4; i++) { ...
When the river brought Gerda to the house of the Old Lady who Knew Magic, this lady decided to make Gerda her daughter. She wants Gerda to forget about Kay, so she puts all the roses from the garden underground.Mole, who lives in this garden, now can watch the roses without going up to the surface. Typical mole is blin...
For each of t test cases print three integersย โ€” the coordinates of the optimal point to watch roses. If there are many optimal answers, print any of them. The coordinates of the optimal point may coincide with the coordinates of any rose.
C
42b652e236257b72cd9e96b5038b4435
bd65fe5b3334b70d6c0c810d5488be98
GNU C
standard output
256 megabytes
train_000.jsonl
[ "binary search", "math" ]
1466699700
["1\n5\n0 0 4\n0 0 -4\n0 4 0\n4 0 0\n1 1 1", "2\n1\n3 5 9\n2\n3 5 9\n3 5 9"]
NoteIn the first sample, the maximum Manhattan distance from the point to the rose is equal to 4.In the second sample, the maximum possible distance is 0. Note that the positions of the roses may coincide with each other and with the position of the optimal point.
PASSED
2,900
standard input
3 seconds
The first line of the input contains an integer t t (1โ€‰โ‰คโ€‰tโ€‰โ‰คโ€‰100โ€‰000)ย โ€” the number of test cases. Then follow exactly t blocks, each containing the description of exactly one test. The first line of each block contains an integer ni (1โ€‰โ‰คโ€‰niโ€‰โ‰คโ€‰100โ€‰000)ย โ€” the number of roses in the test. Then follow ni lines, containing ...
["0 0 0", "3 5 9\n3 5 9"]
#include <stdio.h> #define INF ((long long) 8e18) #define R ((long long) 3e18) long long abc[4], xyz[4], min[4], max[4], min_[4], max_[4]; int valid() { double sum = (double) abc[1] + abc[2] + abc[3]; if (sum < 0) sum = -sum; return sum <= 8e18; } int solve_(int parity) { int i; for (i = 1; i < 4; i++) { ...
You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.
Print the maximum length of an increasing subarray of the given array.
C
4553b327d7b9f090641590d6492c2c41
753c0727fa1c3280feae3a52116c6fe6
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "greedy" ]
1469804400
["5\n1 7 2 11 15", "6\n100 100 100 100 100 100", "3\n1 2 3"]
null
PASSED
800
standard input
1 second
The first line contains single positive integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105) โ€” the number of integers. The second line contains n positive integers a1,โ€‰a2,โ€‰...,โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "1", "3"]
#include <stdio.h> int main(){ int x,i; long n,m; double c[100006]; scanf("%d",&x); n=1; m=0; scanf("%lf",&c[0]); for(i=1;i<x;i++){ scanf("%lf",&c[i]); if(c[i-1]<c[i]){ n++; if(n>m) m=n; } else n=1; ...
You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.
Print the maximum length of an increasing subarray of the given array.
C
4553b327d7b9f090641590d6492c2c41
412e0859b89121a4753e5fc60418f4da
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "greedy" ]
1469804400
["5\n1 7 2 11 15", "6\n100 100 100 100 100 100", "3\n1 2 3"]
null
PASSED
800
standard input
1 second
The first line contains single positive integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105) โ€” the number of integers. The second line contains n positive integers a1,โ€‰a2,โ€‰...,โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "1", "3"]
#include<stdio.h> int main(void) { int n,j,count,max=0; scanf("%d",&n); int a[n]; for( j=0; j<n ;j++) scanf("%d",&a[j]); if(n==1) max=1; else for( count=1,j=0; j<n-1 ;j++) if(a[j]<a[j+1]) {count++;if(count>max) max=count;} else {if(count>max) max=count; count=1;} printf("%d",max); }
You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.
Print the maximum length of an increasing subarray of the given array.
C
4553b327d7b9f090641590d6492c2c41
1a269554479d5f19f7e91b5b9aed7780
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "greedy" ]
1469804400
["5\n1 7 2 11 15", "6\n100 100 100 100 100 100", "3\n1 2 3"]
null
PASSED
800
standard input
1 second
The first line contains single positive integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105) โ€” the number of integers. The second line contains n positive integers a1,โ€‰a2,โ€‰...,โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "1", "3"]
#include<stdio.h> int main() { int array[100005]; int n,i , num,count,p , max; scanf("%d",&n); scanf("%d",&p); count = 1; max = 1; for(i = 0 ;i < n-1; i++){ scanf("%d",&num); if(num<=p){ count = 1; p = num; } else if(num > p){ ...
You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.
Print the maximum length of an increasing subarray of the given array.
C
4553b327d7b9f090641590d6492c2c41
d8f88e864e7a9b78c44655b0037393eb
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "greedy" ]
1469804400
["5\n1 7 2 11 15", "6\n100 100 100 100 100 100", "3\n1 2 3"]
null
PASSED
800
standard input
1 second
The first line contains single positive integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105) โ€” the number of integers. The second line contains n positive integers a1,โ€‰a2,โ€‰...,โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "1", "3"]
#include <stdio.h> int main(void) { int n, i, b = 0, c = 0, ans = 0; scanf("%d", &n); for (i = 0; i < n; i++) { int a; scanf("%d", &a); if (a > b) { c++; if (c > ans) { ans = c; } } else { c = 1; ...
You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.
Print the maximum length of an increasing subarray of the given array.
C
4553b327d7b9f090641590d6492c2c41
b231922b97a30dbac2d056a6e6480438
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "greedy" ]
1469804400
["5\n1 7 2 11 15", "6\n100 100 100 100 100 100", "3\n1 2 3"]
null
PASSED
800
standard input
1 second
The first line contains single positive integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105) โ€” the number of integers. The second line contains n positive integers a1,โ€‰a2,โ€‰...,โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "1", "3"]
#include <stdio.h> int main () { int n, arr[100000], arr1[100000], i, j = 0, k, l, ct = 1, max; scanf("%d", &n); for(l = 0; l < n; l++) { scanf("%d", &arr[l]); } if(n == 1) { printf("1\n"); } else { for(i = 0; i < (n - 1); i++) { if(ar...
You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.
Print the maximum length of an increasing subarray of the given array.
C
4553b327d7b9f090641590d6492c2c41
44449741d649fd8685f920439f4e1846
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "greedy" ]
1469804400
["5\n1 7 2 11 15", "6\n100 100 100 100 100 100", "3\n1 2 3"]
null
PASSED
800
standard input
1 second
The first line contains single positive integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105) โ€” the number of integers. The second line contains n positive integers a1,โ€‰a2,โ€‰...,โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "1", "3"]
#include <stdio.h> int main() { int n,i,foo=1,min=0; 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]>a[i-1]) { foo++; } else { if(foo>min) min=foo; foo=1; } } if(foo>min) printf("%d",foo); else printf("%d",min); return 0; }
You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.
Print the maximum length of an increasing subarray of the given array.
C
4553b327d7b9f090641590d6492c2c41
efea1f8c0d05f01a349cdcaa3835b6bf
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "greedy" ]
1469804400
["5\n1 7 2 11 15", "6\n100 100 100 100 100 100", "3\n1 2 3"]
null
PASSED
800
standard input
1 second
The first line contains single positive integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105) โ€” the number of integers. The second line contains n positive integers a1,โ€‰a2,โ€‰...,โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "1", "3"]
#include<stdio.h> int main() { int n; scanf("%d",&n); int a[n]; int i; for(i=0;i<n;i++) scanf("%d",&a[i]); long int j,k=1,l=1; for(j=0;j<n-1;j++) { if(a[j+1]>a[j]) ++k; else { if(k>=l) { l=k; } k=1; } } if(l>k) printf("%ld\n",l); else printf("%ld\n",k); }
You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.
Print the maximum length of an increasing subarray of the given array.
C
4553b327d7b9f090641590d6492c2c41
4f9a3ce02b5a67e4d1986c0add800b71
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "greedy" ]
1469804400
["5\n1 7 2 11 15", "6\n100 100 100 100 100 100", "3\n1 2 3"]
null
PASSED
800
standard input
1 second
The first line contains single positive integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105) โ€” the number of integers. The second line contains n positive integers a1,โ€‰a2,โ€‰...,โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "1", "3"]
#include<stdio.h> int main(void) { int n,i,max=1,max_store=1; long long int a[100005]; scanf("%d",&n); scanf("%I64d",&a[0]); for(i=1;i<n;i++) { scanf("%I64d",&a[i]); if(a[i]>a[i-1]) { max++; if(max>max_store) { max_store=max; } } else { max=1; } } printf("%d",max_store); return 0; }
You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.
Print the maximum length of an increasing subarray of the given array.
C
4553b327d7b9f090641590d6492c2c41
d5bcd89a7c328e460e8eae2c47bbff57
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "greedy" ]
1469804400
["5\n1 7 2 11 15", "6\n100 100 100 100 100 100", "3\n1 2 3"]
null
PASSED
800
standard input
1 second
The first line contains single positive integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105) โ€” the number of integers. The second line contains n positive integers a1,โ€‰a2,โ€‰...,โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "1", "3"]
#include <stdio.h> #define N 100000 int arr[N]; int num[N]; int main(){ int i,n,max=0; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&num[i]); if(i==0) arr[0]=1; else if(num[i]>num[i-1])arr[i]=arr[i-1]+1; else arr[i]=1; if(arr[i]>max) max=arr[i]; } printf("%d\n",max ); return 0; }
You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.
Print the maximum length of an increasing subarray of the given array.
C
4553b327d7b9f090641590d6492c2c41
1e899674af87079b1033a3a9b3f3b0bc
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "greedy" ]
1469804400
["5\n1 7 2 11 15", "6\n100 100 100 100 100 100", "3\n1 2 3"]
null
PASSED
800
standard input
1 second
The first line contains single positive integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105) โ€” the number of integers. The second line contains n positive integers a1,โ€‰a2,โ€‰...,โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "1", "3"]
#include<stdio.h> main() { long long int n,t=1,k=1,j; scanf("%lld",&n); int a[n]; for(j=0;j<n;j++) { scanf("%lld",&a[j]); } for(j=0;j<(n-1);j++) { if(a[j+1]-a[j]<=0) { t=0; } t++; if(t>k) k=t; } printf("%d",k); }
You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.
Print the maximum length of an increasing subarray of the given array.
C
4553b327d7b9f090641590d6492c2c41
f7c0550b1e28529d6d7bd7065de5d058
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "greedy" ]
1469804400
["5\n1 7 2 11 15", "6\n100 100 100 100 100 100", "3\n1 2 3"]
null
PASSED
800
standard input
1 second
The first line contains single positive integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105) โ€” the number of integers. The second line contains n positive integers a1,โ€‰a2,โ€‰...,โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "1", "3"]
#include<stdio.h> main() { int n; scanf("%d",&n); int c=1,i,x=0,a[n],prev; for(i=0;i<n;i++) { scanf("%d",&a[i]); } prev=a[0]; for(i=1;i<n;i++) { if(a[i]>prev) { c++; } else c=1; if(c>x) x=c; ...
You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.
Print the maximum length of an increasing subarray of the given array.
C
4553b327d7b9f090641590d6492c2c41
ce9a681f1b0cd5ddbc27fdb5e7ce9ffd
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "greedy" ]
1469804400
["5\n1 7 2 11 15", "6\n100 100 100 100 100 100", "3\n1 2 3"]
null
PASSED
800
standard input
1 second
The first line contains single positive integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105) โ€” the number of integers. The second line contains n positive integers a1,โ€‰a2,โ€‰...,โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "1", "3"]
#include<stdio.h> int n; int now = 1; int a = 0, b = 0; int max = 1; int main() { scanf("%d", &n); for(int i = 0; i < n; i++) { scanf("%d", &a); if(a > b && a != b && i > 0) { now++; if(max < now) max = now; } else now = 1; b = a; } printf("%d\n", max); return 0; }
You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.
Print the maximum length of an increasing subarray of the given array.
C
4553b327d7b9f090641590d6492c2c41
07b92a45fad6171ed7d0210db6955f2e
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "greedy" ]
1469804400
["5\n1 7 2 11 15", "6\n100 100 100 100 100 100", "3\n1 2 3"]
null
PASSED
800
standard input
1 second
The first line contains single positive integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105) โ€” the number of integers. The second line contains n positive integers a1,โ€‰a2,โ€‰...,โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "1", "3"]
#include <stdio.h> #include <stdlib.h> int main() { long long n,i,j,a[100000],temp,ans; temp=ans=1; scanf("%lld",&n); for(i=0;i<n;i++) scanf("%lld",&a[i]); for(i=0;i<n;i++) { temp=1; while(a[i+temp-1]<a[i+temp]&&i+temp<n) temp++; if(temp>ans) ...
You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.
Print the maximum length of an increasing subarray of the given array.
C
4553b327d7b9f090641590d6492c2c41
8dbadfe874a10378088563db07ab495b
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "greedy" ]
1469804400
["5\n1 7 2 11 15", "6\n100 100 100 100 100 100", "3\n1 2 3"]
null
PASSED
800
standard input
1 second
The first line contains single positive integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105) โ€” the number of integers. The second line contains n positive integers a1,โ€‰a2,โ€‰...,โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "1", "3"]
#include<stdio.h> int main(){ int x,y1=0,y2=0,count1=0,count2=0; scanf("%d",&x); int a; for(a=0;a<x;++a){ scanf("%d",&y1); if(y1>y2) ++count1; if(y1<=y2||a==x-1){ if(count1>count2) count2=count1; count1=1; } y2=y1; }...
You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.
Print the maximum length of an increasing subarray of the given array.
C
4553b327d7b9f090641590d6492c2c41
62beb6c619aab764c314e3f5d9753d90
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "greedy" ]
1469804400
["5\n1 7 2 11 15", "6\n100 100 100 100 100 100", "3\n1 2 3"]
null
PASSED
800
standard input
1 second
The first line contains single positive integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105) โ€” the number of integers. The second line contains n positive integers a1,โ€‰a2,โ€‰...,โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "1", "3"]
#include<stdio.h> int main() { int n; scanf("%d",&n); int a[n]; int i,m=1,c=1; for(i=0;i<n;i++) scanf("%d",a+i); for(i=0;i<n-1;i++) { if(a[i]<a[i+1]) c++; else { if(c>m) m=c; c=1; } } ...
You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.
Print the maximum length of an increasing subarray of the given array.
C
4553b327d7b9f090641590d6492c2c41
375ed14b37c346e865cd87ad1d75fc95
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "greedy" ]
1469804400
["5\n1 7 2 11 15", "6\n100 100 100 100 100 100", "3\n1 2 3"]
null
PASSED
800
standard input
1 second
The first line contains single positive integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105) โ€” the number of integers. The second line contains n positive integers a1,โ€‰a2,โ€‰...,โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "1", "3"]
#include<stdio.h> int main() { long long n; scanf("%I64d",&n); long long i,j,flag=-1,temp=1;; long long myarray[n]; scanf("%I64d",&myarray[0]); for(i=1; i<n; i++) { scanf("%I64d",&myarray[i]); } for(i=1; i<n; i++) { if(myarray[i-1]<myarray[i]) { ...
You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.
Print the maximum length of an increasing subarray of the given array.
C
4553b327d7b9f090641590d6492c2c41
f7beed8fdb1310fc95070776313216f0
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "greedy" ]
1469804400
["5\n1 7 2 11 15", "6\n100 100 100 100 100 100", "3\n1 2 3"]
null
PASSED
800
standard input
1 second
The first line contains single positive integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105) โ€” the number of integers. The second line contains n positive integers a1,โ€‰a2,โ€‰...,โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "1", "3"]
#include <stdio.h> int buscaMax(int arr[],int n){ int max = -1; int i; for(i=0;i<=n;i++){ if(max<arr[i]) max = arr[i]; } return max; } int main(){ int n; int arr[200000]; int i,j; scanf("%d",&n); for(i=0;i<n;i++) scanf("%d",&arr[i]); int dp[200000]; for(i=0; i<n; i++){ dp[i] = 1; for(j=i;...
You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.
Print the maximum length of an increasing subarray of the given array.
C
4553b327d7b9f090641590d6492c2c41
51bab9675bff6431e8379b2d2c9e815a
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "greedy" ]
1469804400
["5\n1 7 2 11 15", "6\n100 100 100 100 100 100", "3\n1 2 3"]
null
PASSED
800
standard input
1 second
The first line contains single positive integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105) โ€” the number of integers. The second line contains n positive integers a1,โ€‰a2,โ€‰...,โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "1", "3"]
#include<stdio.h> #include<stdlib.h> int max(int i, int j){ if(i > j) return i; else return j; } int main(){ int n,*p,i; scanf("%d",&n); p = malloc(n*sizeof(int)); for(i = 0; i < n; i++){ scanf("%d",&p[i]); } int maximum = 0; int j = 1, f = 0; for(i = 0; i < n; i++...
You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.
Print the maximum length of an increasing subarray of the given array.
C
4553b327d7b9f090641590d6492c2c41
5c3735fb8b659d04571c1f782572c234
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "greedy" ]
1469804400
["5\n1 7 2 11 15", "6\n100 100 100 100 100 100", "3\n1 2 3"]
null
PASSED
800
standard input
1 second
The first line contains single positive integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105) โ€” the number of integers. The second line contains n positive integers a1,โ€‰a2,โ€‰...,โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "1", "3"]
#include<stdio.h> int main() { long long int n,X=1,count=1,i; scanf("%lld",&n); long long int a[n]; for(i=0;i<n;i++) scanf("%lld",&a[i]); for(i=0;i<n-1;i+=1) { if(a[i+1]>a[i]) {count++; } else count=1; if(X<count) X=count; } printf("%lld",X); return 0; }
You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.
Print the maximum length of an increasing subarray of the given array.
C
4553b327d7b9f090641590d6492c2c41
df3df45c28bef302fea8c847494510c3
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "greedy" ]
1469804400
["5\n1 7 2 11 15", "6\n100 100 100 100 100 100", "3\n1 2 3"]
null
PASSED
800
standard input
1 second
The first line contains single positive integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105) โ€” the number of integers. The second line contains n positive integers a1,โ€‰a2,โ€‰...,โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "1", "3"]
#include<stdio.h> #include<stdlib.h> int main() { int n; scanf("%d", &n); int i=0; int dp[n], a[n]; int ans=1; for(i=0;i<n;i++){ dp[i]=1; scanf("%d", &a[i]); if (i==0) { dp[i]=1; continue; } if(a[i]>a[i-1]) dp[i] += dp[i-1]; else dp[i]=1; ans = (ans > dp[i])?an...
You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.
Print the maximum length of an increasing subarray of the given array.
C
4553b327d7b9f090641590d6492c2c41
2a226c9744d0474201cdff274becf0fe
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "greedy" ]
1469804400
["5\n1 7 2 11 15", "6\n100 100 100 100 100 100", "3\n1 2 3"]
null
PASSED
800
standard input
1 second
The first line contains single positive integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105) โ€” the number of integers. The second line contains n positive integers a1,โ€‰a2,โ€‰...,โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "1", "3"]
#include<stdio.h> #define MAX 100002 int main() { int n,i,a[MAX],p=0,b=0,m=1; scanf("%d ",&n); for(i=0;i<n;i++) { scanf("%d",&a[i]); if(a[i]>b) { p++; if(p>m) m=p; } else { p=1; } ...
You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.
Print the maximum length of an increasing subarray of the given array.
C
4553b327d7b9f090641590d6492c2c41
fd48026d3aa14882e1efaa03d95952c0
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "greedy" ]
1469804400
["5\n1 7 2 11 15", "6\n100 100 100 100 100 100", "3\n1 2 3"]
null
PASSED
800
standard input
1 second
The first line contains single positive integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105) โ€” the number of integers. The second line contains n positive integers a1,โ€‰a2,โ€‰...,โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "1", "3"]
#include<stdio.h> int main() { long long int i,j=0,count1=1,count2=0,n,ct=0; scanf("%lld",&n); long long int a[n]; for(i=0;i<n;i++) { scanf("%lld",&a[i]); } for(i=0,j=1;j<n;j++,i++) { if(a[j]==a[i]){ ct++; } if(a[j]>a[i]) { ...
You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.
Print the maximum length of an increasing subarray of the given array.
C
4553b327d7b9f090641590d6492c2c41
896aaf8a55041217e51ae92919449d18
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "greedy" ]
1469804400
["5\n1 7 2 11 15", "6\n100 100 100 100 100 100", "3\n1 2 3"]
null
PASSED
800
standard input
1 second
The first line contains single positive integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105) โ€” the number of integers. The second line contains n positive integers a1,โ€‰a2,โ€‰...,โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "1", "3"]
//Maximum Increase #include<stdio.h> #include<string.h> #include<limits.h> #include<math.h> int main() { int i,prev,max,n; int a; scanf("%d",&n); max=INT_MIN; int len=1; for(i=0;i<n;i++) { scanf("%d",&a); if(a>prev) len++; else len=1; if(max<len) { max=len; } prev=a; } printf("%d",ma...
You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.
Print the maximum length of an increasing subarray of the given array.
C
4553b327d7b9f090641590d6492c2c41
e0edbff57dbe475e82bfd066ed4c591f
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "greedy" ]
1469804400
["5\n1 7 2 11 15", "6\n100 100 100 100 100 100", "3\n1 2 3"]
null
PASSED
800
standard input
1 second
The first line contains single positive integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105) โ€” the number of integers. The second line contains n positive integers a1,โ€‰a2,โ€‰...,โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "1", "3"]
#include<stdio.h> int main() { int s,i,a,k,n,max; while(scanf("%d",&n)==1) { s=0; max=1; k=0; for(i=0;i<n;i++) { scanf("%d",&a); if(a>s) { k++; if(k>max) max=k; } ...
You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.
Print the maximum length of an increasing subarray of the given array.
C
4553b327d7b9f090641590d6492c2c41
1f190cb27b8ac6be78ded892d7df5e40
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "greedy" ]
1469804400
["5\n1 7 2 11 15", "6\n100 100 100 100 100 100", "3\n1 2 3"]
null
PASSED
800
standard input
1 second
The first line contains single positive integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105) โ€” the number of integers. The second line contains n positive integers a1,โ€‰a2,โ€‰...,โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "1", "3"]
#include<stdio.h> int main() { int s,i,a,k,n,max; while(scanf("%d",&n)==1) { s=0; max=1; k=0; for(i=0;i<n;i++) { scanf("%d",&a); if(a>s) { k++; if(k>max) max=k; } ...
You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.
Print the maximum length of an increasing subarray of the given array.
C
4553b327d7b9f090641590d6492c2c41
a9667f93634c596d850c54f49623ce55
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "greedy" ]
1469804400
["5\n1 7 2 11 15", "6\n100 100 100 100 100 100", "3\n1 2 3"]
null
PASSED
800
standard input
1 second
The first line contains single positive integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105) โ€” the number of integers. The second line contains n positive integers a1,โ€‰a2,โ€‰...,โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "1", "3"]
#include<stdio.h> int main() { int n; while(scanf("%d",&n)==1) { int i=0,number,count=1,current,highest=1; while(i<n) { scanf("%d",&number); if(i) { if(current<number) { ++count; ...
You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.
Print the maximum length of an increasing subarray of the given array.
C
4553b327d7b9f090641590d6492c2c41
d31d7a9c16895fc3aa2dd733ca2ef9af
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "greedy" ]
1469804400
["5\n1 7 2 11 15", "6\n100 100 100 100 100 100", "3\n1 2 3"]
null
PASSED
800
standard input
1 second
The first line contains single positive integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105) โ€” the number of integers. The second line contains n positive integers a1,โ€‰a2,โ€‰...,โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "1", "3"]
#include<stdio.h> int main () { long long int n,a,b,c,i,total=1,count=1,first=1; scanf("%lld",&n); for(i=0;i<n;i++) { scanf("%lld",&a); if(first==1)c=a,first=0,total=1; else { if(a>c) { if(i==n-1) { ...
You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.
Print the maximum length of an increasing subarray of the given array.
C
4553b327d7b9f090641590d6492c2c41
c87ad86f7d716cafcd05731006b02f5c
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "greedy" ]
1469804400
["5\n1 7 2 11 15", "6\n100 100 100 100 100 100", "3\n1 2 3"]
null
PASSED
800
standard input
1 second
The first line contains single positive integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105) โ€” the number of integers. The second line contains n positive integers a1,โ€‰a2,โ€‰...,โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "1", "3"]
#include<stdio.h> int main(){ int n,c=1,max=0; long long m,p; scanf("%d %I64d",&n,&p); n--; while(n--){ scanf("%I64d",&m); if(m>p){ c++; // printf("%d>>",m); } else{ if(max<c){ max=c; // printf("%d\n",ma...
You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.
Print the maximum length of an increasing subarray of the given array.
C
4553b327d7b9f090641590d6492c2c41
c8adc479dda3424c4f2e412c058d6e25
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "greedy" ]
1469804400
["5\n1 7 2 11 15", "6\n100 100 100 100 100 100", "3\n1 2 3"]
null
PASSED
800
standard input
1 second
The first line contains single positive integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105) โ€” the number of integers. The second line contains n positive integers a1,โ€‰a2,โ€‰...,โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "1", "3"]
#include <stdio.h> #include <stdlib.h> void read(unsigned long *, unsigned int); unsigned int find_length_max_increasing_subsequence(unsigned long *, unsigned int); int main() { unsigned int no_of_numbers, maximum_subsequence_length; scanf("%u",&no_of_numbers); unsigned long *number_sequence = malloc(no_...
You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.
Print the maximum length of an increasing subarray of the given array.
C
4553b327d7b9f090641590d6492c2c41
43be02267d428de2d39c0f88776e21dd
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "greedy" ]
1469804400
["5\n1 7 2 11 15", "6\n100 100 100 100 100 100", "3\n1 2 3"]
null
PASSED
800
standard input
1 second
The first line contains single positive integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105) โ€” the number of integers. The second line contains n positive integers a1,โ€‰a2,โ€‰...,โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "1", "3"]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /* * File: main.c * Author: alulab14 * * Created on 13 de mayo de 2017, 12:04 PM */ #include <stdio.h> #include <stdlib.h> /...
You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.
Print the maximum length of an increasing subarray of the given array.
C
4553b327d7b9f090641590d6492c2c41
23868c7be147d6649810a7289a5aac55
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "greedy" ]
1469804400
["5\n1 7 2 11 15", "6\n100 100 100 100 100 100", "3\n1 2 3"]
null
PASSED
800
standard input
1 second
The first line contains single positive integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105) โ€” the number of integers. The second line contains n positive integers a1,โ€‰a2,โ€‰...,โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "1", "3"]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /* * File: main.c * Author: alulab14 * * Created on 13 de mayo de 2017, 12:04 PM */ #include <stdio.h> #include <stdlib.h> /...
You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.
Print the maximum length of an increasing subarray of the given array.
C
4553b327d7b9f090641590d6492c2c41
52d9d43efecfb1075058beb4ef66fd36
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "greedy" ]
1469804400
["5\n1 7 2 11 15", "6\n100 100 100 100 100 100", "3\n1 2 3"]
null
PASSED
800
standard input
1 second
The first line contains single positive integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105) โ€” the number of integers. The second line contains n positive integers a1,โ€‰a2,โ€‰...,โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "1", "3"]
//http://codeforces.com/problemset/problem/702/A #include<stdio.h> #include<math.h> #include<string.h> #define False 0 #define True 1 // int small(char ch) // int capital(char ch); // int prime(int number); // void bubble_sort(int arr[], int n); //void upper(char *ptr); //void lower(char *ptr); // void sort(char *ptr, ...
You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.
Print the maximum length of an increasing subarray of the given array.
C
4553b327d7b9f090641590d6492c2c41
15b63f8fa01f723a242b386bd9e443f5
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "greedy" ]
1469804400
["5\n1 7 2 11 15", "6\n100 100 100 100 100 100", "3\n1 2 3"]
null
PASSED
800
standard input
1 second
The first line contains single positive integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105) โ€” the number of integers. The second line contains n positive integers a1,โ€‰a2,โ€‰...,โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "1", "3"]
#include<stdio.h> #include<string.h> int main() { int ara[100000]; int n,i,x=1,a=1; scanf("%d",&n); scanf("%d",&ara[0]); for(i=1;i<n;i++){ scanf("%d",&ara[i]); if(ara[i]>ara[i-1]){ x=x+1; } else{ x=1; } if(x>a) a=x; } printf(...
You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.
Print the maximum length of an increasing subarray of the given array.
C
4553b327d7b9f090641590d6492c2c41
c179ac3990bd7592eefcc01b7f02c654
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation", "greedy" ]
1469804400
["5\n1 7 2 11 15", "6\n100 100 100 100 100 100", "3\n1 2 3"]
null
PASSED
800
standard input
1 second
The first line contains single positive integer n (1โ€‰โ‰คโ€‰nโ€‰โ‰คโ€‰105) โ€” the number of integers. The second line contains n positive integers a1,โ€‰a2,โ€‰...,โ€‰an (1โ€‰โ‰คโ€‰aiโ€‰โ‰คโ€‰109).
["3", "1", "3"]
#include<stdio.h> int main() { long long n,k,j,i,m; scanf("%lld",&n); long long a[n]; for(i=0; i<n; i++) { scanf("%lld",&a[i]); } k = 1; m = 0; for(i=0,j=i+1; i<n-1,j<n; i++,j++) { if(a[j]>a[i]) { k++; } else { if(k > m) { m = k; } k = 1; } } if(k > m) { printf("%lld\n",k...
Petya got interested in grammar on his third year in school. He invented his own language called Petya's. Petya wanted to create a maximally simple language that would be enough to chat with friends, that's why all the language's grammar can be described with the following set of rules: There are three parts of speech:...
If some word of the given text does not belong to the Petya's language or if the text contains more that one sentence, print "NO" (without the quotes). Otherwise, print "YES" (without the quotes).
C
0c9550a09f84de6bed529d007ccb4ae8
4fa4ce70e6163139c6d707bf014d74c1
GNU C
standard output
256 megabytes
train_000.jsonl
[ "implementation", "strings" ]
1315494000
["petr", "etis atis animatis etis atis amatis", "nataliala kataliala vetra feinites"]
null
PASSED
1,600
standard input
5 seconds
The first line contains one or more words consisting of lowercase Latin letters. The overall number of characters (including letters and spaces) does not exceed 105. It is guaranteed that any two consecutive words are separated by exactly one space and the input data do not contain any other spaces. It is possible that...
["YES", "NO", "YES"]
#include <stdio.h> #include <string.h> char s[200000]; char t[200000]; int type[200000]; int gender[200000]; int no; int ends(char *t,char *u) { int l=strlen(t); int m=strlen(u); int i,j; if(m>l) return 0; for(j=0,i=l-m;i<l;i++,j++) if(t[i]!=u[j]) return 0; return 1; } int ismale(char *t) { if(ends(t,...
Petya got interested in grammar on his third year in school. He invented his own language called Petya's. Petya wanted to create a maximally simple language that would be enough to chat with friends, that's why all the language's grammar can be described with the following set of rules: There are three parts of speech:...
If some word of the given text does not belong to the Petya's language or if the text contains more that one sentence, print "NO" (without the quotes). Otherwise, print "YES" (without the quotes).
C
0c9550a09f84de6bed529d007ccb4ae8
985269844e29db9b97f6f8297dee2efa
GNU C
standard output
256 megabytes
train_000.jsonl
[ "implementation", "strings" ]
1315494000
["petr", "etis atis animatis etis atis amatis", "nataliala kataliala vetra feinites"]
null
PASSED
1,600
standard input
5 seconds
The first line contains one or more words consisting of lowercase Latin letters. The overall number of characters (including letters and spaces) does not exceed 105. It is guaranteed that any two consecutive words are separated by exactly one space and the input data do not contain any other spaces. It is possible that...
["YES", "NO", "YES"]
#include <stdio.h> #include <string.h> int main() { char s[100005]; char c[100005]; char t[6][6] = {"lios", "liala", "etr", "etra", "initis", "inites"}; int x = 0, y = 0, z = 0, f = 0, i, j; int a[6] = {4, 5, 3, 4, 6, 6}; fgets(s, 100005, stdin); s[strlen(s) - 1] = '\0'; for ...
Petya got interested in grammar on his third year in school. He invented his own language called Petya's. Petya wanted to create a maximally simple language that would be enough to chat with friends, that's why all the language's grammar can be described with the following set of rules: There are three parts of speech:...
If some word of the given text does not belong to the Petya's language or if the text contains more that one sentence, print "NO" (without the quotes). Otherwise, print "YES" (without the quotes).
C
0c9550a09f84de6bed529d007ccb4ae8
53a19ebf4935af4d0599748e696fe8e9
GNU C
standard output
256 megabytes
train_000.jsonl
[ "implementation", "strings" ]
1315494000
["petr", "etis atis animatis etis atis amatis", "nataliala kataliala vetra feinites"]
null
PASSED
1,600
standard input
5 seconds
The first line contains one or more words consisting of lowercase Latin letters. The overall number of characters (including letters and spaces) does not exceed 105. It is guaranteed that any two consecutive words are separated by exactly one space and the input data do not contain any other spaces. It is possible that...
["YES", "NO", "YES"]
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #define MASCULINE 1 #define FEMININE 2 int check(char* input, char* s1, char *s2) { if (!strstr(input, s1) && !strstr(input, s2)) return 0; if (strstr(input, s1) != NULL) { if (strcmp(input + strlen(input) - strlen(s1), ...
Petya got interested in grammar on his third year in school. He invented his own language called Petya's. Petya wanted to create a maximally simple language that would be enough to chat with friends, that's why all the language's grammar can be described with the following set of rules: There are three parts of speech:...
If some word of the given text does not belong to the Petya's language or if the text contains more that one sentence, print "NO" (without the quotes). Otherwise, print "YES" (without the quotes).
C
0c9550a09f84de6bed529d007ccb4ae8
d43fd127cd29d2fd12e285f2af3ef5e8
GNU C
standard output
256 megabytes
train_000.jsonl
[ "implementation", "strings" ]
1315494000
["petr", "etis atis animatis etis atis amatis", "nataliala kataliala vetra feinites"]
null
PASSED
1,600
standard input
5 seconds
The first line contains one or more words consisting of lowercase Latin letters. The overall number of characters (including letters and spaces) does not exceed 105. It is guaranteed that any two consecutive words are separated by exactly one space and the input data do not contain any other spaces. It is possible that...
["YES", "NO", "YES"]
#include <stdio.h> #include <string.h> // ๋‚จ์„ฑ / ์—ฌ์„ฑ // ํ˜•์šฉ์‚ฌ lios / liala // ๋ช…์‚ฌ etr / etra // ๋™์‚ฌ initis / inites // ??ํ˜•์šฉ์‚ฌ + 1๋ช…์‚ฌ + ??๋™์‚ฌ (๋™์‚ฌ๊ฐ€ ์—ฌ๋Ÿฌ๊ฐœ ์žˆ์œผ๋ฉด ์•ˆ๋œ๋‹ค.) // ํ•ญ์ƒ ๊ฐ™์€ gender๋ฅผ ๊ฐ€์ง // 1. ๋‹จ์–ด์ธ์ง€ ๋ฌธ์žฅ์ธ์ง€ ํŒ๋‹จํ•œ๋‹ค. // 2. ์–ด๋ฏธ๊ฐ€ ์ „๋ถ€ Petya์–ธ์–ด์— ๋งž๋Š”์ง€ ํ™•์ธํ•œ๋‹ค. // 3. ๋ฌธ์žฅ์ด๋ผ๋ฉด ๋ช…์‚ฌ๊ฐ€ ์ •ํ™•ํžˆ 1๊ฐœ์ธ์ง€ ํ™•์ธํ•œ๋‹ค. // 4. ํ˜•์šฉ์‚ฌ์™€ ๋™์‚ฌ๊ฐ€ ์ œ๋Œ€๋กœ๋œ ์œ„์น˜์— ์žˆ๋Š”์ง€ ํ™•์ธํ•œ๋‹ค. // 5. ๋ชจ...
Petya got interested in grammar on his third year in school. He invented his own language called Petya's. Petya wanted to create a maximally simple language that would be enough to chat with friends, that's why all the language's grammar can be described with the following set of rules: There are three parts of speech:...
If some word of the given text does not belong to the Petya's language or if the text contains more that one sentence, print "NO" (without the quotes). Otherwise, print "YES" (without the quotes).
C
0c9550a09f84de6bed529d007ccb4ae8
bd9fba1dd852e3ad8c69dc106bf4b182
GNU C
standard output
256 megabytes
train_000.jsonl
[ "implementation", "strings" ]
1315494000
["petr", "etis atis animatis etis atis amatis", "nataliala kataliala vetra feinites"]
null
PASSED
1,600
standard input
5 seconds
The first line contains one or more words consisting of lowercase Latin letters. The overall number of characters (including letters and spaces) does not exceed 105. It is guaranteed that any two consecutive words are separated by exactly one space and the input data do not contain any other spaces. It is possible that...
["YES", "NO", "YES"]
#include <stdio.h> #include <string.h> // ๋‚จ์„ฑ / ์—ฌ์„ฑ // ํ˜•์šฉ์‚ฌ lios / liala // ๋ช…์‚ฌ etr / etra // ๋™์‚ฌ initis / inites // ??ํ˜•์šฉ์‚ฌ + 1๋ช…์‚ฌ + ??๋™์‚ฌ (๋™์‚ฌ๊ฐ€ ์—ฌ๋Ÿฌ๊ฐœ ์žˆ์œผ๋ฉด ์•ˆ๋œ๋‹ค.) // ํ•ญ์ƒ ๊ฐ™์€ gender๋ฅผ ๊ฐ€์ง // 1. ๋‹จ์–ด์ธ์ง€ ๋ฌธ์žฅ์ธ์ง€ ํŒ๋‹จํ•œ๋‹ค. // 2. ์–ด๋ฏธ๊ฐ€ ์ „๋ถ€ Petya์–ธ์–ด์— ๋งž๋Š”์ง€ ํ™•์ธํ•œ๋‹ค. // 3. ๋ฌธ์žฅ์ด๋ผ๋ฉด ๋ช…์‚ฌ๊ฐ€ ์ •ํ™•ํžˆ 1๊ฐœ์ธ์ง€ ํ™•์ธํ•œ๋‹ค. // 4. ํ˜•์šฉ์‚ฌ์™€ ๋™์‚ฌ๊ฐ€ ์ œ๋Œ€๋กœ๋œ ์œ„์น˜์— ์žˆ๋Š”์ง€ ํ™•์ธํ•œ๋‹ค. // 5. ๋ชจ...
Petya got interested in grammar on his third year in school. He invented his own language called Petya's. Petya wanted to create a maximally simple language that would be enough to chat with friends, that's why all the language's grammar can be described with the following set of rules: There are three parts of speech:...
If some word of the given text does not belong to the Petya's language or if the text contains more that one sentence, print "NO" (without the quotes). Otherwise, print "YES" (without the quotes).
C
0c9550a09f84de6bed529d007ccb4ae8
d01d2088a9583e7ae9bae6d263c55763
GNU C
standard output
256 megabytes
train_000.jsonl
[ "implementation", "strings" ]
1315494000
["petr", "etis atis animatis etis atis amatis", "nataliala kataliala vetra feinites"]
null
PASSED
1,600
standard input
5 seconds
The first line contains one or more words consisting of lowercase Latin letters. The overall number of characters (including letters and spaces) does not exceed 105. It is guaranteed that any two consecutive words are separated by exactly one space and the input data do not contain any other spaces. It is possible that...
["YES", "NO", "YES"]
#include <stdio.h> #include <string.h> char str[200005]={0}; int main() { long flag=0; long t=1; long s=0; long l; long temp=0; for(;;) { temp=0; if(scanf("%s",str)==EOF) break; l=strlen(str); if(l>=4) if(str[l-1]=='s'&&str[l-2]=='o'&&str[l-3]=='i'&&str[l-4]=='l') flag|...