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
A lot of people in Berland hates rain, but you do not. Rain pacifies, puts your thoughts in order. By these years you have developed a good tradition — when it rains, you go on the street and stay silent for a moment, contemplate all around you, enjoy freshness, think about big deeds you have to do. Today everything ha...
If it is impossible to make the cup empty, print "NO" (without quotes). Otherwise print "YES" (without quotes) in the first line. In the second line print a real number — time in seconds needed the cup will be empty. The answer will be considered correct if its relative or absolute error doesn't exceed 10 - 4. It is gu...
C
fc37ef81bb36f3ac07ce2c4c3ec10d98
178dc786788a3eaa120f056a4e1adbcd
GNU C
standard output
256 megabytes
train_000.jsonl
[ "geometry", "math" ]
1461947700
["1 2 3 100", "1 1 1 1"]
NoteIn the first example the water fills the cup faster than you can drink from it.In the second example area of the cup's bottom equals to , thus we can conclude that you decrease the level of water by centimeters per second. At the same time water level increases by 1 centimeter per second due to rain. Thus, cup wil...
PASSED
1,100
standard input
1 second
The only line of the input contains four integer numbers d, h, v, e (1 ≤ d, h, v, e ≤ 104), where: d — the diameter of your cylindrical cup, h — the initial level of water in the cup, v — the speed of drinking process from the cup in milliliters per second, e — the growth of water because of rain if you do not dri...
["NO", "YES\n3.659792366325"]
#include <stdio.h> #include <stdlib.h> #include <float.h> #define pi 3.14159265358979323846 int main() { int d,h,v,e; double x,y,z; scanf("%d %d %d %d",&d,&h,&v,&e); x=0.25*d*d*pi; y=v/x; z=e; if(y>z){printf("YES\n"); y=y-z; printf("%.13g\n",h/y); } else{pr...
A lot of people in Berland hates rain, but you do not. Rain pacifies, puts your thoughts in order. By these years you have developed a good tradition — when it rains, you go on the street and stay silent for a moment, contemplate all around you, enjoy freshness, think about big deeds you have to do. Today everything ha...
If it is impossible to make the cup empty, print "NO" (without quotes). Otherwise print "YES" (without quotes) in the first line. In the second line print a real number — time in seconds needed the cup will be empty. The answer will be considered correct if its relative or absolute error doesn't exceed 10 - 4. It is gu...
C
fc37ef81bb36f3ac07ce2c4c3ec10d98
fad916f9fae0beb7a3ebe2c9f1821eef
GNU C
standard output
256 megabytes
train_000.jsonl
[ "geometry", "math" ]
1461947700
["1 2 3 100", "1 1 1 1"]
NoteIn the first example the water fills the cup faster than you can drink from it.In the second example area of the cup's bottom equals to , thus we can conclude that you decrease the level of water by centimeters per second. At the same time water level increases by 1 centimeter per second due to rain. Thus, cup wil...
PASSED
1,100
standard input
1 second
The only line of the input contains four integer numbers d, h, v, e (1 ≤ d, h, v, e ≤ 104), where: d — the diameter of your cylindrical cup, h — the initial level of water in the cup, v — the speed of drinking process from the cup in milliliters per second, e — the growth of water because of rain if you do not dri...
["NO", "YES\n3.659792366325"]
#include<stdio.h> #include<math.h> int main(){ double d,h,v,e; scanf("%lf", &d); scanf("%lf", &h); scanf("%lf", &v); scanf("%lf", &e); double D = d; d = d/2; double vol = M_PI * d*d * h; double E = e*d*d*M_PI; double time = vol / (v-E); //cout<<time<<endl; if(time <= 10000 && time >= 0){ printf("YES\n...
A lot of people in Berland hates rain, but you do not. Rain pacifies, puts your thoughts in order. By these years you have developed a good tradition — when it rains, you go on the street and stay silent for a moment, contemplate all around you, enjoy freshness, think about big deeds you have to do. Today everything ha...
If it is impossible to make the cup empty, print "NO" (without quotes). Otherwise print "YES" (without quotes) in the first line. In the second line print a real number — time in seconds needed the cup will be empty. The answer will be considered correct if its relative or absolute error doesn't exceed 10 - 4. It is gu...
C
fc37ef81bb36f3ac07ce2c4c3ec10d98
0dbf176f8c0f4d2ab7406f083db12924
GNU C
standard output
256 megabytes
train_000.jsonl
[ "geometry", "math" ]
1461947700
["1 2 3 100", "1 1 1 1"]
NoteIn the first example the water fills the cup faster than you can drink from it.In the second example area of the cup's bottom equals to , thus we can conclude that you decrease the level of water by centimeters per second. At the same time water level increases by 1 centimeter per second due to rain. Thus, cup wil...
PASSED
1,100
standard input
1 second
The only line of the input contains four integer numbers d, h, v, e (1 ≤ d, h, v, e ≤ 104), where: d — the diameter of your cylindrical cup, h — the initial level of water in the cup, v — the speed of drinking process from the cup in milliliters per second, e — the growth of water because of rain if you do not dri...
["NO", "YES\n3.659792366325"]
#include <stdio.h> #include <math.h> #define epsilon 0.00000000001 int main() { int d, h, v, e; scanf("%d %d %d %d", &d, &h, &v, &e); double area = d*d*M_PI/4; double increase_rate = area*e;//*1000; double volume; if(increase_rate - v > epsilon) { printf("NO\n"); } else { printf("YES\n"); volume = are...
A lot of people in Berland hates rain, but you do not. Rain pacifies, puts your thoughts in order. By these years you have developed a good tradition — when it rains, you go on the street and stay silent for a moment, contemplate all around you, enjoy freshness, think about big deeds you have to do. Today everything ha...
If it is impossible to make the cup empty, print "NO" (without quotes). Otherwise print "YES" (without quotes) in the first line. In the second line print a real number — time in seconds needed the cup will be empty. The answer will be considered correct if its relative or absolute error doesn't exceed 10 - 4. It is gu...
C
fc37ef81bb36f3ac07ce2c4c3ec10d98
c64114587e5560b4aa5af6b834cf3002
GNU C
standard output
256 megabytes
train_000.jsonl
[ "geometry", "math" ]
1461947700
["1 2 3 100", "1 1 1 1"]
NoteIn the first example the water fills the cup faster than you can drink from it.In the second example area of the cup's bottom equals to , thus we can conclude that you decrease the level of water by centimeters per second. At the same time water level increases by 1 centimeter per second due to rain. Thus, cup wil...
PASSED
1,100
standard input
1 second
The only line of the input contains four integer numbers d, h, v, e (1 ≤ d, h, v, e ≤ 104), where: d — the diameter of your cylindrical cup, h — the initial level of water in the cup, v — the speed of drinking process from the cup in milliliters per second, e — the growth of water because of rain if you do not dri...
["NO", "YES\n3.659792366325"]
#include<stdio.h> #include<string.h> #include<math.h> const double pi=4*atan(1.0); int main() { int d,h,v,e; double s,r; scanf("%d%d%d%d",&d,&h,&v,&e); r=d/2.0; if(v<=e*pi*r*r) printf("NO\n"); else { printf("YES\n"); s=(pi*r*r*h/(v-pi*r*r*e)); printf("%.8lf\n",s); } return 0; }
A lot of people in Berland hates rain, but you do not. Rain pacifies, puts your thoughts in order. By these years you have developed a good tradition — when it rains, you go on the street and stay silent for a moment, contemplate all around you, enjoy freshness, think about big deeds you have to do. Today everything ha...
If it is impossible to make the cup empty, print "NO" (without quotes). Otherwise print "YES" (without quotes) in the first line. In the second line print a real number — time in seconds needed the cup will be empty. The answer will be considered correct if its relative or absolute error doesn't exceed 10 - 4. It is gu...
C
fc37ef81bb36f3ac07ce2c4c3ec10d98
3978ed90c460947e05d5738628849e91
GNU C
standard output
256 megabytes
train_000.jsonl
[ "geometry", "math" ]
1461947700
["1 2 3 100", "1 1 1 1"]
NoteIn the first example the water fills the cup faster than you can drink from it.In the second example area of the cup's bottom equals to , thus we can conclude that you decrease the level of water by centimeters per second. At the same time water level increases by 1 centimeter per second due to rain. Thus, cup wil...
PASSED
1,100
standard input
1 second
The only line of the input contains four integer numbers d, h, v, e (1 ≤ d, h, v, e ≤ 104), where: d — the diameter of your cylindrical cup, h — the initial level of water in the cup, v — the speed of drinking process from the cup in milliliters per second, e — the growth of water because of rain if you do not dri...
["NO", "YES\n3.659792366325"]
#include<stdio.h> #include<math.h> int main(){ double d,h,x,v,t,e; scanf("%lf%lf%lf%lf",&d,&h,&v,&e); x=M_PI*d*d*e/4; if(x<v){ printf("YES\n"); printf("%lf\n",M_PI*d*d*h/4/(v-x)); } else{ printf("NO\n"); } return 0; }
A lot of people in Berland hates rain, but you do not. Rain pacifies, puts your thoughts in order. By these years you have developed a good tradition — when it rains, you go on the street and stay silent for a moment, contemplate all around you, enjoy freshness, think about big deeds you have to do. Today everything ha...
If it is impossible to make the cup empty, print "NO" (without quotes). Otherwise print "YES" (without quotes) in the first line. In the second line print a real number — time in seconds needed the cup will be empty. The answer will be considered correct if its relative or absolute error doesn't exceed 10 - 4. It is gu...
C
fc37ef81bb36f3ac07ce2c4c3ec10d98
72cff46afcffe4bae65c37697739cced
GNU C
standard output
256 megabytes
train_000.jsonl
[ "geometry", "math" ]
1461947700
["1 2 3 100", "1 1 1 1"]
NoteIn the first example the water fills the cup faster than you can drink from it.In the second example area of the cup's bottom equals to , thus we can conclude that you decrease the level of water by centimeters per second. At the same time water level increases by 1 centimeter per second due to rain. Thus, cup wil...
PASSED
1,100
standard input
1 second
The only line of the input contains four integer numbers d, h, v, e (1 ≤ d, h, v, e ≤ 104), where: d — the diameter of your cylindrical cup, h — the initial level of water in the cup, v — the speed of drinking process from the cup in milliliters per second, e — the growth of water because of rain if you do not dri...
["NO", "YES\n3.659792366325"]
#include<stdio.h> int main() { int d,h,v,e,d2,h2; double pi=acos(-1),t,vol,declevel,uplevel,ans,upvol,downvol; scanf("%d %d %d %d",&d,&h,&v,&e); vol=pi*(d/2.0)*(d/2.0)*h; upvol=pi*(d/2.0)*(d/2.0)*e; downvol=v; if(upvol>=downvol) printf("NO"); else { ans=downvol-upvol; printf("YES\n%.12lf\n",vol/ans);...
A lot of people in Berland hates rain, but you do not. Rain pacifies, puts your thoughts in order. By these years you have developed a good tradition — when it rains, you go on the street and stay silent for a moment, contemplate all around you, enjoy freshness, think about big deeds you have to do. Today everything ha...
If it is impossible to make the cup empty, print "NO" (without quotes). Otherwise print "YES" (without quotes) in the first line. In the second line print a real number — time in seconds needed the cup will be empty. The answer will be considered correct if its relative or absolute error doesn't exceed 10 - 4. It is gu...
C
fc37ef81bb36f3ac07ce2c4c3ec10d98
63f9f4bc0c7246a99f170de96f6d932f
GNU C
standard output
256 megabytes
train_000.jsonl
[ "geometry", "math" ]
1461947700
["1 2 3 100", "1 1 1 1"]
NoteIn the first example the water fills the cup faster than you can drink from it.In the second example area of the cup's bottom equals to , thus we can conclude that you decrease the level of water by centimeters per second. At the same time water level increases by 1 centimeter per second due to rain. Thus, cup wil...
PASSED
1,100
standard input
1 second
The only line of the input contains four integer numbers d, h, v, e (1 ≤ d, h, v, e ≤ 104), where: d — the diameter of your cylindrical cup, h — the initial level of water in the cup, v — the speed of drinking process from the cup in milliliters per second, e — the growth of water because of rain if you do not dri...
["NO", "YES\n3.659792366325"]
#include<stdio.h> int main () { double d,h,v,e,r,n,x,a,b,c; double pi =2 * acos(0.0); scanf("%lf %lf %lf %lf",&d,&h,&v,&e); r=d/2; a=pi*r*r*h; n=pi*r*r*e; if(v<=n) printf("NO"); else { printf("YES\n"); b=v-n; c=a/b; printf("%lf",c); }}
A lot of people in Berland hates rain, but you do not. Rain pacifies, puts your thoughts in order. By these years you have developed a good tradition — when it rains, you go on the street and stay silent for a moment, contemplate all around you, enjoy freshness, think about big deeds you have to do. Today everything ha...
If it is impossible to make the cup empty, print "NO" (without quotes). Otherwise print "YES" (without quotes) in the first line. In the second line print a real number — time in seconds needed the cup will be empty. The answer will be considered correct if its relative or absolute error doesn't exceed 10 - 4. It is gu...
C
fc37ef81bb36f3ac07ce2c4c3ec10d98
dc746580ea1b19119bcb8aeb340f21f7
GNU C
standard output
256 megabytes
train_000.jsonl
[ "geometry", "math" ]
1461947700
["1 2 3 100", "1 1 1 1"]
NoteIn the first example the water fills the cup faster than you can drink from it.In the second example area of the cup's bottom equals to , thus we can conclude that you decrease the level of water by centimeters per second. At the same time water level increases by 1 centimeter per second due to rain. Thus, cup wil...
PASSED
1,100
standard input
1 second
The only line of the input contains four integer numbers d, h, v, e (1 ≤ d, h, v, e ≤ 104), where: d — the diameter of your cylindrical cup, h — the initial level of water in the cup, v — the speed of drinking process from the cup in milliliters per second, e — the growth of water because of rain if you do not dri...
["NO", "YES\n3.659792366325"]
#include<stdio.h> #define pi 3.1415926 int main() { double d,h,v,e; while(scanf("%lf%lf%lf%lf",&d,&h,&v,&e)!=EOF) { d/=2; double t=pi*d*d; t=v/t; if(t<=e) printf("NO\n"); else { printf("YES\n"); t=h/(t-e); printf("%lf\n",t); } } return 0; }
A lot of people in Berland hates rain, but you do not. Rain pacifies, puts your thoughts in order. By these years you have developed a good tradition — when it rains, you go on the street and stay silent for a moment, contemplate all around you, enjoy freshness, think about big deeds you have to do. Today everything ha...
If it is impossible to make the cup empty, print "NO" (without quotes). Otherwise print "YES" (without quotes) in the first line. In the second line print a real number — time in seconds needed the cup will be empty. The answer will be considered correct if its relative or absolute error doesn't exceed 10 - 4. It is gu...
C
fc37ef81bb36f3ac07ce2c4c3ec10d98
65f9ed19252e9b948cc56d989965682a
GNU C
standard output
256 megabytes
train_000.jsonl
[ "geometry", "math" ]
1461947700
["1 2 3 100", "1 1 1 1"]
NoteIn the first example the water fills the cup faster than you can drink from it.In the second example area of the cup's bottom equals to , thus we can conclude that you decrease the level of water by centimeters per second. At the same time water level increases by 1 centimeter per second due to rain. Thus, cup wil...
PASSED
1,100
standard input
1 second
The only line of the input contains four integer numbers d, h, v, e (1 ≤ d, h, v, e ≤ 104), where: d — the diameter of your cylindrical cup, h — the initial level of water in the cup, v — the speed of drinking process from the cup in milliliters per second, e — the growth of water because of rain if you do not dri...
["NO", "YES\n3.659792366325"]
#include<stdio.h> #define pai 3.14159265359 int main() { int i,l,m,n; double v,e,h,d; while(scanf("%lf%lf%lf%lf",&d,&h,&v,&e)!=EOF) { d=d/2; v=v/(d*d*pai); if(e>=v) printf("NO\n"); else { printf("YES\n"); v=v-e; h=h/v; printf("%.12lf\n",h); } } }
A lot of people in Berland hates rain, but you do not. Rain pacifies, puts your thoughts in order. By these years you have developed a good tradition — when it rains, you go on the street and stay silent for a moment, contemplate all around you, enjoy freshness, think about big deeds you have to do. Today everything ha...
If it is impossible to make the cup empty, print "NO" (without quotes). Otherwise print "YES" (without quotes) in the first line. In the second line print a real number — time in seconds needed the cup will be empty. The answer will be considered correct if its relative or absolute error doesn't exceed 10 - 4. It is gu...
C
fc37ef81bb36f3ac07ce2c4c3ec10d98
5383ef8f925260e4371aaf21358f4e1d
GNU C
standard output
256 megabytes
train_000.jsonl
[ "geometry", "math" ]
1461947700
["1 2 3 100", "1 1 1 1"]
NoteIn the first example the water fills the cup faster than you can drink from it.In the second example area of the cup's bottom equals to , thus we can conclude that you decrease the level of water by centimeters per second. At the same time water level increases by 1 centimeter per second due to rain. Thus, cup wil...
PASSED
1,100
standard input
1 second
The only line of the input contains four integer numbers d, h, v, e (1 ≤ d, h, v, e ≤ 104), where: d — the diameter of your cylindrical cup, h — the initial level of water in the cup, v — the speed of drinking process from the cup in milliliters per second, e — the growth of water because of rain if you do not dri...
["NO", "YES\n3.659792366325"]
#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> #define pi 3.14159265 int main() { double ta; double icindekisu,hiz,r,R,h,v,e; scanf("%lf%lf%lf%lf",&R,&h,&v,&e); r=R/2; ta=pi*(r*r); //printf() icindekisu=ta*h; hiz=v-(e*ta); if(hiz<=0){ printf("NO\n"); return 0; } if(hiz>0...
A lot of people in Berland hates rain, but you do not. Rain pacifies, puts your thoughts in order. By these years you have developed a good tradition — when it rains, you go on the street and stay silent for a moment, contemplate all around you, enjoy freshness, think about big deeds you have to do. Today everything ha...
If it is impossible to make the cup empty, print "NO" (without quotes). Otherwise print "YES" (without quotes) in the first line. In the second line print a real number — time in seconds needed the cup will be empty. The answer will be considered correct if its relative or absolute error doesn't exceed 10 - 4. It is gu...
C
fc37ef81bb36f3ac07ce2c4c3ec10d98
c17cc0f2e9089d7c0d8114d5aedcdbf1
GNU C
standard output
256 megabytes
train_000.jsonl
[ "geometry", "math" ]
1461947700
["1 2 3 100", "1 1 1 1"]
NoteIn the first example the water fills the cup faster than you can drink from it.In the second example area of the cup's bottom equals to , thus we can conclude that you decrease the level of water by centimeters per second. At the same time water level increases by 1 centimeter per second due to rain. Thus, cup wil...
PASSED
1,100
standard input
1 second
The only line of the input contains four integer numbers d, h, v, e (1 ≤ d, h, v, e ≤ 104), where: d — the diameter of your cylindrical cup, h — the initial level of water in the cup, v — the speed of drinking process from the cup in milliliters per second, e — the growth of water because of rain if you do not dri...
["NO", "YES\n3.659792366325"]
#include<stdio.h> #include<math.h> #include<conio.h> #define pi 3.14159265358979323846 int main() { int a,h,e,v; double b,g,t; scanf("%d%d%d%d",&a,&h,&v,&e); g=pi*a*a*e/4; if(g<v) { b=pi*h*a*a/4; t=b/(v-g); printf("\nYES\n%lf",t); } else printf("\nNO"); ...
A lot of people in Berland hates rain, but you do not. Rain pacifies, puts your thoughts in order. By these years you have developed a good tradition — when it rains, you go on the street and stay silent for a moment, contemplate all around you, enjoy freshness, think about big deeds you have to do. Today everything ha...
If it is impossible to make the cup empty, print "NO" (without quotes). Otherwise print "YES" (without quotes) in the first line. In the second line print a real number — time in seconds needed the cup will be empty. The answer will be considered correct if its relative or absolute error doesn't exceed 10 - 4. It is gu...
C
fc37ef81bb36f3ac07ce2c4c3ec10d98
657aaeb5fc9f27cfd4783e6f83d3c8c8
GNU C
standard output
256 megabytes
train_000.jsonl
[ "geometry", "math" ]
1461947700
["1 2 3 100", "1 1 1 1"]
NoteIn the first example the water fills the cup faster than you can drink from it.In the second example area of the cup's bottom equals to , thus we can conclude that you decrease the level of water by centimeters per second. At the same time water level increases by 1 centimeter per second due to rain. Thus, cup wil...
PASSED
1,100
standard input
1 second
The only line of the input contains four integer numbers d, h, v, e (1 ≤ d, h, v, e ≤ 104), where: d — the diameter of your cylindrical cup, h — the initial level of water in the cup, v — the speed of drinking process from the cup in milliliters per second, e — the growth of water because of rain if you do not dri...
["NO", "YES\n3.659792366325"]
#include<stdio.h> #include<math.h> int main() { int d,h,v,e; float rate,ans; scanf("%d%d%d%d",&d,&h,&v,&e); rate=4*(float)v/((float)(d*d)*M_PI); //printf("%f",rate); if(rate<(float)e) { printf("NO\n"); } else { printf("YES\n"); ans=(float)h/(rate-(float)e); printf("%.12f\n",ans); } return 0; }
A lot of people in Berland hates rain, but you do not. Rain pacifies, puts your thoughts in order. By these years you have developed a good tradition — when it rains, you go on the street and stay silent for a moment, contemplate all around you, enjoy freshness, think about big deeds you have to do. Today everything ha...
If it is impossible to make the cup empty, print "NO" (without quotes). Otherwise print "YES" (without quotes) in the first line. In the second line print a real number — time in seconds needed the cup will be empty. The answer will be considered correct if its relative or absolute error doesn't exceed 10 - 4. It is gu...
C
fc37ef81bb36f3ac07ce2c4c3ec10d98
16773cc8d5cb67672d8ae32669787203
GNU C
standard output
256 megabytes
train_000.jsonl
[ "geometry", "math" ]
1461947700
["1 2 3 100", "1 1 1 1"]
NoteIn the first example the water fills the cup faster than you can drink from it.In the second example area of the cup's bottom equals to , thus we can conclude that you decrease the level of water by centimeters per second. At the same time water level increases by 1 centimeter per second due to rain. Thus, cup wil...
PASSED
1,100
standard input
1 second
The only line of the input contains four integer numbers d, h, v, e (1 ≤ d, h, v, e ≤ 104), where: d — the diameter of your cylindrical cup, h — the initial level of water in the cup, v — the speed of drinking process from the cup in milliliters per second, e — the growth of water because of rain if you do not dri...
["NO", "YES\n3.659792366325"]
#include<stdio.h> #include<malloc.h> #include<math.h> #define pi 3.14159265358979323846 int main() { int d,v,h,e; scanf("%d %d %d %d",&d,&h,&v,&e); double rate=pi*d*d*e/4.0; rate-=v; if(rate>=0) { printf("NO"); } else{ double t=(pi*d*d*h)/4.0; t/=rate; t*=-1; printf("YES\n%.12lf",t); } retu...
A lot of people in Berland hates rain, but you do not. Rain pacifies, puts your thoughts in order. By these years you have developed a good tradition — when it rains, you go on the street and stay silent for a moment, contemplate all around you, enjoy freshness, think about big deeds you have to do. Today everything ha...
If it is impossible to make the cup empty, print "NO" (without quotes). Otherwise print "YES" (without quotes) in the first line. In the second line print a real number — time in seconds needed the cup will be empty. The answer will be considered correct if its relative or absolute error doesn't exceed 10 - 4. It is gu...
C
fc37ef81bb36f3ac07ce2c4c3ec10d98
9dcbf2e1787baf20b1559a33b3f3e3f4
GNU C
standard output
256 megabytes
train_000.jsonl
[ "geometry", "math" ]
1461947700
["1 2 3 100", "1 1 1 1"]
NoteIn the first example the water fills the cup faster than you can drink from it.In the second example area of the cup's bottom equals to , thus we can conclude that you decrease the level of water by centimeters per second. At the same time water level increases by 1 centimeter per second due to rain. Thus, cup wil...
PASSED
1,100
standard input
1 second
The only line of the input contains four integer numbers d, h, v, e (1 ≤ d, h, v, e ≤ 104), where: d — the diameter of your cylindrical cup, h — the initial level of water in the cup, v — the speed of drinking process from the cup in milliliters per second, e — the growth of water because of rain if you do not dri...
["NO", "YES\n3.659792366325"]
#include<stdio.h> int main(void) { int d,h,v,e; double r,A,V,vh,eh,t,pi=3.1415926535; scanf("%d %d %d %d",&d,&h,&v,&e); r=d/2.0; A=pi*r*r; V=A*h; vh=v/A; eh=e*1.0; if(vh<=eh) { printf("NO"); } else { t=h/(vh-eh); printf("YES\n%0.6lf",t); } return 0; }
A lot of people in Berland hates rain, but you do not. Rain pacifies, puts your thoughts in order. By these years you have developed a good tradition — when it rains, you go on the street and stay silent for a moment, contemplate all around you, enjoy freshness, think about big deeds you have to do. Today everything ha...
If it is impossible to make the cup empty, print "NO" (without quotes). Otherwise print "YES" (without quotes) in the first line. In the second line print a real number — time in seconds needed the cup will be empty. The answer will be considered correct if its relative or absolute error doesn't exceed 10 - 4. It is gu...
C
fc37ef81bb36f3ac07ce2c4c3ec10d98
d4a19ac7c361ee7b6f7961e4f17a8279
GNU C
standard output
256 megabytes
train_000.jsonl
[ "geometry", "math" ]
1461947700
["1 2 3 100", "1 1 1 1"]
NoteIn the first example the water fills the cup faster than you can drink from it.In the second example area of the cup's bottom equals to , thus we can conclude that you decrease the level of water by centimeters per second. At the same time water level increases by 1 centimeter per second due to rain. Thus, cup wil...
PASSED
1,100
standard input
1 second
The only line of the input contains four integer numbers d, h, v, e (1 ≤ d, h, v, e ≤ 104), where: d — the diameter of your cylindrical cup, h — the initial level of water in the cup, v — the speed of drinking process from the cup in milliliters per second, e — the growth of water because of rain if you do not dri...
["NO", "YES\n3.659792366325"]
#include<stdio.h> #define PI 3.14159265358979323846 int main() { double d,h,v,e,area,diff,res; scanf("%lf %lf %lf %lf",&d,&h,&v,&e); area=PI*(d/2)*(d/2); if((v/area)<=e) { printf("NO"); } else { printf("YES\n"); diff=(v/area)-e; res=(1/diff)*h; pri...
A lot of people in Berland hates rain, but you do not. Rain pacifies, puts your thoughts in order. By these years you have developed a good tradition — when it rains, you go on the street and stay silent for a moment, contemplate all around you, enjoy freshness, think about big deeds you have to do. Today everything ha...
If it is impossible to make the cup empty, print "NO" (without quotes). Otherwise print "YES" (without quotes) in the first line. In the second line print a real number — time in seconds needed the cup will be empty. The answer will be considered correct if its relative or absolute error doesn't exceed 10 - 4. It is gu...
C
fc37ef81bb36f3ac07ce2c4c3ec10d98
086360ff81afcd57e35f5452f2f2df67
GNU C
standard output
256 megabytes
train_000.jsonl
[ "geometry", "math" ]
1461947700
["1 2 3 100", "1 1 1 1"]
NoteIn the first example the water fills the cup faster than you can drink from it.In the second example area of the cup's bottom equals to , thus we can conclude that you decrease the level of water by centimeters per second. At the same time water level increases by 1 centimeter per second due to rain. Thus, cup wil...
PASSED
1,100
standard input
1 second
The only line of the input contains four integer numbers d, h, v, e (1 ≤ d, h, v, e ≤ 104), where: d — the diameter of your cylindrical cup, h — the initial level of water in the cup, v — the speed of drinking process from the cup in milliliters per second, e — the growth of water because of rain if you do not dri...
["NO", "YES\n3.659792366325"]
#include <stdio.h> #include <math.h> int main() { float r, volagua, volaumenta, res, d, h, e, v; scanf("%f %f %f %f", &d, &h, &v, &e); r = d/2; volagua = r * r * M_PI * h; volaumenta = r * r * M_PI * e; if (volaumenta >= v) { printf("NO"); } else { res = volagua * (1/(v - volaumenta)); printf("YE...
A lot of people in Berland hates rain, but you do not. Rain pacifies, puts your thoughts in order. By these years you have developed a good tradition — when it rains, you go on the street and stay silent for a moment, contemplate all around you, enjoy freshness, think about big deeds you have to do. Today everything ha...
If it is impossible to make the cup empty, print "NO" (without quotes). Otherwise print "YES" (without quotes) in the first line. In the second line print a real number — time in seconds needed the cup will be empty. The answer will be considered correct if its relative or absolute error doesn't exceed 10 - 4. It is gu...
C
fc37ef81bb36f3ac07ce2c4c3ec10d98
6c1a3d9c4dfb565d0d4202d43321e319
GNU C
standard output
256 megabytes
train_000.jsonl
[ "geometry", "math" ]
1461947700
["1 2 3 100", "1 1 1 1"]
NoteIn the first example the water fills the cup faster than you can drink from it.In the second example area of the cup's bottom equals to , thus we can conclude that you decrease the level of water by centimeters per second. At the same time water level increases by 1 centimeter per second due to rain. Thus, cup wil...
PASSED
1,100
standard input
1 second
The only line of the input contains four integer numbers d, h, v, e (1 ≤ d, h, v, e ≤ 104), where: d — the diameter of your cylindrical cup, h — the initial level of water in the cup, v — the speed of drinking process from the cup in milliliters per second, e — the growth of water because of rain if you do not dri...
["NO", "YES\n3.659792366325"]
#include<stdio.h> int main(void) { float pi=3.141592653589; int d,h,v,e; scanf("%d%d%d%d",&d,&h,&v,&e); if(pi*d*d*e/4>=v) { printf("NO\n"); } else { printf("YES\n"); printf("%f\n",h*pi*d*d/(v*4-(pi*d*d*e))); } return 0; }
A lot of people in Berland hates rain, but you do not. Rain pacifies, puts your thoughts in order. By these years you have developed a good tradition — when it rains, you go on the street and stay silent for a moment, contemplate all around you, enjoy freshness, think about big deeds you have to do. Today everything ha...
If it is impossible to make the cup empty, print "NO" (without quotes). Otherwise print "YES" (without quotes) in the first line. In the second line print a real number — time in seconds needed the cup will be empty. The answer will be considered correct if its relative or absolute error doesn't exceed 10 - 4. It is gu...
C
fc37ef81bb36f3ac07ce2c4c3ec10d98
37010ddb9cc46d0ce0621d918159b297
GNU C
standard output
256 megabytes
train_000.jsonl
[ "geometry", "math" ]
1461947700
["1 2 3 100", "1 1 1 1"]
NoteIn the first example the water fills the cup faster than you can drink from it.In the second example area of the cup's bottom equals to , thus we can conclude that you decrease the level of water by centimeters per second. At the same time water level increases by 1 centimeter per second due to rain. Thus, cup wil...
PASSED
1,100
standard input
1 second
The only line of the input contains four integer numbers d, h, v, e (1 ≤ d, h, v, e ≤ 104), where: d — the diameter of your cylindrical cup, h — the initial level of water in the cup, v — the speed of drinking process from the cup in milliliters per second, e — the growth of water because of rain if you do not dri...
["NO", "YES\n3.659792366325"]
#include <stdio.h> #define PI 3.1415926535897 double d,h,v,e; int main() { scanf("%lf%lf%lf%lf",&d,&h,&v,&e); if(PI*(d/2)*(d/2)*e>=v) printf("NO"); else { v -= PI*(d/2)*(d/2)*e; printf("YES\n%.12f",PI*(d/2)*(d/2)*h/v); } return 0; }
A lot of people in Berland hates rain, but you do not. Rain pacifies, puts your thoughts in order. By these years you have developed a good tradition — when it rains, you go on the street and stay silent for a moment, contemplate all around you, enjoy freshness, think about big deeds you have to do. Today everything ha...
If it is impossible to make the cup empty, print "NO" (without quotes). Otherwise print "YES" (without quotes) in the first line. In the second line print a real number — time in seconds needed the cup will be empty. The answer will be considered correct if its relative or absolute error doesn't exceed 10 - 4. It is gu...
C
fc37ef81bb36f3ac07ce2c4c3ec10d98
28a2444de787361d6f24c94cf5f62c16
GNU C
standard output
256 megabytes
train_000.jsonl
[ "geometry", "math" ]
1461947700
["1 2 3 100", "1 1 1 1"]
NoteIn the first example the water fills the cup faster than you can drink from it.In the second example area of the cup's bottom equals to , thus we can conclude that you decrease the level of water by centimeters per second. At the same time water level increases by 1 centimeter per second due to rain. Thus, cup wil...
PASSED
1,100
standard input
1 second
The only line of the input contains four integer numbers d, h, v, e (1 ≤ d, h, v, e ≤ 104), where: d — the diameter of your cylindrical cup, h — the initial level of water in the cup, v — the speed of drinking process from the cup in milliliters per second, e — the growth of water because of rain if you do not dri...
["NO", "YES\n3.659792366325"]
#include<stdio.h> int main() { double pi =2 * acos(0.0); double d,h,v,e; scanf("%lf %lf %lf %lf",&d,&h,&v,&e); double a= pi*(d/2)*(d/2); double g=e*a; if(g>=v){printf("NO");} else { double ans; printf("YES\n"); ans=(h*a)/(v-g); printf("%.12lf",ans);...
A lot of people in Berland hates rain, but you do not. Rain pacifies, puts your thoughts in order. By these years you have developed a good tradition — when it rains, you go on the street and stay silent for a moment, contemplate all around you, enjoy freshness, think about big deeds you have to do. Today everything ha...
If it is impossible to make the cup empty, print "NO" (without quotes). Otherwise print "YES" (without quotes) in the first line. In the second line print a real number — time in seconds needed the cup will be empty. The answer will be considered correct if its relative or absolute error doesn't exceed 10 - 4. It is gu...
C
fc37ef81bb36f3ac07ce2c4c3ec10d98
320611a65134338aecc6486dfc487639
GNU C
standard output
256 megabytes
train_000.jsonl
[ "geometry", "math" ]
1461947700
["1 2 3 100", "1 1 1 1"]
NoteIn the first example the water fills the cup faster than you can drink from it.In the second example area of the cup's bottom equals to , thus we can conclude that you decrease the level of water by centimeters per second. At the same time water level increases by 1 centimeter per second due to rain. Thus, cup wil...
PASSED
1,100
standard input
1 second
The only line of the input contains four integer numbers d, h, v, e (1 ≤ d, h, v, e ≤ 104), where: d — the diameter of your cylindrical cup, h — the initial level of water in the cup, v — the speed of drinking process from the cup in milliliters per second, e — the growth of water because of rain if you do not dri...
["NO", "YES\n3.659792366325"]
#include <stdio.h> #include <stdlib.h> #include <math.h> int main() { int d,h,v,e; scanf("%d%d%d%d",&d,&h,&v,&e); double dij=(double)d/2; //printf("%lf",dij); double v2=dij*dij*M_PI*e; // printf("v2=%lf",v2); if (v2>=v) printf("NO\n"); else { printf("YES\n"); ...
A lot of people in Berland hates rain, but you do not. Rain pacifies, puts your thoughts in order. By these years you have developed a good tradition — when it rains, you go on the street and stay silent for a moment, contemplate all around you, enjoy freshness, think about big deeds you have to do. Today everything ha...
If it is impossible to make the cup empty, print "NO" (without quotes). Otherwise print "YES" (without quotes) in the first line. In the second line print a real number — time in seconds needed the cup will be empty. The answer will be considered correct if its relative or absolute error doesn't exceed 10 - 4. It is gu...
C
fc37ef81bb36f3ac07ce2c4c3ec10d98
43f172263241c975920df7bedc2948ad
GNU C
standard output
256 megabytes
train_000.jsonl
[ "geometry", "math" ]
1461947700
["1 2 3 100", "1 1 1 1"]
NoteIn the first example the water fills the cup faster than you can drink from it.In the second example area of the cup's bottom equals to , thus we can conclude that you decrease the level of water by centimeters per second. At the same time water level increases by 1 centimeter per second due to rain. Thus, cup wil...
PASSED
1,100
standard input
1 second
The only line of the input contains four integer numbers d, h, v, e (1 ≤ d, h, v, e ≤ 104), where: d — the diameter of your cylindrical cup, h — the initial level of water in the cup, v — the speed of drinking process from the cup in milliliters per second, e — the growth of water because of rain if you do not dri...
["NO", "YES\n3.659792366325"]
#include<stdio.h> int main() { double d,e,h,v; double p=3.14159265358979,x,t; scanf("%lf %lf %lf %lf",&d,&h,&v,&e); x=0.25*p*d*d*e; t=h/(((4*v)/(p*d*d))-e); if(x>v)printf("NO"); else printf("YES\n%.12lf",t); return 0; }
A lot of people in Berland hates rain, but you do not. Rain pacifies, puts your thoughts in order. By these years you have developed a good tradition — when it rains, you go on the street and stay silent for a moment, contemplate all around you, enjoy freshness, think about big deeds you have to do. Today everything ha...
If it is impossible to make the cup empty, print "NO" (without quotes). Otherwise print "YES" (without quotes) in the first line. In the second line print a real number — time in seconds needed the cup will be empty. The answer will be considered correct if its relative or absolute error doesn't exceed 10 - 4. It is gu...
C
fc37ef81bb36f3ac07ce2c4c3ec10d98
4dcad9479b02cb89ee91b4fd5e8318e2
GNU C
standard output
256 megabytes
train_000.jsonl
[ "geometry", "math" ]
1461947700
["1 2 3 100", "1 1 1 1"]
NoteIn the first example the water fills the cup faster than you can drink from it.In the second example area of the cup's bottom equals to , thus we can conclude that you decrease the level of water by centimeters per second. At the same time water level increases by 1 centimeter per second due to rain. Thus, cup wil...
PASSED
1,100
standard input
1 second
The only line of the input contains four integer numbers d, h, v, e (1 ≤ d, h, v, e ≤ 104), where: d — the diameter of your cylindrical cup, h — the initial level of water in the cup, v — the speed of drinking process from the cup in milliliters per second, e — the growth of water because of rain if you do not dri...
["NO", "YES\n3.659792366325"]
#include <stdio.h> #include <stdlib.h> #define PI 3.14159265358979323846 int main() { double i,j,k,l,m,n,v,h,e,d,val; double a,s,t; scanf("%lf %lf %lf %lf",&d,&h,&v,&e); a=(PI*(d*d))/4; s=v/a; if (e>s) { printf("NO"); return 0; } t=(h)/(s-e); if (t>10000) ...
A lot of people in Berland hates rain, but you do not. Rain pacifies, puts your thoughts in order. By these years you have developed a good tradition — when it rains, you go on the street and stay silent for a moment, contemplate all around you, enjoy freshness, think about big deeds you have to do. Today everything ha...
If it is impossible to make the cup empty, print "NO" (without quotes). Otherwise print "YES" (without quotes) in the first line. In the second line print a real number — time in seconds needed the cup will be empty. The answer will be considered correct if its relative or absolute error doesn't exceed 10 - 4. It is gu...
C
fc37ef81bb36f3ac07ce2c4c3ec10d98
06b9e0ed912fc0b939b76b69d1fe1a10
GNU C
standard output
256 megabytes
train_000.jsonl
[ "geometry", "math" ]
1461947700
["1 2 3 100", "1 1 1 1"]
NoteIn the first example the water fills the cup faster than you can drink from it.In the second example area of the cup's bottom equals to , thus we can conclude that you decrease the level of water by centimeters per second. At the same time water level increases by 1 centimeter per second due to rain. Thus, cup wil...
PASSED
1,100
standard input
1 second
The only line of the input contains four integer numbers d, h, v, e (1 ≤ d, h, v, e ≤ 104), where: d — the diameter of your cylindrical cup, h — the initial level of water in the cup, v — the speed of drinking process from the cup in milliliters per second, e — the growth of water because of rain if you do not dri...
["NO", "YES\n3.659792366325"]
#include<stdio.h> #define pi 3.14159265359 int main(){ int d, h, v, e; scanf("%d %d %d %d", &d, &h, &v, &e); double vol = (pi * d * d * 1.0)/4.0; double rise = vol * e; //printf("%f ", rise); double fall = v * 1.0; //printf("%f ", fall); if(fall > rise){ printf("YES\n"); double ans = (vol * h)/(fall ...
A lot of people in Berland hates rain, but you do not. Rain pacifies, puts your thoughts in order. By these years you have developed a good tradition — when it rains, you go on the street and stay silent for a moment, contemplate all around you, enjoy freshness, think about big deeds you have to do. Today everything ha...
If it is impossible to make the cup empty, print "NO" (without quotes). Otherwise print "YES" (without quotes) in the first line. In the second line print a real number — time in seconds needed the cup will be empty. The answer will be considered correct if its relative or absolute error doesn't exceed 10 - 4. It is gu...
C
fc37ef81bb36f3ac07ce2c4c3ec10d98
02ef4b3f298a46778bc0e2b67c9a90db
GNU C
standard output
256 megabytes
train_000.jsonl
[ "geometry", "math" ]
1461947700
["1 2 3 100", "1 1 1 1"]
NoteIn the first example the water fills the cup faster than you can drink from it.In the second example area of the cup's bottom equals to , thus we can conclude that you decrease the level of water by centimeters per second. At the same time water level increases by 1 centimeter per second due to rain. Thus, cup wil...
PASSED
1,100
standard input
1 second
The only line of the input contains four integer numbers d, h, v, e (1 ≤ d, h, v, e ≤ 104), where: d — the diameter of your cylindrical cup, h — the initial level of water in the cup, v — the speed of drinking process from the cup in milliliters per second, e — the growth of water because of rain if you do not dri...
["NO", "YES\n3.659792366325"]
#include<stdio.h> #define pi 3.14159265359 int main() { long int d,h,v,e; float x; scanf("%ld%ld%ld%ld",&d,&h,&v,&e); x=(float)((v*4)/(pi*d*d))-e; x<=0?printf("NO"):printf("YES\n%lf",h/x); }
A lot of people in Berland hates rain, but you do not. Rain pacifies, puts your thoughts in order. By these years you have developed a good tradition — when it rains, you go on the street and stay silent for a moment, contemplate all around you, enjoy freshness, think about big deeds you have to do. Today everything ha...
If it is impossible to make the cup empty, print "NO" (without quotes). Otherwise print "YES" (without quotes) in the first line. In the second line print a real number — time in seconds needed the cup will be empty. The answer will be considered correct if its relative or absolute error doesn't exceed 10 - 4. It is gu...
C
fc37ef81bb36f3ac07ce2c4c3ec10d98
fc81362bb034e78b0413043cab1d69c0
GNU C
standard output
256 megabytes
train_000.jsonl
[ "geometry", "math" ]
1461947700
["1 2 3 100", "1 1 1 1"]
NoteIn the first example the water fills the cup faster than you can drink from it.In the second example area of the cup's bottom equals to , thus we can conclude that you decrease the level of water by centimeters per second. At the same time water level increases by 1 centimeter per second due to rain. Thus, cup wil...
PASSED
1,100
standard input
1 second
The only line of the input contains four integer numbers d, h, v, e (1 ≤ d, h, v, e ≤ 104), where: d — the diameter of your cylindrical cup, h — the initial level of water in the cup, v — the speed of drinking process from the cup in milliliters per second, e — the growth of water because of rain if you do not dri...
["NO", "YES\n3.659792366325"]
#include <math.h> #include <stdio.h> int main() { int d, h, v, e; double r, hv; scanf("%d%d%d%d", &d, &h, &v, &e); r = (double) d / 2; hv = (double) v / (r * r * M_PI); if (e >= hv) printf("NO\n"); else { printf("YES\n"); printf("%.12lf\n", h / (hv - e)); } return 0; }
A lot of people in Berland hates rain, but you do not. Rain pacifies, puts your thoughts in order. By these years you have developed a good tradition — when it rains, you go on the street and stay silent for a moment, contemplate all around you, enjoy freshness, think about big deeds you have to do. Today everything ha...
If it is impossible to make the cup empty, print "NO" (without quotes). Otherwise print "YES" (without quotes) in the first line. In the second line print a real number — time in seconds needed the cup will be empty. The answer will be considered correct if its relative or absolute error doesn't exceed 10 - 4. It is gu...
C
fc37ef81bb36f3ac07ce2c4c3ec10d98
358d7054ec94a3c48a07ab72dd74321d
GNU C
standard output
256 megabytes
train_000.jsonl
[ "geometry", "math" ]
1461947700
["1 2 3 100", "1 1 1 1"]
NoteIn the first example the water fills the cup faster than you can drink from it.In the second example area of the cup's bottom equals to , thus we can conclude that you decrease the level of water by centimeters per second. At the same time water level increases by 1 centimeter per second due to rain. Thus, cup wil...
PASSED
1,100
standard input
1 second
The only line of the input contains four integer numbers d, h, v, e (1 ≤ d, h, v, e ≤ 104), where: d — the diameter of your cylindrical cup, h — the initial level of water in the cup, v — the speed of drinking process from the cup in milliliters per second, e — the growth of water because of rain if you do not dri...
["NO", "YES\n3.659792366325"]
#include<stdio.h> #include<math.h> int main() { long long int d, h, v, e; double H, t, pi=acos(-1); scanf("%I64d %I64d %I64d %I64d", &d, &h, &v, &e); H=(4.0*v)/(pi*d*d); t=h/(H-e); if (H<e) printf("NO"); else { printf("YES\n"); printf("%.12lf", t); } ...
A lot of people in Berland hates rain, but you do not. Rain pacifies, puts your thoughts in order. By these years you have developed a good tradition — when it rains, you go on the street and stay silent for a moment, contemplate all around you, enjoy freshness, think about big deeds you have to do. Today everything ha...
If it is impossible to make the cup empty, print "NO" (without quotes). Otherwise print "YES" (without quotes) in the first line. In the second line print a real number — time in seconds needed the cup will be empty. The answer will be considered correct if its relative or absolute error doesn't exceed 10 - 4. It is gu...
C
fc37ef81bb36f3ac07ce2c4c3ec10d98
e6d37a243060f54e2c8074ca7a9c383a
GNU C
standard output
256 megabytes
train_000.jsonl
[ "geometry", "math" ]
1461947700
["1 2 3 100", "1 1 1 1"]
NoteIn the first example the water fills the cup faster than you can drink from it.In the second example area of the cup's bottom equals to , thus we can conclude that you decrease the level of water by centimeters per second. At the same time water level increases by 1 centimeter per second due to rain. Thus, cup wil...
PASSED
1,100
standard input
1 second
The only line of the input contains four integer numbers d, h, v, e (1 ≤ d, h, v, e ≤ 104), where: d — the diameter of your cylindrical cup, h — the initial level of water in the cup, v — the speed of drinking process from the cup in milliliters per second, e — the growth of water because of rain if you do not dri...
["NO", "YES\n3.659792366325"]
#include <stdio.h> #define PI 3.14159265359 int main(){ long int d, h, v, e; scanf("%ld", &d); scanf("%ld", &h); scanf("%ld", &v); scanf("%ld", &e); if ((v/(PI*((float)d/2)*((float)d/2)))>e){ if(((PI*((float)d/2)*((float)d/2)*h)/(v-e*PI*((float)d/2)*((float)d/2)))<=10000){ p...
The new ITone 6 has been released recently and George got really keen to buy it. Unfortunately, he didn't have enough money, so George was going to work as a programmer. Now he faced the following problem at the work.Given a sequence of n integers p1, p2, ..., pn. You are to choose k pairs of integers: [l1, r1], [l2, r...
Print an integer in a single line — the maximum possible value of sum.
C
ee3c228cc817536bf6c10ea4508d786f
fdc73b37dad79fd3163ad3c788ae6cea
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1411054200
["5 2 1\n1 2 3 4 5", "7 1 3\n2 10 7 18 5 33 0"]
null
PASSED
1,700
standard input
1 second
The first line contains three integers n, m and k (1 ≤ (m × k) ≤ n ≤ 5000). The second line contains n integers p1, p2, ..., pn (0 ≤ pi ≤ 109).
["9", "61"]
#include <stdio.h> #include <stdlib.h> long long int p[5005]={0}; long long int sum[5005]={0}; long long int f[5005][5005]={0}; long long int max(long long int a,long long int b){ if(a>b) return a; else return b; } int main(){ int i,j,n,m,k; scanf("%d%d%d",&n,&m,&k); /*int *p = (int *)malloc(n*sizeof(in...
The new ITone 6 has been released recently and George got really keen to buy it. Unfortunately, he didn't have enough money, so George was going to work as a programmer. Now he faced the following problem at the work.Given a sequence of n integers p1, p2, ..., pn. You are to choose k pairs of integers: [l1, r1], [l2, r...
Print an integer in a single line — the maximum possible value of sum.
C
ee3c228cc817536bf6c10ea4508d786f
12443e675c3deb77c3d9bd5e21010515
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1411054200
["5 2 1\n1 2 3 4 5", "7 1 3\n2 10 7 18 5 33 0"]
null
PASSED
1,700
standard input
1 second
The first line contains three integers n, m and k (1 ≤ (m × k) ≤ n ≤ 5000). The second line contains n integers p1, p2, ..., pn (0 ≤ pi ≤ 109).
["9", "61"]
#include<stdio.h> long long int dp[5001][5002]; int main() { long long int n,m,k,max=0; scanf("%lld%lld%lld",&n,&m,&k); long long int arr[5001],i,a,j; arr[0]=0; for(i=1;i<=n;i++) { scanf("%lld",&a); arr[i]=arr[i-1]+a; } for(i=0;i<=k;i++) { for(j=0;j<=n+1;j++) ...
The new ITone 6 has been released recently and George got really keen to buy it. Unfortunately, he didn't have enough money, so George was going to work as a programmer. Now he faced the following problem at the work.Given a sequence of n integers p1, p2, ..., pn. You are to choose k pairs of integers: [l1, r1], [l2, r...
Print an integer in a single line — the maximum possible value of sum.
C
ee3c228cc817536bf6c10ea4508d786f
b0865ac220555ca71f2cd8fb6058305b
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1411054200
["5 2 1\n1 2 3 4 5", "7 1 3\n2 10 7 18 5 33 0"]
null
PASSED
1,700
standard input
1 second
The first line contains three integers n, m and k (1 ≤ (m × k) ≤ n ≤ 5000). The second line contains n integers p1, p2, ..., pn (0 ≤ pi ≤ 109).
["9", "61"]
#include<stdio.h> #include<stdlib.h> int a[5100]; long long d[5010][5100]; int main(void) { int i,j,p,n,m; long long sump; while(scanf("%d%d%d",&n,&m,&p)==3) { for(i=1;i<=n;i++) { scanf("%d",&a[i]); } for(i=1;i<=n;i++) { for(j=1;j<=p;j++) { d[i][j]=-1; } } sump=0; for(j=1;j<=m;j++) ...
The new ITone 6 has been released recently and George got really keen to buy it. Unfortunately, he didn't have enough money, so George was going to work as a programmer. Now he faced the following problem at the work.Given a sequence of n integers p1, p2, ..., pn. You are to choose k pairs of integers: [l1, r1], [l2, r...
Print an integer in a single line — the maximum possible value of sum.
C
ee3c228cc817536bf6c10ea4508d786f
d138a1b2b469e909ebc5ff68827ff8e7
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1411054200
["5 2 1\n1 2 3 4 5", "7 1 3\n2 10 7 18 5 33 0"]
null
PASSED
1,700
standard input
1 second
The first line contains three integers n, m and k (1 ≤ (m × k) ≤ n ≤ 5000). The second line contains n integers p1, p2, ..., pn (0 ≤ pi ≤ 109).
["9", "61"]
#include<stdio.h> #include<stdlib.h> #define ll long long ll dp[5005][5005]; ll sum[5005]; int main() { int n,m,k,i,j; ll x,mx; scanf("%d %d %d",&n,&m,&k); sum[0]=0; //memset(dp,0,sizeof(dp)); for(i=1;i<=n;i++) { scanf("%I64d",&x); sum[i]=sum[i-1]+x; } for(i=0;i<= (...
The new ITone 6 has been released recently and George got really keen to buy it. Unfortunately, he didn't have enough money, so George was going to work as a programmer. Now he faced the following problem at the work.Given a sequence of n integers p1, p2, ..., pn. You are to choose k pairs of integers: [l1, r1], [l2, r...
Print an integer in a single line — the maximum possible value of sum.
C
ee3c228cc817536bf6c10ea4508d786f
1e25b73730cbb42b8c59ba56ea074c71
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1411054200
["5 2 1\n1 2 3 4 5", "7 1 3\n2 10 7 18 5 33 0"]
null
PASSED
1,700
standard input
1 second
The first line contains three integers n, m and k (1 ≤ (m × k) ≤ n ≤ 5000). The second line contains n integers p1, p2, ..., pn (0 ≤ pi ≤ 109).
["9", "61"]
#include<stdio.h> #include<stdlib.h> #define ll long long ll dp[5005][2]; ll sum[5005]; ll max(ll a,ll b) { return a>b?a:b; } int main() { int n,m,k,i,j,stat; ll x,mx; scanf("%d %d %d",&n,&m,&k); sum[0]=0; //memset(dp,0,sizeof(dp)); for(i=1;i<=n;i++) { scanf("%I64d",&x); ...
The new ITone 6 has been released recently and George got really keen to buy it. Unfortunately, he didn't have enough money, so George was going to work as a programmer. Now he faced the following problem at the work.Given a sequence of n integers p1, p2, ..., pn. You are to choose k pairs of integers: [l1, r1], [l2, r...
Print an integer in a single line — the maximum possible value of sum.
C
ee3c228cc817536bf6c10ea4508d786f
47ee725889aa42bbb42aee3a8bd244a8
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1411054200
["5 2 1\n1 2 3 4 5", "7 1 3\n2 10 7 18 5 33 0"]
null
PASSED
1,700
standard input
1 second
The first line contains three integers n, m and k (1 ≤ (m × k) ≤ n ≤ 5000). The second line contains n integers p1, p2, ..., pn (0 ≤ pi ≤ 109).
["9", "61"]
#include <stdio.h> #include <string.h> #define ll long long #define MAXN 5050 ll dp[MAXN][MAXN], p[MAXN], c[MAXN]; ll imax(ll a, ll b){ return a > b ? a : b; } int main(){ int i, j, n, m, k; while(scanf("%d %d %d", &n, &m, &k) != EOF){ c[0] = 0; for(i = 1; i <= n; i++){ scan...
The new ITone 6 has been released recently and George got really keen to buy it. Unfortunately, he didn't have enough money, so George was going to work as a programmer. Now he faced the following problem at the work.Given a sequence of n integers p1, p2, ..., pn. You are to choose k pairs of integers: [l1, r1], [l2, r...
Print an integer in a single line — the maximum possible value of sum.
C
ee3c228cc817536bf6c10ea4508d786f
af2ea1880623c4fe574349431e092f9f
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1411054200
["5 2 1\n1 2 3 4 5", "7 1 3\n2 10 7 18 5 33 0"]
null
PASSED
1,700
standard input
1 second
The first line contains three integers n, m and k (1 ≤ (m × k) ≤ n ≤ 5000). The second line contains n integers p1, p2, ..., pn (0 ≤ pi ≤ 109).
["9", "61"]
#include <stdio.h> #include <string.h> #include <limits.h> long long dp[5005][5005]; long long A[5005]; long long pre[5005]; long long max(long long a,long long b) { if(a>b) return a; else return b; } long long rec(long long start,long long int m,long long int n,long long int k) { //when you are at the start o...
The new ITone 6 has been released recently and George got really keen to buy it. Unfortunately, he didn't have enough money, so George was going to work as a programmer. Now he faced the following problem at the work.Given a sequence of n integers p1, p2, ..., pn. You are to choose k pairs of integers: [l1, r1], [l2, r...
Print an integer in a single line — the maximum possible value of sum.
C
ee3c228cc817536bf6c10ea4508d786f
38eda133bf8a44f875380bd05b09aff9
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1411054200
["5 2 1\n1 2 3 4 5", "7 1 3\n2 10 7 18 5 33 0"]
null
PASSED
1,700
standard input
1 second
The first line contains three integers n, m and k (1 ≤ (m × k) ≤ n ≤ 5000). The second line contains n integers p1, p2, ..., pn (0 ≤ pi ≤ 109).
["9", "61"]
#include<stdio.h> #include<stdbool.h> long long int max[5001][5001],sum2[5001]; bool yes[5001][5001]; int n,m,k; long long int dp(int start,int k2) { if(k2==0||n-start<m*k2) return 0; if(yes[start][k2]==1) return max[start][k2]; int i; long long int max2,a=dp(start+1,k2...
The new ITone 6 has been released recently and George got really keen to buy it. Unfortunately, he didn't have enough money, so George was going to work as a programmer. Now he faced the following problem at the work.Given a sequence of n integers p1, p2, ..., pn. You are to choose k pairs of integers: [l1, r1], [l2, r...
Print an integer in a single line — the maximum possible value of sum.
C
ee3c228cc817536bf6c10ea4508d786f
a8598c77b9b3aaa554f1c26f2b79ac42
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1411054200
["5 2 1\n1 2 3 4 5", "7 1 3\n2 10 7 18 5 33 0"]
null
PASSED
1,700
standard input
1 second
The first line contains three integers n, m and k (1 ≤ (m × k) ≤ n ≤ 5000). The second line contains n integers p1, p2, ..., pn (0 ≤ pi ≤ 109).
["9", "61"]
#include<stdio.h> #define INF -6e12 typedef long long int LL; int n,m; LL sum[5005]; LL arr[5005]; LL memo[5005][5005]; char calculated[5005][5005]; LL MAX(LL a,LL b) { return a > b ? a : b; } LL dp(int index,int k) { // Meaning that we have crossed the array boundary but we still have some // m sized ranges ...
The new ITone 6 has been released recently and George got really keen to buy it. Unfortunately, he didn't have enough money, so George was going to work as a programmer. Now he faced the following problem at the work.Given a sequence of n integers p1, p2, ..., pn. You are to choose k pairs of integers: [l1, r1], [l2, r...
Print an integer in a single line — the maximum possible value of sum.
C
ee3c228cc817536bf6c10ea4508d786f
f2bfb12aa5f93768a58405b21e0baa46
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1411054200
["5 2 1\n1 2 3 4 5", "7 1 3\n2 10 7 18 5 33 0"]
null
PASSED
1,700
standard input
1 second
The first line contains three integers n, m and k (1 ≤ (m × k) ≤ n ≤ 5000). The second line contains n integers p1, p2, ..., pn (0 ≤ pi ≤ 109).
["9", "61"]
#include<stdio.h> #define LL long long LL sum[5010]; LL dp[5010][5010]; LL max(LL a,LL b) { return a>b?a:b; } int main() { int n,k,m,i,num,j; scanf("%d %d %d",&n,&m,&k); sum[0]=0; for(i=1;i<=n;++i) { scanf("%d",&num); sum[i]=sum[i-1]+num; } for(i=m;i<=n;++i) { ...
The new ITone 6 has been released recently and George got really keen to buy it. Unfortunately, he didn't have enough money, so George was going to work as a programmer. Now he faced the following problem at the work.Given a sequence of n integers p1, p2, ..., pn. You are to choose k pairs of integers: [l1, r1], [l2, r...
Print an integer in a single line — the maximum possible value of sum.
C
ee3c228cc817536bf6c10ea4508d786f
3b5d73412b0af8def403d0968b063a1d
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1411054200
["5 2 1\n1 2 3 4 5", "7 1 3\n2 10 7 18 5 33 0"]
null
PASSED
1,700
standard input
1 second
The first line contains three integers n, m and k (1 ≤ (m × k) ≤ n ≤ 5000). The second line contains n integers p1, p2, ..., pn (0 ≤ pi ≤ 109).
["9", "61"]
#include<stdio.h> int main() { long long int n,i,j,k,h,t,m; long long int prev[5001],cur[5001]; long long int b[5001],sum[5001],count; scanf("%lld %lld %lld",&n,&m,&k); for(i=0;i<n;i++) scanf("%lld",&b[i]); for(i=0;i<n;i++) prev[i]=0; count=0; if(n==1) printf("%lld\n",b[0]); else { for(i=0;i<m-1;i++) { sum[i]=0; count+...
The new ITone 6 has been released recently and George got really keen to buy it. Unfortunately, he didn't have enough money, so George was going to work as a programmer. Now he faced the following problem at the work.Given a sequence of n integers p1, p2, ..., pn. You are to choose k pairs of integers: [l1, r1], [l2, r...
Print an integer in a single line — the maximum possible value of sum.
C
ee3c228cc817536bf6c10ea4508d786f
f533afa7b363ef5fd9ed21cbe334ca60
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1411054200
["5 2 1\n1 2 3 4 5", "7 1 3\n2 10 7 18 5 33 0"]
null
PASSED
1,700
standard input
1 second
The first line contains three integers n, m and k (1 ≤ (m × k) ≤ n ≤ 5000). The second line contains n integers p1, p2, ..., pn (0 ≤ pi ≤ 109).
["9", "61"]
#include <stdio.h> #include <stdlib.h> int main() { int no,m,k,i,j; scanf("%d %d %d",&no,&m,&k); int a[5002]={0}; long long dp[5001][5001]={0}; long long sum[5002]={0}; for(i=1;i<=no;i++) scanf("%d",&a[i]); long long sum1=0; j=1; for(i=no;j<=m;i--) {sum1=sum1+a[i];j++;}/...
The new ITone 6 has been released recently and George got really keen to buy it. Unfortunately, he didn't have enough money, so George was going to work as a programmer. Now he faced the following problem at the work.Given a sequence of n integers p1, p2, ..., pn. You are to choose k pairs of integers: [l1, r1], [l2, r...
Print an integer in a single line — the maximum possible value of sum.
C
ee3c228cc817536bf6c10ea4508d786f
895e252cd5b6922508d23af8d435ba1a
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1411054200
["5 2 1\n1 2 3 4 5", "7 1 3\n2 10 7 18 5 33 0"]
null
PASSED
1,700
standard input
1 second
The first line contains three integers n, m and k (1 ≤ (m × k) ≤ n ≤ 5000). The second line contains n integers p1, p2, ..., pn (0 ≤ pi ≤ 109).
["9", "61"]
#include<stdio.h> long long int array[5001][5001]; long long int max(long long int a,long long int b) { if(a>b) return a; else return b; } long long int railway(long long int b[],long long int index,long long int k,long long int m) { if(k==0|| index<0) return 0 ; if(array[index][...
The new ITone 6 has been released recently and George got really keen to buy it. Unfortunately, he didn't have enough money, so George was going to work as a programmer. Now he faced the following problem at the work.Given a sequence of n integers p1, p2, ..., pn. You are to choose k pairs of integers: [l1, r1], [l2, r...
Print an integer in a single line — the maximum possible value of sum.
C
ee3c228cc817536bf6c10ea4508d786f
1fbcd971de226279345a7fdab17f02be
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1411054200
["5 2 1\n1 2 3 4 5", "7 1 3\n2 10 7 18 5 33 0"]
null
PASSED
1,700
standard input
1 second
The first line contains three integers n, m and k (1 ≤ (m × k) ≤ n ≤ 5000). The second line contains n integers p1, p2, ..., pn (0 ≤ pi ≤ 109).
["9", "61"]
#include <stdio.h> #include <stdlib.h> #define max(a,b) (a>b?a:b) int main(){ long temp[5010]; long long a[5010], arr[5010][5010]; int n,m,k,i,j; while(scanf("%d%d%d" , &n,&m,&k) != EOF){ int ans = 0; a[0] = 0; for(i = 1; i <= n; i++) { scanf("%ld", &temp[i]); a[i] = a[i - 1] +...
The new ITone 6 has been released recently and George got really keen to buy it. Unfortunately, he didn't have enough money, so George was going to work as a programmer. Now he faced the following problem at the work.Given a sequence of n integers p1, p2, ..., pn. You are to choose k pairs of integers: [l1, r1], [l2, r...
Print an integer in a single line — the maximum possible value of sum.
C
ee3c228cc817536bf6c10ea4508d786f
b10bdb287cee3d59c5345c54c437b69a
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1411054200
["5 2 1\n1 2 3 4 5", "7 1 3\n2 10 7 18 5 33 0"]
null
PASSED
1,700
standard input
1 second
The first line contains three integers n, m and k (1 ≤ (m × k) ≤ n ≤ 5000). The second line contains n integers p1, p2, ..., pn (0 ≤ pi ≤ 109).
["9", "61"]
#include <stdio.h> #include <stdlib.h> #define max(a,b) (a>b?a:b) int main(){ long a[5010]; long long s[5010], dp[5010][5010]; int n,m,k,i,j; while(scanf("%d%d%d" , &n,&m,&k) != EOF){ int ans = 0; s[0] = 0; for(i = 1; i <= n; i++) { scanf("%ld", &a[i]); s[i] = s[i - 1] + a[i]; ...
The new ITone 6 has been released recently and George got really keen to buy it. Unfortunately, he didn't have enough money, so George was going to work as a programmer. Now he faced the following problem at the work.Given a sequence of n integers p1, p2, ..., pn. You are to choose k pairs of integers: [l1, r1], [l2, r...
Print an integer in a single line — the maximum possible value of sum.
C
ee3c228cc817536bf6c10ea4508d786f
ba4de93e99194d06e2008ad2d04d13f0
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1411054200
["5 2 1\n1 2 3 4 5", "7 1 3\n2 10 7 18 5 33 0"]
null
PASSED
1,700
standard input
1 second
The first line contains three integers n, m and k (1 ≤ (m × k) ≤ n ≤ 5000). The second line contains n integers p1, p2, ..., pn (0 ≤ pi ≤ 109).
["9", "61"]
#include <stdio.h> #include <stdlib.h> #include <string.h> long long n,m,k; long long sum[5010]; long long save[5010][5010]; long long ans = 0; long long max(long long a, long long b) { return (a>b)?a:b; } long long bf(long long l, long long ind) { long long r = m - 1 + l; if (ind > k) return 0;...
The new ITone 6 has been released recently and George got really keen to buy it. Unfortunately, he didn't have enough money, so George was going to work as a programmer. Now he faced the following problem at the work.Given a sequence of n integers p1, p2, ..., pn. You are to choose k pairs of integers: [l1, r1], [l2, r...
Print an integer in a single line — the maximum possible value of sum.
C
ee3c228cc817536bf6c10ea4508d786f
eb01596e7c9017455a0781fe1cdf6f11
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1411054200
["5 2 1\n1 2 3 4 5", "7 1 3\n2 10 7 18 5 33 0"]
null
PASSED
1,700
standard input
1 second
The first line contains three integers n, m and k (1 ≤ (m × k) ≤ n ≤ 5000). The second line contains n integers p1, p2, ..., pn (0 ≤ pi ≤ 109).
["9", "61"]
#include <stdio.h> #define max(x, y) ((x)>(y)?(x):(y)) long long P[5001]; long long Dp[5001][5001]; long long Ans; int main() { int N, M, K, i, j; scanf("%d %d %d", &N, &M, &K); for(i=1; i<=N; ++i) { scanf("%d", &P[i]); P[i] += P[i-1]; } for(i=1; i<=N; ++i) { for(j=...
The new ITone 6 has been released recently and George got really keen to buy it. Unfortunately, he didn't have enough money, so George was going to work as a programmer. Now he faced the following problem at the work.Given a sequence of n integers p1, p2, ..., pn. You are to choose k pairs of integers: [l1, r1], [l2, r...
Print an integer in a single line — the maximum possible value of sum.
C
ee3c228cc817536bf6c10ea4508d786f
45bf1f118b582686b9e49ae3dffeab33
GNU C
standard output
256 megabytes
train_000.jsonl
[ "dp", "implementation" ]
1411054200
["5 2 1\n1 2 3 4 5", "7 1 3\n2 10 7 18 5 33 0"]
null
PASSED
1,700
standard input
1 second
The first line contains three integers n, m and k (1 ≤ (m × k) ≤ n ≤ 5000). The second line contains n integers p1, p2, ..., pn (0 ≤ pi ≤ 109).
["9", "61"]
/* * 1.这个程序做到的事情 * 2.这个程序遇到的困难 * 我改进的一个方向就是! * 3.接下来要做的事情 */ #include<stdio.h> #define N 5002//我没有注意,把这一行注视了,用了下一行! //#define N 502 long long max2(long long a,long long b){ if(a>b)return a; else return b; } int main() { int n,m,k; int p[N]; scanf("%d%d%d",&n,&m,&k); /* printf("n=%d\n",n...
The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th...
For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro...
C
8736df815ea0fdf390cc8d500758bf84
f508c4511322afd9151122cdfe559da5
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "binary search", "implementation", "strings" ]
1561905900
["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"]
null
PASSED
1,300
standard input
2 seconds
The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ...
["5\n6\n5\n2\n9"]
#include<stdio.h> #include<string.h> int main() { int n; scanf("%d", &n); int i, j; char s[200005]; scanf("%s", s); int ans[50004]; int m; int l; char t[200005]; int count[30][200005]; for (i = 0; i < 30; i++) count[i][0] = 0; int min, max, mid; int x; for (i = 0; i < n; i++) { for (j = 0; j < 30; j+...
The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th...
For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro...
C
8736df815ea0fdf390cc8d500758bf84
5b9e1197859d9f82fb60f07a21b229a6
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "binary search", "implementation", "strings" ]
1561905900
["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"]
null
PASSED
1,300
standard input
2 seconds
The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ...
["5\n6\n5\n2\n9"]
#include<stdio.h> #include<string.h> int test[126]; void clear() { int i; for(i=97;i<=125;i++) test[i]=0; } int main() { int n,i,m,j,temp,max=0,len,k,cnt[126]={}; scanf("%d",&n); char str[n+2],name[n+2]; int value[n+2][125]; scanf("%s",str); for(i=0;str[i]!='\0';i++) { ...
The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th...
For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro...
C
8736df815ea0fdf390cc8d500758bf84
efc163911bda48963cbc34688f2ed1cb
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "binary search", "implementation", "strings" ]
1561905900
["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"]
null
PASSED
1,300
standard input
2 seconds
The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ...
["5\n6\n5\n2\n9"]
//practice with dukkha #include<stdio.h> #include<string.h> #define mod 1000000007 int com[26][2000000]; int comp[26]; int main() { int a; scanf("%d",&a); char array[a]; scanf("%s",array); for(int i=0;i<a;i++) { com[array[i]-'a'][comp[array[i]-'a']]=i; comp[array[i]-'a']++; ...
The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th...
For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro...
C
8736df815ea0fdf390cc8d500758bf84
b610c91ecfb339334f5b65604dce7437
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "binary search", "implementation", "strings" ]
1561905900
["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"]
null
PASSED
1,300
standard input
2 seconds
The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ...
["5\n6\n5\n2\n9"]
#include <stdio.h> #include <string.h> #include <stdlib.h> #define MAX_LEN 200001 int main() { int shoplen; scanf("%d", &shoplen); char shop[shoplen + 1]; scanf("%s", shop); int *count = calloc(26, sizeof(int)); int **posmat = calloc(26, sizeof(int*)) ; int sum = 0 ; posmat[0] = calloc(shoplen, size...
The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th...
For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro...
C
8736df815ea0fdf390cc8d500758bf84
825380b46bd5f0570ce280621f2da03f
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "binary search", "implementation", "strings" ]
1561905900
["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"]
null
PASSED
1,300
standard input
2 seconds
The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ...
["5\n6\n5\n2\n9"]
#include <stdio.h> #include <string.h> #define MAX_LEN 200001 int main() { int shoplen; scanf("%d", &shoplen); char shop[shoplen + 1]; scanf("%s", shop); // int posmat[26][shoplen]; int shopcount[26]; int *count = calloc(26, sizeof(int)); int **posmat = calloc(26, sizeof(int*)) ; int sum = 0 ; p...
The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th...
For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro...
C
8736df815ea0fdf390cc8d500758bf84
45edc830e4ee6369259bfad0da40b21a
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "binary search", "implementation", "strings" ]
1561905900
["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"]
null
PASSED
1,300
standard input
2 seconds
The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ...
["5\n6\n5\n2\n9"]
#include <stdio.h> // #include <stdlib.h> #include <string.h> #define MAX_LEN 200001 int main() { int shoplen; scanf("%d", &shoplen); char shop[shoplen + 1]; scanf("%s", shop); int posmat[26][shoplen]; int shopcount[26]; for (int x = 0; x < 26; x++) { for (int y = 0; y < shoplen; y++) { posm...
The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th...
For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro...
C
8736df815ea0fdf390cc8d500758bf84
f1ad4bb928236d44b507fccee0ffe929
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "binary search", "implementation", "strings" ]
1561905900
["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"]
null
PASSED
1,300
standard input
2 seconds
The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ...
["5\n6\n5\n2\n9"]
#include <stdio.h> #include <string.h> int chars_s[26][200002]; char s[200001]; char t[200001]; int main() { int n; scanf("%d", &n); scanf("%s", s); int chars_s_index[26]; for(int i = 0; i < 26; i++) { chars_s_index[i] = 0; chars_s[i][0] = 0; } int len_s = n; for(int i = 0; i < len_s; i++) chars_s[s[i]...
The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th...
For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro...
C
8736df815ea0fdf390cc8d500758bf84
c3ec56d4d31fa61659c3ef0f328deea5
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "binary search", "implementation", "strings" ]
1561905900
["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"]
null
PASSED
1,300
standard input
2 seconds
The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ...
["5\n6\n5\n2\n9"]
#include<stdio.h> int main(){ int n,n1,i,count=0,j,k,k1,a[26]={0},max=0,l,c[26]={0}; scanf("%d",&n); getchar(); char s[n]; gets(s); int b[26][200001]={0}; for(k=0;s[k]!=NULL;k++){ a[s[k]-97]++; b[s[k]-97][a[s[k]-97]-1]=(k+1); } scanf("%d",&n1); getchar(); char s1[300000]; for(j=0;j<n...
The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th...
For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro...
C
8736df815ea0fdf390cc8d500758bf84
05c9bb27b7a291fcfae5fb5a375d3d79
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "binary search", "implementation", "strings" ]
1561905900
["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"]
null
PASSED
1,300
standard input
2 seconds
The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ...
["5\n6\n5\n2\n9"]
#include<stdio.h> int main(){ int n,n1,i,count=0,j,k,k1,a[26]={0},max=0,l,c[26]={0}; scanf("%d",&n); getchar(); char s[n]; gets(s); int b[26][200001]={0}; for(k=0;s[k]!=NULL;k++){ a[s[k]-97]++; b[s[k]-97][a[s[k]-97]-1]=(k+1); } scanf("%d",&n1); getchar(); char s1[300000]; for(j=0;j<n1...
The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th...
For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro...
C
8736df815ea0fdf390cc8d500758bf84
13410dbca9ddc1ed94bcfebe0d11b203
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "binary search", "implementation", "strings" ]
1561905900
["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"]
null
PASSED
1,300
standard input
2 seconds
The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ...
["5\n6\n5\n2\n9"]
#include <stdio.h> int n,q; char s[200010],t[200010]; int cnts[200010][30],cntt[30]; short check(int x) { int i; for(i=0;i<26;i++) if(cnts[x][i] < cntt[i]) return 0; return 1; } int work() { int i,head = 1,tail = n,mid; for(i=0;i<26;i++) cntt[i] = 0; for(i=1;t[i];i++) cntt[t[i]-'a']++; ...
The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th...
For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro...
C
8736df815ea0fdf390cc8d500758bf84
463ecef515d31342d4c667564d999476
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "binary search", "implementation", "strings" ]
1561905900
["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"]
null
PASSED
1,300
standard input
2 seconds
The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ...
["5\n6\n5\n2\n9"]
/* practice with Dukkha */ #include <stdio.h> #include <string.h> #define N 200000 #define A 26 int main() { static char aa[N + 1], bb[N + 1]; static int kk[N][A], ll[A]; int n, q, i, a; scanf("%d%s", &n, aa); for (i = 0; i < n; i++) for (a = 0; a < A; a++) kk[i][a] = (i > 0 ? kk[i - 1][a] : 0) + (aa[i] ==...
The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th...
For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro...
C
8736df815ea0fdf390cc8d500758bf84
ebe7c1d39441b9022dbcb6f690719aba
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "binary search", "implementation", "strings" ]
1561905900
["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"]
null
PASSED
1,300
standard input
2 seconds
The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ...
["5\n6\n5\n2\n9"]
/* Coached by rainboy */ #include <stdio.h> #include <string.h> #define N 200000 int main() { static char s[N + 1]; static int kk[N][26], ll[26]; int n, q, i; scanf("%d%s%d", &n, s, &q); for (i = 0; i < n; i++) { ll[s[i] - 'a']++; memcpy(kk[i], ll, 26 * sizeof *ll); } while (q-- > 0) { static char t[N +...
The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th...
For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro...
C
8736df815ea0fdf390cc8d500758bf84
23ef3dc69aa9673b878598760aeb458d
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "binary search", "implementation", "strings" ]
1561905900
["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"]
null
PASSED
1,300
standard input
2 seconds
The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ...
["5\n6\n5\n2\n9"]
#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> char s[200005]; int cnt[26][200005] = { 0 }; char fs[200005]; int fcnt[26] = { 0 }; #define MAX(a,b) ((a)>(b)?(a):(b)) int main() { int len; scanf("%d", &len); scanf("%s", s); for (int i = 0; i < len; i++) { cnt[s[i] - 'a'][i]++; //转移 for (int c = 0; c ...
The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th...
For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro...
C
8736df815ea0fdf390cc8d500758bf84
5774bc5885ca96fe600d295f174c8435
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "binary search", "implementation", "strings" ]
1561905900
["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"]
null
PASSED
1,300
standard input
2 seconds
The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ...
["5\n6\n5\n2\n9"]
#include <stdio.h> #include <string.h> #define N 200000 int aa[28],bb[28]; int ss[28][N]; char s2[N]; int main(){ int n,a; char x; scanf("%d",&n); char c=getchar(); for(int i=0;i<n;i++){ scanf("%c",&x); a=(int) x-97; aa[a]++; ss[a][aa[a]]=i; } int m; scanf("%d",&m); c=getchar(); while(m--){ for(in...
The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th...
For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro...
C
8736df815ea0fdf390cc8d500758bf84
7ba5d28a40a6f941df45497bc513dabc
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "binary search", "implementation", "strings" ]
1561905900
["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"]
null
PASSED
1,300
standard input
2 seconds
The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ...
["5\n6\n5\n2\n9"]
#include <stdio.h> #include <stdlib.h> #include <string.h> long long m, k, l, t, i, j, k, a[30], c[30][300000], d, x, y, b, g, w, e; char s[1000000]; int war(const void* aa, const void* bb) { return(*(long long*)aa-*(long long*)bb); } /* long long bins(long long p, long long k, long long s) { if(a[(p+k)/2]>=...
The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th...
For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro...
C
8736df815ea0fdf390cc8d500758bf84
3da4467bee358c5f5555bdd619457bb9
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "binary search", "implementation", "strings" ]
1561905900
["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"]
null
PASSED
1,300
standard input
2 seconds
The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ...
["5\n6\n5\n2\n9"]
#include <stdio.h> #include <string.h> int chars_s[26][200002]; char s[200001]; char t[200001]; int main() { int n; scanf("%d", &n); scanf("%s", s); int chars_s_index[26]; for(int i = 0; i < 26; i++) { chars_s_index[i] = 0; chars_s[i][0] = 0; } int len_s = n; for(int i = 0; i < len_s; i++) chars_s[s[i]...
The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th...
For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro...
C
8736df815ea0fdf390cc8d500758bf84
299666a28105941ee13bda687ff7f8d5
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "binary search", "implementation", "strings" ]
1561905900
["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"]
null
PASSED
1,300
standard input
2 seconds
The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ...
["5\n6\n5\n2\n9"]
#include<stdio.h> #include<stdlib.h> #include<stdint.h> #include<inttypes.h> typedef int64_t i64; typedef int32_t i32; static void print_int(i64 n){if(n<0){putchar('-');n=-n;}if(n==0){putchar('0');return;}int s[20],len=0;while(n>0){s[len++]=n%10+'0';n/=10;}while(len>0){putchar(s[--len]);}} static i64 read_int(void){i...
The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th...
For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro...
C
8736df815ea0fdf390cc8d500758bf84
58641df38b0cae477721aa4c695567d5
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "binary search", "implementation", "strings" ]
1561905900
["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"]
null
PASSED
1,300
standard input
2 seconds
The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ...
["5\n6\n5\n2\n9"]
#include<stdio.h> #include<stdlib.h> #include<string.h> #define N 200002 int main(){ int n; scanf("%d",&n); char s[N]; scanf("%s",s); int ns=strlen(s); //printf("s=%s\n",s); //printf("ns=%d\n",ns); int scount[26]; int i,j; for(i=0;i<26;i++){ scount[i]=0; } for(i=0...
The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th...
For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro...
C
8736df815ea0fdf390cc8d500758bf84
c39a3e0a6066303c930bfff35df6dff9
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "binary search", "implementation", "strings" ]
1561905900
["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"]
null
PASSED
1,300
standard input
2 seconds
The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ...
["5\n6\n5\n2\n9"]
#include<stdio.h> #include<string.h> #include <stdlib.h> #include <conio.h> #define debug printf("SUSU\n") int latter[26][300000]; int main() { int n,m,i,j; char input[300000]; int cnt[300000]={}; char a; scanf("%d ",&n); for(i=0;i<n;i++) { scanf("%c",&a); latter[a-'a'][cnt...
The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th...
For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro...
C
8736df815ea0fdf390cc8d500758bf84
eec2cdabcd5d5d0ccc120da9d2b9002a
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "binary search", "implementation", "strings" ]
1561905900
["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"]
null
PASSED
1,300
standard input
2 seconds
The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ...
["5\n6\n5\n2\n9"]
#include<stdio.h> #include<string.h> int e[27][200009]; int main() { int n,m,i,j,k,f[30]={},count,g,h[30]={},l,z; char c[200009],d[20009]; scanf("%d",&n); scanf("%s",&c); getchar(); for(i=0;i<n;i++){ g=c[i]-96; h[g]++; e[g][h[g]]=i; } s...
The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th...
For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro...
C
8736df815ea0fdf390cc8d500758bf84
1b64535ababc7a4820c3f702cd033805
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "binary search", "implementation", "strings" ]
1561905900
["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"]
null
PASSED
1,300
standard input
2 seconds
The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ...
["5\n6\n5\n2\n9"]
#include<stdio.h> #include<string.h> typedef long long int ll; int max(ll x,ll y) { return x>y?x:y; } int main() { ll n,i; char s[1000000]; scanf("%lld",&n); scanf("%s",s); ll arr[26][1000000]; ll ind[26]; for (i=0;i<26;i++) ind[i]=0; for (i=0;i<n;i++) { arr[s[i]-'a'][ind[s[i]-'a']]=i+1; ind[s[i]-'a']++; ...
The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th...
For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro...
C
8736df815ea0fdf390cc8d500758bf84
895261178cd57a770ca6a5fee4653645
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "binary search", "implementation", "strings" ]
1561905900
["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"]
null
PASSED
1,300
standard input
2 seconds
The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ...
["5\n6\n5\n2\n9"]
#include<stdio.h> int main(){ int n,n1,i,count=0,j,k,k1,a[26]={0},max=0,l,c[26]={0}; scanf("%d",&n); getchar(); char s[n]; gets(s); int b[26][200001]={0}; for(k=0;s[k]!=NULL;k++){ a[s[k]-97]++; b[s[k]-97][a[s[k]-97]-1]=(k+1); } scanf("%d",&n1); getchar(); char s1[300000]; for(j=0;j<n...
The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th...
For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro...
C
8736df815ea0fdf390cc8d500758bf84
07090e86843cf04160332e167e97122a
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "binary search", "implementation", "strings" ]
1561905900
["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"]
null
PASSED
1,300
standard input
2 seconds
The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ...
["5\n6\n5\n2\n9"]
#include<stdio.h> int aaa[26][300000]; int aa[26]; int main() { int a,t,i,c,j; scanf("%d ",&a); char b[a]; for(i=0;i<a;i++) { scanf("%c",&b[i]); //b[i]=b[i]-'; aaa[b[i]-'a'][aa[b[i]-'a']]=i+1; // printf("%d=%d\n",aa[b[i]-'a'],aaa[b[i]-'a'][aa[b[i]-'a']]); aa[b[...
The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop.Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$.There are $$$m$$$ friends, the $$$i$$$-th...
For each friend print the length of the shortest prefix of letters from $$$s$$$ s/he would need to buy to be able to construct her/his name of them. The name can be constructed if each letter is presented in the equal or greater amount. It is guaranteed that every friend can construct her/his name using the letters fro...
C
8736df815ea0fdf390cc8d500758bf84
f0fa201cef501c1fa0769ba1a1430400
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "binary search", "implementation", "strings" ]
1561905900
["9\narrayhead\n5\narya\nharry\nray\nr\nareahydra"]
null
PASSED
1,300
standard input
2 seconds
The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of showcase string $$$s$$$. The second line contains string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. The third line contains one integer $$$m$$$ ($$$1 \le m \le 5 \cdot 10^4$$$) — the number of friends. The ...
["5\n6\n5\n2\n9"]
#include<stdio.h> #include<string.h> int test[126]; void clear() { int i; for(i=97;i<=125;i++) test[i]=0; } int main() { int n,i,m,j,temp,max=0,len,k,cnt[126]={}; scanf("%d",&n); char str[n+2],name[n+2]; int value[n+2][125]; scanf("%s",str); for(i=0;str[i]!='\0';i++) { ...
You are given n points on Cartesian plane. Every point is a lattice point (i. e. both of its coordinates are integers), and all points are distinct.You may draw two straight lines (not necessarily distinct). Is it possible to do this in such a way that every point lies on at least one of these lines?
If it is possible to draw two straight lines in such a way that each of given points belongs to at least one of these lines, print YES. Otherwise, print NO.
C
a9fd2e4bc5528a34f1f1b869cd391d71
e9d564f5041b4069c1de67662696162a
GNU C
standard output
256 megabytes
train_001.jsonl
[ "geometry" ]
1522850700
["5\n0 0\n0 1\n1 1\n1 -1\n2 2", "5\n0 0\n1 0\n2 1\n1 1\n2 3"]
NoteIn the first example it is possible to draw two lines, the one containing the points 1, 3 and 5, and another one containing two remaining points.
PASSED
2,000
standard input
2 seconds
The first line contains one integer n (1 ≤ n ≤ 105) — the number of points you are given. Then n lines follow, each line containing two integers xi and yi (|xi|, |yi| ≤ 109)— coordinates of i-th point. All n points are distinct.
["YES", "NO"]
#include<stdio.h> int gcd(int a,int b) { int c; while(a%b!=0) { c=b; b=a%b; a=c; } return b; } int main() { int n,i,j,k,con,refx,refy,delx1,dely1,dely2,delx2,lastx,sign; sign=con=1; scanf("%d",&n); int p[n][3]; for(i=0;i<n;i++) { scanf("%d %d",...
You are given n points on Cartesian plane. Every point is a lattice point (i. e. both of its coordinates are integers), and all points are distinct.You may draw two straight lines (not necessarily distinct). Is it possible to do this in such a way that every point lies on at least one of these lines?
If it is possible to draw two straight lines in such a way that each of given points belongs to at least one of these lines, print YES. Otherwise, print NO.
C
a9fd2e4bc5528a34f1f1b869cd391d71
16e347efa6dc3797e603f3d189fa98cf
GNU C
standard output
256 megabytes
train_001.jsonl
[ "geometry" ]
1522850700
["5\n0 0\n0 1\n1 1\n1 -1\n2 2", "5\n0 0\n1 0\n2 1\n1 1\n2 3"]
NoteIn the first example it is possible to draw two lines, the one containing the points 1, 3 and 5, and another one containing two remaining points.
PASSED
2,000
standard input
2 seconds
The first line contains one integer n (1 ≤ n ≤ 105) — the number of points you are given. Then n lines follow, each line containing two integers xi and yi (|xi|, |yi| ≤ 109)— coordinates of i-th point. All n points are distinct.
["YES", "NO"]
//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...
Furlo and Rublo play a game. The table has n piles of coins lying on it, the i-th pile has ai coins. Furlo and Rublo move in turns, Furlo moves first. In one move you are allowed to: choose some pile, let's denote the current number of coins in it as x; choose some integer y (0 ≤ y &lt; x; x1 / 4 ≤ y ≤ x1 / 2) and de...
If both players play optimally well and Furlo wins, print "Furlo", otherwise print "Rublo". Print the answers without the quotes.
C
cc23f07b6539abbded7e120793bef6a7
e1cce01a825a4a58eec4f89ff41052c0
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "games" ]
1355671800
["1\n1", "2\n1 2", "10\n1 2 3 4 5 6 7 8 9 10"]
null
PASSED
2,200
standard input
2 seconds
The first line contains integer n (1 ≤ n ≤ 77777) — the number of piles. The next line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 777777777777) — the sizes of piles. The numbers are separated by single spaces. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the c...
["Rublo", "Rublo", "Furlo"]
/* practice with Dukkha */ #include <math.h> #include <stdio.h> #define A 888888 int tr[A + A]; void update(int i, int b) { tr[i += A] = b; while (i > 1) { i >>= 1; tr[i] = tr[i << 1] | tr[i << 1 | 1]; } } int query(int l, int r) { int b = 0; for (l += A, r += A; l <= r; l >>= 1, r >>= 1) { if ((l & 1) ...
Drazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan.There are n boys and m girls among his friends. Let's number them from 0 to n - 1 and 0 to m - 1 separately. In i-th day, Drazil invites -th boy and -th girl...
If Drazil can make all his friends become happy by this plan, print "Yes". Otherwise, print "No".
C
65efbc0a1ad82436100eea7a2378d4c2
1ef61f48a52b76f86ffd9a10333f7928
GNU C
standard output
256 megabytes
train_001.jsonl
[ "dsu", "meet-in-the-middle", "number theory", "brute force" ]
1424190900
["2 3\n0\n1 0", "2 4\n1 0\n1 2", "2 3\n1 0\n1 1"]
NoteBy we define the remainder of integer division of i by k.In first sample case: On the 0-th day, Drazil invites 0-th boy and 0-th girl. Because 0-th girl is happy at the beginning, 0-th boy become happy at this day. On the 1-st day, Drazil invites 1-st boy and 1-st girl. They are both unhappy, so nothing changes...
PASSED
1,300
standard input
2 seconds
The first line contains two integer n and m (1 ≤ n, m ≤ 100). The second line contains integer b (0 ≤ b ≤ n), denoting the number of happy boys among friends of Drazil, and then follow b distinct integers x1, x2, ..., xb (0 ≤ xi &lt; n), denoting the list of indices of happy boys. The third line conatins integer g (0 ≤...
["Yes", "No", "Yes"]
#include<stdio.h> #include<string.h> int GY(int a, int b) { if(b == 0) return a; if(a % b == 0) return b; else return GY(b, a % b); } int main() { int a, b, c[200], d[200], m, n, x, y, i, j, k, t; while(scanf("%d%d", &m, &n) != EOF) { memset(c, 0, sizeof(c)); memset(d, 0, sizeof(d)); scanf("%d", &a);...
Drazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan.There are n boys and m girls among his friends. Let's number them from 0 to n - 1 and 0 to m - 1 separately. In i-th day, Drazil invites -th boy and -th girl...
If Drazil can make all his friends become happy by this plan, print "Yes". Otherwise, print "No".
C
65efbc0a1ad82436100eea7a2378d4c2
42131ed3f9e0ee50f05d4d7a146f9869
GNU C
standard output
256 megabytes
train_001.jsonl
[ "dsu", "meet-in-the-middle", "number theory", "brute force" ]
1424190900
["2 3\n0\n1 0", "2 4\n1 0\n1 2", "2 3\n1 0\n1 1"]
NoteBy we define the remainder of integer division of i by k.In first sample case: On the 0-th day, Drazil invites 0-th boy and 0-th girl. Because 0-th girl is happy at the beginning, 0-th boy become happy at this day. On the 1-st day, Drazil invites 1-st boy and 1-st girl. They are both unhappy, so nothing changes...
PASSED
1,300
standard input
2 seconds
The first line contains two integer n and m (1 ≤ n, m ≤ 100). The second line contains integer b (0 ≤ b ≤ n), denoting the number of happy boys among friends of Drazil, and then follow b distinct integers x1, x2, ..., xb (0 ≤ xi &lt; n), denoting the list of indices of happy boys. The third line conatins integer g (0 ≤...
["Yes", "No", "Yes"]
#include<stdio.h> int main() { int g,i,j,k,l,m,n,a,b,s; scanf("%d",&n); scanf("%d",&m); short int B[100],G[100]; for(i=0;i<100;i++) { B[i]=0; G[i]=0; } scanf("%d",&b); for(i=0;i<b;i++) { scanf("%d",&j); B[j]=1; } scanf("%d",&g); for(...
Drazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan.There are n boys and m girls among his friends. Let's number them from 0 to n - 1 and 0 to m - 1 separately. In i-th day, Drazil invites -th boy and -th girl...
If Drazil can make all his friends become happy by this plan, print "Yes". Otherwise, print "No".
C
65efbc0a1ad82436100eea7a2378d4c2
c82ccca2fe46ffc1711f5012d990f0bb
GNU C
standard output
256 megabytes
train_001.jsonl
[ "dsu", "meet-in-the-middle", "number theory", "brute force" ]
1424190900
["2 3\n0\n1 0", "2 4\n1 0\n1 2", "2 3\n1 0\n1 1"]
NoteBy we define the remainder of integer division of i by k.In first sample case: On the 0-th day, Drazil invites 0-th boy and 0-th girl. Because 0-th girl is happy at the beginning, 0-th boy become happy at this day. On the 1-st day, Drazil invites 1-st boy and 1-st girl. They are both unhappy, so nothing changes...
PASSED
1,300
standard input
2 seconds
The first line contains two integer n and m (1 ≤ n, m ≤ 100). The second line contains integer b (0 ≤ b ≤ n), denoting the number of happy boys among friends of Drazil, and then follow b distinct integers x1, x2, ..., xb (0 ≤ xi &lt; n), denoting the list of indices of happy boys. The third line conatins integer g (0 ≤...
["Yes", "No", "Yes"]
#include <stdio.h> #include <stdlib.h> int boys[100]={0}; int girls[100]={0}; int main() { int b,g,hb,hg,i,j,x,y; scanf("%d %d",&b,&g); scanf("%d",&hb); for(i=0;i<hb;i++){ scanf(" %d",&x); boys[x]=1; } scanf("%d",&hg); for(i=0;i<hg;i++){ scanf(" %d",&x); girls...
Drazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan.There are n boys and m girls among his friends. Let's number them from 0 to n - 1 and 0 to m - 1 separately. In i-th day, Drazil invites -th boy and -th girl...
If Drazil can make all his friends become happy by this plan, print "Yes". Otherwise, print "No".
C
65efbc0a1ad82436100eea7a2378d4c2
ac5e5ee0b81fab3757e480a4f56b4d53
GNU C
standard output
256 megabytes
train_001.jsonl
[ "dsu", "meet-in-the-middle", "number theory", "brute force" ]
1424190900
["2 3\n0\n1 0", "2 4\n1 0\n1 2", "2 3\n1 0\n1 1"]
NoteBy we define the remainder of integer division of i by k.In first sample case: On the 0-th day, Drazil invites 0-th boy and 0-th girl. Because 0-th girl is happy at the beginning, 0-th boy become happy at this day. On the 1-st day, Drazil invites 1-st boy and 1-st girl. They are both unhappy, so nothing changes...
PASSED
1,300
standard input
2 seconds
The first line contains two integer n and m (1 ≤ n, m ≤ 100). The second line contains integer b (0 ≤ b ≤ n), denoting the number of happy boys among friends of Drazil, and then follow b distinct integers x1, x2, ..., xb (0 ≤ xi &lt; n), denoting the list of indices of happy boys. The third line conatins integer g (0 ≤...
["Yes", "No", "Yes"]
#include<stdio.h> #include<stdlib.h> int main(void){ int m,n,i,j,input,b,g; scanf("%d %d",&n,&m); scanf("%d",&b); int *b_list = (int *)calloc(n,sizeof(int)); for(i=0;i<b;i++){ scanf("%d",&input); b_list[input]=1; } scanf("%d",&g); int *g_list = (int *)calloc(m,sizeof(i...
Drazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan.There are n boys and m girls among his friends. Let's number them from 0 to n - 1 and 0 to m - 1 separately. In i-th day, Drazil invites -th boy and -th girl...
If Drazil can make all his friends become happy by this plan, print "Yes". Otherwise, print "No".
C
65efbc0a1ad82436100eea7a2378d4c2
36cf5dc982513e93301af37ebf625be9
GNU C
standard output
256 megabytes
train_001.jsonl
[ "dsu", "meet-in-the-middle", "number theory", "brute force" ]
1424190900
["2 3\n0\n1 0", "2 4\n1 0\n1 2", "2 3\n1 0\n1 1"]
NoteBy we define the remainder of integer division of i by k.In first sample case: On the 0-th day, Drazil invites 0-th boy and 0-th girl. Because 0-th girl is happy at the beginning, 0-th boy become happy at this day. On the 1-st day, Drazil invites 1-st boy and 1-st girl. They are both unhappy, so nothing changes...
PASSED
1,300
standard input
2 seconds
The first line contains two integer n and m (1 ≤ n, m ≤ 100). The second line contains integer b (0 ≤ b ≤ n), denoting the number of happy boys among friends of Drazil, and then follow b distinct integers x1, x2, ..., xb (0 ≤ xi &lt; n), denoting the list of indices of happy boys. The third line conatins integer g (0 ≤...
["Yes", "No", "Yes"]
#include <stdio.h> int x[100], y[100]; int main(void) { int i, j, n, m, b, g, last = -1; scanf("%d %d %d", &n, &m, &b); for (i = 0; i < b; i++) { scanf("%d", &j); x[j] = 1; } scanf("%d", &g); for (i = 0; i < g; i++) { scanf("%d", &j); y[j] = 1; } for (i ...
Drazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan.There are n boys and m girls among his friends. Let's number them from 0 to n - 1 and 0 to m - 1 separately. In i-th day, Drazil invites -th boy and -th girl...
If Drazil can make all his friends become happy by this plan, print "Yes". Otherwise, print "No".
C
65efbc0a1ad82436100eea7a2378d4c2
4e752a2670fc98cd5eb6c55297b46226
GNU C
standard output
256 megabytes
train_001.jsonl
[ "dsu", "meet-in-the-middle", "number theory", "brute force" ]
1424190900
["2 3\n0\n1 0", "2 4\n1 0\n1 2", "2 3\n1 0\n1 1"]
NoteBy we define the remainder of integer division of i by k.In first sample case: On the 0-th day, Drazil invites 0-th boy and 0-th girl. Because 0-th girl is happy at the beginning, 0-th boy become happy at this day. On the 1-st day, Drazil invites 1-st boy and 1-st girl. They are both unhappy, so nothing changes...
PASSED
1,300
standard input
2 seconds
The first line contains two integer n and m (1 ≤ n, m ≤ 100). The second line contains integer b (0 ≤ b ≤ n), denoting the number of happy boys among friends of Drazil, and then follow b distinct integers x1, x2, ..., xb (0 ≤ xi &lt; n), denoting the list of indices of happy boys. The third line conatins integer g (0 ≤...
["Yes", "No", "Yes"]
#include<stdio.h> #include<string.h> int b[10010], g[10010]; int vis[110]; int que[10010]; int main() { int m, n, h, sub; int i, j, cont = 0; memset(vis, 0, sizeof(vis)); scanf("%d %d", &n, &m); for (i = 0; i < n*m; i++) b[i] = i%n; for (i = 0; i < n*m; i++) g[i] = i%m; scanf("%d", &h); for (i = 0; i ...
Drazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan.There are n boys and m girls among his friends. Let's number them from 0 to n - 1 and 0 to m - 1 separately. In i-th day, Drazil invites -th boy and -th girl...
If Drazil can make all his friends become happy by this plan, print "Yes". Otherwise, print "No".
C
65efbc0a1ad82436100eea7a2378d4c2
3f27f88c63509a6a5bd25ee29c4b3b02
GNU C
standard output
256 megabytes
train_001.jsonl
[ "dsu", "meet-in-the-middle", "number theory", "brute force" ]
1424190900
["2 3\n0\n1 0", "2 4\n1 0\n1 2", "2 3\n1 0\n1 1"]
NoteBy we define the remainder of integer division of i by k.In first sample case: On the 0-th day, Drazil invites 0-th boy and 0-th girl. Because 0-th girl is happy at the beginning, 0-th boy become happy at this day. On the 1-st day, Drazil invites 1-st boy and 1-st girl. They are both unhappy, so nothing changes...
PASSED
1,300
standard input
2 seconds
The first line contains two integer n and m (1 ≤ n, m ≤ 100). The second line contains integer b (0 ≤ b ≤ n), denoting the number of happy boys among friends of Drazil, and then follow b distinct integers x1, x2, ..., xb (0 ≤ xi &lt; n), denoting the list of indices of happy boys. The third line conatins integer g (0 ≤...
["Yes", "No", "Yes"]
#include<stdio.h> int main() { int n,m,b,g,x,i,j; int B[100]={0},G[100]={0}; scanf("%d%d",&n,&m); scanf("%d",&b); for(i=0;i<b;i++) { scanf("%d",&x); B[x]=1; } scanf("%d",&g); for(i=0;i<g;i++) { scanf("%d",&x); G[x]=1; } for(i=0;i<m*n+m+n;i...
Drazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan.There are n boys and m girls among his friends. Let's number them from 0 to n - 1 and 0 to m - 1 separately. In i-th day, Drazil invites -th boy and -th girl...
If Drazil can make all his friends become happy by this plan, print "Yes". Otherwise, print "No".
C
65efbc0a1ad82436100eea7a2378d4c2
940c653269762d68894c51f452e663b2
GNU C
standard output
256 megabytes
train_001.jsonl
[ "dsu", "meet-in-the-middle", "number theory", "brute force" ]
1424190900
["2 3\n0\n1 0", "2 4\n1 0\n1 2", "2 3\n1 0\n1 1"]
NoteBy we define the remainder of integer division of i by k.In first sample case: On the 0-th day, Drazil invites 0-th boy and 0-th girl. Because 0-th girl is happy at the beginning, 0-th boy become happy at this day. On the 1-st day, Drazil invites 1-st boy and 1-st girl. They are both unhappy, so nothing changes...
PASSED
1,300
standard input
2 seconds
The first line contains two integer n and m (1 ≤ n, m ≤ 100). The second line contains integer b (0 ≤ b ≤ n), denoting the number of happy boys among friends of Drazil, and then follow b distinct integers x1, x2, ..., xb (0 ≤ xi &lt; n), denoting the list of indices of happy boys. The third line conatins integer g (0 ≤...
["Yes", "No", "Yes"]
#include <stdio.h> #include <stdlib.h> #include <string.h> int max(int a, int b) { if (a>b) return a; else return b; } int min(int a, int b) { if (a<b) return a; else return b; } int gcd(int a, int b){ int c, d; d = max(a, b); c = min(a, b); if(d%c == 0) return c; else return gcd(d%c, c); } int p...
Drazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan.There are n boys and m girls among his friends. Let's number them from 0 to n - 1 and 0 to m - 1 separately. In i-th day, Drazil invites -th boy and -th girl...
If Drazil can make all his friends become happy by this plan, print "Yes". Otherwise, print "No".
C
65efbc0a1ad82436100eea7a2378d4c2
45dfa2de3a88013dda278e920089e7aa
GNU C
standard output
256 megabytes
train_001.jsonl
[ "dsu", "meet-in-the-middle", "number theory", "brute force" ]
1424190900
["2 3\n0\n1 0", "2 4\n1 0\n1 2", "2 3\n1 0\n1 1"]
NoteBy we define the remainder of integer division of i by k.In first sample case: On the 0-th day, Drazil invites 0-th boy and 0-th girl. Because 0-th girl is happy at the beginning, 0-th boy become happy at this day. On the 1-st day, Drazil invites 1-st boy and 1-st girl. They are both unhappy, so nothing changes...
PASSED
1,300
standard input
2 seconds
The first line contains two integer n and m (1 ≤ n, m ≤ 100). The second line contains integer b (0 ≤ b ≤ n), denoting the number of happy boys among friends of Drazil, and then follow b distinct integers x1, x2, ..., xb (0 ≤ xi &lt; n), denoting the list of indices of happy boys. The third line conatins integer g (0 ≤...
["Yes", "No", "Yes"]
#include<stdio.h> #include<string.h> int gcd(int a, int b) { if(a > b) return gcd(b, a); if(b % a == 0) return a; return gcd(b % a, a); } int main() { int n,m,i,j,x,flag,sign=0; int a[105],b[105],tmp[105]; memset(a,-1,sizeof(a)); memset(b,-1,sizeof(b)); memset(tmp,0,sizeof(tmp)); scanf("%d %d",&n,&m);...
Drazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan.There are n boys and m girls among his friends. Let's number them from 0 to n - 1 and 0 to m - 1 separately. In i-th day, Drazil invites -th boy and -th girl...
If Drazil can make all his friends become happy by this plan, print "Yes". Otherwise, print "No".
C
65efbc0a1ad82436100eea7a2378d4c2
051b908ba4aa5ad1f3878033023654e7
GNU C
standard output
256 megabytes
train_001.jsonl
[ "dsu", "meet-in-the-middle", "number theory", "brute force" ]
1424190900
["2 3\n0\n1 0", "2 4\n1 0\n1 2", "2 3\n1 0\n1 1"]
NoteBy we define the remainder of integer division of i by k.In first sample case: On the 0-th day, Drazil invites 0-th boy and 0-th girl. Because 0-th girl is happy at the beginning, 0-th boy become happy at this day. On the 1-st day, Drazil invites 1-st boy and 1-st girl. They are both unhappy, so nothing changes...
PASSED
1,300
standard input
2 seconds
The first line contains two integer n and m (1 ≤ n, m ≤ 100). The second line contains integer b (0 ≤ b ≤ n), denoting the number of happy boys among friends of Drazil, and then follow b distinct integers x1, x2, ..., xb (0 ≤ xi &lt; n), denoting the list of indices of happy boys. The third line conatins integer g (0 ≤...
["Yes", "No", "Yes"]
#include <stdio.h> #include <stdlib.h> #include <string.h> int max(int a, int b) { if (a>b) return a; else return b; } int min(int a, int b) { if (a<b) return a; else return b; } int gcd(int a, int b){ int c, d; d = max(a, b); c = min(a, b); if(d%c == 0) return c; else return gcd(d%c, c); } int p...
Drazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan.There are n boys and m girls among his friends. Let's number them from 0 to n - 1 and 0 to m - 1 separately. In i-th day, Drazil invites -th boy and -th girl...
If Drazil can make all his friends become happy by this plan, print "Yes". Otherwise, print "No".
C
65efbc0a1ad82436100eea7a2378d4c2
afd7f05b57d8d1ced55d85799078b404
GNU C
standard output
256 megabytes
train_001.jsonl
[ "dsu", "meet-in-the-middle", "number theory", "brute force" ]
1424190900
["2 3\n0\n1 0", "2 4\n1 0\n1 2", "2 3\n1 0\n1 1"]
NoteBy we define the remainder of integer division of i by k.In first sample case: On the 0-th day, Drazil invites 0-th boy and 0-th girl. Because 0-th girl is happy at the beginning, 0-th boy become happy at this day. On the 1-st day, Drazil invites 1-st boy and 1-st girl. They are both unhappy, so nothing changes...
PASSED
1,300
standard input
2 seconds
The first line contains two integer n and m (1 ≤ n, m ≤ 100). The second line contains integer b (0 ≤ b ≤ n), denoting the number of happy boys among friends of Drazil, and then follow b distinct integers x1, x2, ..., xb (0 ≤ xi &lt; n), denoting the list of indices of happy boys. The third line conatins integer g (0 ≤...
["Yes", "No", "Yes"]
#include<stdio.h> int n; int left,right,middle; int a[10000],b[10000]; void msort(int a[],int left,int middle,int right) { int temp,temp1,temp2,l1,l2,d,d1,t1,flag,i; temp1=middle+1; temp=left; temp2=right; l1=middle-left+1; l2=right-middle; d=l1; d1=l2; t1=left; flag=0; while(d!=0&&d1!=0) { if(a[temp]<...
Drazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan.There are n boys and m girls among his friends. Let's number them from 0 to n - 1 and 0 to m - 1 separately. In i-th day, Drazil invites -th boy and -th girl...
If Drazil can make all his friends become happy by this plan, print "Yes". Otherwise, print "No".
C
65efbc0a1ad82436100eea7a2378d4c2
9b094298ab5117b26645286ece67b77d
GNU C
standard output
256 megabytes
train_001.jsonl
[ "dsu", "meet-in-the-middle", "number theory", "brute force" ]
1424190900
["2 3\n0\n1 0", "2 4\n1 0\n1 2", "2 3\n1 0\n1 1"]
NoteBy we define the remainder of integer division of i by k.In first sample case: On the 0-th day, Drazil invites 0-th boy and 0-th girl. Because 0-th girl is happy at the beginning, 0-th boy become happy at this day. On the 1-st day, Drazil invites 1-st boy and 1-st girl. They are both unhappy, so nothing changes...
PASSED
1,300
standard input
2 seconds
The first line contains two integer n and m (1 ≤ n, m ≤ 100). The second line contains integer b (0 ≤ b ≤ n), denoting the number of happy boys among friends of Drazil, and then follow b distinct integers x1, x2, ..., xb (0 ≤ xi &lt; n), denoting the list of indices of happy boys. The third line conatins integer g (0 ≤...
["Yes", "No", "Yes"]
#include <stdio.h> #define maxn 120 int main() { int n,i,j,m,b,g; int x[maxn]={0},y[maxn]={0}; scanf("%d%d",&n,&m); scanf("%d",&b); for (i=0;i<b;i++){ scanf("%d",&j); x[j]=1; } scanf("%d",&g); for (i=0;i<g;i++){ scanf("%d",&j); y[j]=1; } for (i=0;i<=4*n*m;i++) if (x[i%n]||y[i%m]) {x[i%n]=1;y[i%m]=1;...
Drazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan.There are n boys and m girls among his friends. Let's number them from 0 to n - 1 and 0 to m - 1 separately. In i-th day, Drazil invites -th boy and -th girl...
If Drazil can make all his friends become happy by this plan, print "Yes". Otherwise, print "No".
C
65efbc0a1ad82436100eea7a2378d4c2
7f04722ac82c72158d9a197afbd88d93
GNU C
standard output
256 megabytes
train_001.jsonl
[ "dsu", "meet-in-the-middle", "number theory", "brute force" ]
1424190900
["2 3\n0\n1 0", "2 4\n1 0\n1 2", "2 3\n1 0\n1 1"]
NoteBy we define the remainder of integer division of i by k.In first sample case: On the 0-th day, Drazil invites 0-th boy and 0-th girl. Because 0-th girl is happy at the beginning, 0-th boy become happy at this day. On the 1-st day, Drazil invites 1-st boy and 1-st girl. They are both unhappy, so nothing changes...
PASSED
1,300
standard input
2 seconds
The first line contains two integer n and m (1 ≤ n, m ≤ 100). The second line contains integer b (0 ≤ b ≤ n), denoting the number of happy boys among friends of Drazil, and then follow b distinct integers x1, x2, ..., xb (0 ≤ xi &lt; n), denoting the list of indices of happy boys. The third line conatins integer g (0 ≤...
["Yes", "No", "Yes"]
#include <stdio.h> #include <stdlib.h> int main(void) { int n, m; scanf("%d %d", &n, &m); int i, j; int boy[n]; int girl[m]; for (i = 0; i < n; ++i) { boy[i] = 0; } for (i = 0; i < m; ++i) { girl[i] = 0; } int b; scanf("%d", &b); int temp; for (i = 0...
Drazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan.There are n boys and m girls among his friends. Let's number them from 0 to n - 1 and 0 to m - 1 separately. In i-th day, Drazil invites -th boy and -th girl...
If Drazil can make all his friends become happy by this plan, print "Yes". Otherwise, print "No".
C
65efbc0a1ad82436100eea7a2378d4c2
c769848b0fcc2356c6915040670f8916
GNU C
standard output
256 megabytes
train_001.jsonl
[ "dsu", "meet-in-the-middle", "number theory", "brute force" ]
1424190900
["2 3\n0\n1 0", "2 4\n1 0\n1 2", "2 3\n1 0\n1 1"]
NoteBy we define the remainder of integer division of i by k.In first sample case: On the 0-th day, Drazil invites 0-th boy and 0-th girl. Because 0-th girl is happy at the beginning, 0-th boy become happy at this day. On the 1-st day, Drazil invites 1-st boy and 1-st girl. They are both unhappy, so nothing changes...
PASSED
1,300
standard input
2 seconds
The first line contains two integer n and m (1 ≤ n, m ≤ 100). The second line contains integer b (0 ≤ b ≤ n), denoting the number of happy boys among friends of Drazil, and then follow b distinct integers x1, x2, ..., xb (0 ≤ xi &lt; n), denoting the list of indices of happy boys. The third line conatins integer g (0 ≤...
["Yes", "No", "Yes"]
#include <stdio.h> int main(void) { int n,m,b,g,i,index,ans1,ans2; int flag1=0; int flag2=0; scanf("%d%d",&n,&m); int b1[n]; int g1[m]; for(i=0;i<n;i++)b1[i]=0; for(i=0;i<m;i++)g1[i]=0; scanf("%d",&b); for(i=0;i<b;i++) { scanf("%d",&index); b1[index]=1; } ...
Drazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan.There are n boys and m girls among his friends. Let's number them from 0 to n - 1 and 0 to m - 1 separately. In i-th day, Drazil invites -th boy and -th girl...
If Drazil can make all his friends become happy by this plan, print "Yes". Otherwise, print "No".
C
65efbc0a1ad82436100eea7a2378d4c2
356ce739bc4f7448b1402cab978cbe82
GNU C
standard output
256 megabytes
train_001.jsonl
[ "dsu", "meet-in-the-middle", "number theory", "brute force" ]
1424190900
["2 3\n0\n1 0", "2 4\n1 0\n1 2", "2 3\n1 0\n1 1"]
NoteBy we define the remainder of integer division of i by k.In first sample case: On the 0-th day, Drazil invites 0-th boy and 0-th girl. Because 0-th girl is happy at the beginning, 0-th boy become happy at this day. On the 1-st day, Drazil invites 1-st boy and 1-st girl. They are both unhappy, so nothing changes...
PASSED
1,300
standard input
2 seconds
The first line contains two integer n and m (1 ≤ n, m ≤ 100). The second line contains integer b (0 ≤ b ≤ n), denoting the number of happy boys among friends of Drazil, and then follow b distinct integers x1, x2, ..., xb (0 ≤ xi &lt; n), denoting the list of indices of happy boys. The third line conatins integer g (0 ≤...
["Yes", "No", "Yes"]
#include<stdio.h> int arr[2500]; int arr1[2500]; int max(int a,int b){ return a>b?a:b; } int main(){ int a,b; scanf("%d%d",&a,&b); int i; int left,left1; int x,g; scanf("%d",&x); for(i=0;i<x;i++){ int in; scanf("%d",&in); arr[in]=1; } scanf("%d",&g); for(i=0;i<g;i++){ int in; scanf("%d",&in); arr1[in]=1...
Drazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan.There are n boys and m girls among his friends. Let's number them from 0 to n - 1 and 0 to m - 1 separately. In i-th day, Drazil invites -th boy and -th girl...
If Drazil can make all his friends become happy by this plan, print "Yes". Otherwise, print "No".
C
65efbc0a1ad82436100eea7a2378d4c2
8fccbc424c6f27b52b060effdc47036d
GNU C
standard output
256 megabytes
train_001.jsonl
[ "dsu", "meet-in-the-middle", "number theory", "brute force" ]
1424190900
["2 3\n0\n1 0", "2 4\n1 0\n1 2", "2 3\n1 0\n1 1"]
NoteBy we define the remainder of integer division of i by k.In first sample case: On the 0-th day, Drazil invites 0-th boy and 0-th girl. Because 0-th girl is happy at the beginning, 0-th boy become happy at this day. On the 1-st day, Drazil invites 1-st boy and 1-st girl. They are both unhappy, so nothing changes...
PASSED
1,300
standard input
2 seconds
The first line contains two integer n and m (1 ≤ n, m ≤ 100). The second line contains integer b (0 ≤ b ≤ n), denoting the number of happy boys among friends of Drazil, and then follow b distinct integers x1, x2, ..., xb (0 ≤ xi &lt; n), denoting the list of indices of happy boys. The third line conatins integer g (0 ≤...
["Yes", "No", "Yes"]
#include <stdio.h> #include <string.h> int gcd(int x,int y) { if (x%y==0) return y; else if (y%x==0) return x; else if (x>y) return gcd(y,x%y); else return gcd(x,y%x); } int main() { int n,m,b,g,x[100],d,i,j; for (i=0;i<100;i++) x[i]=0; scanf(" %d %d",&n,&m); d=gcd(n,m); scanf(" %d",&b);...
Drazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan.There are n boys and m girls among his friends. Let's number them from 0 to n - 1 and 0 to m - 1 separately. In i-th day, Drazil invites -th boy and -th girl...
If Drazil can make all his friends become happy by this plan, print "Yes". Otherwise, print "No".
C
65efbc0a1ad82436100eea7a2378d4c2
0fee90a71db45f7c3cd908aadcbe75f5
GNU C
standard output
256 megabytes
train_001.jsonl
[ "dsu", "meet-in-the-middle", "number theory", "brute force" ]
1424190900
["2 3\n0\n1 0", "2 4\n1 0\n1 2", "2 3\n1 0\n1 1"]
NoteBy we define the remainder of integer division of i by k.In first sample case: On the 0-th day, Drazil invites 0-th boy and 0-th girl. Because 0-th girl is happy at the beginning, 0-th boy become happy at this day. On the 1-st day, Drazil invites 1-st boy and 1-st girl. They are both unhappy, so nothing changes...
PASSED
1,300
standard input
2 seconds
The first line contains two integer n and m (1 ≤ n, m ≤ 100). The second line contains integer b (0 ≤ b ≤ n), denoting the number of happy boys among friends of Drazil, and then follow b distinct integers x1, x2, ..., xb (0 ≤ xi &lt; n), denoting the list of indices of happy boys. The third line conatins integer g (0 ≤...
["Yes", "No", "Yes"]
#include <stdio.h> #include <string.h> void swap(int *x,int *y) { int k=*x;*x=*y;*y=k; } int gcd(int x,int y) { if (y>x) swap(&x,&y); if (x%y==0) return y; else return gcd(y,x%y); } int main() { int n,m,b,g,x[100],d,i,j; for (i=0;i<100;i++) x[i]=0; scanf(" %d %d",&n,&m); d=gcd(n,m); scanf(" %d",&b); fo...
Drazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan.There are n boys and m girls among his friends. Let's number them from 0 to n - 1 and 0 to m - 1 separately. In i-th day, Drazil invites -th boy and -th girl...
If Drazil can make all his friends become happy by this plan, print "Yes". Otherwise, print "No".
C
65efbc0a1ad82436100eea7a2378d4c2
780311e45066a69fa07d11e8be039db7
GNU C
standard output
256 megabytes
train_001.jsonl
[ "dsu", "meet-in-the-middle", "number theory", "brute force" ]
1424190900
["2 3\n0\n1 0", "2 4\n1 0\n1 2", "2 3\n1 0\n1 1"]
NoteBy we define the remainder of integer division of i by k.In first sample case: On the 0-th day, Drazil invites 0-th boy and 0-th girl. Because 0-th girl is happy at the beginning, 0-th boy become happy at this day. On the 1-st day, Drazil invites 1-st boy and 1-st girl. They are both unhappy, so nothing changes...
PASSED
1,300
standard input
2 seconds
The first line contains two integer n and m (1 ≤ n, m ≤ 100). The second line contains integer b (0 ≤ b ≤ n), denoting the number of happy boys among friends of Drazil, and then follow b distinct integers x1, x2, ..., xb (0 ≤ xi &lt; n), denoting the list of indices of happy boys. The third line conatins integer g (0 ≤...
["Yes", "No", "Yes"]
#include<stdio.h> typedef unsigned u; u A[100],B[100]; int main() { u n,m,i,j,N,x,y; scanf("%u%u",&n,&m); for(scanf("%u",&x);x--;) {scanf("%u",&y);A[y]=1;} for(scanf("%u",&x);x--;) {scanf("%u",&y);B[y]=1;} while(getchar()==' '); for(N=n*m,i=1,x=y=0;i;)for(i=j=0;j<N;++j) { if(A[x]^B[y])A[x]=B[y]=i=1; if(++x...
Drazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan.There are n boys and m girls among his friends. Let's number them from 0 to n - 1 and 0 to m - 1 separately. In i-th day, Drazil invites -th boy and -th girl...
If Drazil can make all his friends become happy by this plan, print "Yes". Otherwise, print "No".
C
65efbc0a1ad82436100eea7a2378d4c2
960d22144342f7170489265b31578dd9
GNU C
standard output
256 megabytes
train_001.jsonl
[ "dsu", "meet-in-the-middle", "number theory", "brute force" ]
1424190900
["2 3\n0\n1 0", "2 4\n1 0\n1 2", "2 3\n1 0\n1 1"]
NoteBy we define the remainder of integer division of i by k.In first sample case: On the 0-th day, Drazil invites 0-th boy and 0-th girl. Because 0-th girl is happy at the beginning, 0-th boy become happy at this day. On the 1-st day, Drazil invites 1-st boy and 1-st girl. They are both unhappy, so nothing changes...
PASSED
1,300
standard input
2 seconds
The first line contains two integer n and m (1 ≤ n, m ≤ 100). The second line contains integer b (0 ≤ b ≤ n), denoting the number of happy boys among friends of Drazil, and then follow b distinct integers x1, x2, ..., xb (0 ≤ xi &lt; n), denoting the list of indices of happy boys. The third line conatins integer g (0 ≤...
["Yes", "No", "Yes"]
/* .................... compiled by alankar.................... */ //......................SHORTCUTS.............................. #include<stdio.h> #include<stdlib.h> #include<math.h> #include<string.h> //........................................................... #define pi 3.14159265358979323846 //float type #de...
Drazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan.There are n boys and m girls among his friends. Let's number them from 0 to n - 1 and 0 to m - 1 separately. In i-th day, Drazil invites -th boy and -th girl...
If Drazil can make all his friends become happy by this plan, print "Yes". Otherwise, print "No".
C
65efbc0a1ad82436100eea7a2378d4c2
be4d94179bfb20501335099174eea801
GNU C
standard output
256 megabytes
train_001.jsonl
[ "dsu", "meet-in-the-middle", "number theory", "brute force" ]
1424190900
["2 3\n0\n1 0", "2 4\n1 0\n1 2", "2 3\n1 0\n1 1"]
NoteBy we define the remainder of integer division of i by k.In first sample case: On the 0-th day, Drazil invites 0-th boy and 0-th girl. Because 0-th girl is happy at the beginning, 0-th boy become happy at this day. On the 1-st day, Drazil invites 1-st boy and 1-st girl. They are both unhappy, so nothing changes...
PASSED
1,300
standard input
2 seconds
The first line contains two integer n and m (1 ≤ n, m ≤ 100). The second line contains integer b (0 ≤ b ≤ n), denoting the number of happy boys among friends of Drazil, and then follow b distinct integers x1, x2, ..., xb (0 ≤ xi &lt; n), denoting the list of indices of happy boys. The third line conatins integer g (0 ≤...
["Yes", "No", "Yes"]
#include<stdio.h> int main() { int arr1[1000]={0}; int arr2[1000]={0}; int n,m; scanf("%d %d",&n,&m); int b; scanf("%d",&b); int i; int x; for(i=0;i<b;i++) { scanf("%d",&x); arr1[x]=1; } int g...
Drazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan.There are n boys and m girls among his friends. Let's number them from 0 to n - 1 and 0 to m - 1 separately. In i-th day, Drazil invites -th boy and -th girl...
If Drazil can make all his friends become happy by this plan, print "Yes". Otherwise, print "No".
C
65efbc0a1ad82436100eea7a2378d4c2
933f2f6ff94d9548afa21759767aaf1c
GNU C
standard output
256 megabytes
train_001.jsonl
[ "dsu", "meet-in-the-middle", "number theory", "brute force" ]
1424190900
["2 3\n0\n1 0", "2 4\n1 0\n1 2", "2 3\n1 0\n1 1"]
NoteBy we define the remainder of integer division of i by k.In first sample case: On the 0-th day, Drazil invites 0-th boy and 0-th girl. Because 0-th girl is happy at the beginning, 0-th boy become happy at this day. On the 1-st day, Drazil invites 1-st boy and 1-st girl. They are both unhappy, so nothing changes...
PASSED
1,300
standard input
2 seconds
The first line contains two integer n and m (1 ≤ n, m ≤ 100). The second line contains integer b (0 ≤ b ≤ n), denoting the number of happy boys among friends of Drazil, and then follow b distinct integers x1, x2, ..., xb (0 ≤ xi &lt; n), denoting the list of indices of happy boys. The third line conatins integer g (0 ≤...
["Yes", "No", "Yes"]
#include<stdio.h> int main(){ int flag,head1,head2,sum,i,j,k,l,n,m,bn,gn,b[2][1000],g[2][1000]; scanf("%d%d",&n,&m); scanf("%d",&bn); for(i=0;i<bn;i++){ scanf("%d",&k); b[1][k]=1; } scanf("%d",&gn); for(i=0;i<gn;i++){ scanf("%d",&k); g[1][k]=1; } flag=1,head1=0,head2=0,sum=0,head1=0,head2=0; while(sum...
Drazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan.There are n boys and m girls among his friends. Let's number them from 0 to n - 1 and 0 to m - 1 separately. In i-th day, Drazil invites -th boy and -th girl...
If Drazil can make all his friends become happy by this plan, print "Yes". Otherwise, print "No".
C
65efbc0a1ad82436100eea7a2378d4c2
946a60e18a9d13eb67bd95f9f8b9786b
GNU C
standard output
256 megabytes
train_001.jsonl
[ "dsu", "meet-in-the-middle", "number theory", "brute force" ]
1424190900
["2 3\n0\n1 0", "2 4\n1 0\n1 2", "2 3\n1 0\n1 1"]
NoteBy we define the remainder of integer division of i by k.In first sample case: On the 0-th day, Drazil invites 0-th boy and 0-th girl. Because 0-th girl is happy at the beginning, 0-th boy become happy at this day. On the 1-st day, Drazil invites 1-st boy and 1-st girl. They are both unhappy, so nothing changes...
PASSED
1,300
standard input
2 seconds
The first line contains two integer n and m (1 ≤ n, m ≤ 100). The second line contains integer b (0 ≤ b ≤ n), denoting the number of happy boys among friends of Drazil, and then follow b distinct integers x1, x2, ..., xb (0 ≤ xi &lt; n), denoting the list of indices of happy boys. The third line conatins integer g (0 ≤...
["Yes", "No", "Yes"]
#include <stdlib.h> int getint(){ char c,sign=1; int ans=0; while((c=getchar())<'-'); if(c=='-')sign=-1,c=getchar(); do{ ans=ans*10+c-48; }while((c=getchar())>='0'); return ans*sign; } int main(){ int n, m, a, b, x; int i; char boy[100]={0}, girl[100]={0}; n=getint(),m=getint(); a=getint(); for(i=0;i<a...
Drazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan.There are n boys and m girls among his friends. Let's number them from 0 to n - 1 and 0 to m - 1 separately. In i-th day, Drazil invites -th boy and -th girl...
If Drazil can make all his friends become happy by this plan, print "Yes". Otherwise, print "No".
C
65efbc0a1ad82436100eea7a2378d4c2
e40c8bc74c10139a3e30ca801183b2aa
GNU C
standard output
256 megabytes
train_001.jsonl
[ "dsu", "meet-in-the-middle", "number theory", "brute force" ]
1424190900
["2 3\n0\n1 0", "2 4\n1 0\n1 2", "2 3\n1 0\n1 1"]
NoteBy we define the remainder of integer division of i by k.In first sample case: On the 0-th day, Drazil invites 0-th boy and 0-th girl. Because 0-th girl is happy at the beginning, 0-th boy become happy at this day. On the 1-st day, Drazil invites 1-st boy and 1-st girl. They are both unhappy, so nothing changes...
PASSED
1,300
standard input
2 seconds
The first line contains two integer n and m (1 ≤ n, m ≤ 100). The second line contains integer b (0 ≤ b ≤ n), denoting the number of happy boys among friends of Drazil, and then follow b distinct integers x1, x2, ..., xb (0 ≤ xi &lt; n), denoting the list of indices of happy boys. The third line conatins integer g (0 ≤...
["Yes", "No", "Yes"]
#include <stdio.h> int main() { int boy[100], girl[100], happy_boys, happy_girls; int n, m, i, flag, temp, count=10001; int counter_boy=0, counter_girl=0; scanf("%d %d", &n, &m); for(i=0; i<100; i++) { boy[i] = 0; girl[i] = 0; } scanf("%d", &happy_boys); for (i=0; i <...
Drazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan.There are n boys and m girls among his friends. Let's number them from 0 to n - 1 and 0 to m - 1 separately. In i-th day, Drazil invites -th boy and -th girl...
If Drazil can make all his friends become happy by this plan, print "Yes". Otherwise, print "No".
C
65efbc0a1ad82436100eea7a2378d4c2
5c04fa5b5b8c69333c74b2a6dee3a58a
GNU C
standard output
256 megabytes
train_001.jsonl
[ "dsu", "meet-in-the-middle", "number theory", "brute force" ]
1424190900
["2 3\n0\n1 0", "2 4\n1 0\n1 2", "2 3\n1 0\n1 1"]
NoteBy we define the remainder of integer division of i by k.In first sample case: On the 0-th day, Drazil invites 0-th boy and 0-th girl. Because 0-th girl is happy at the beginning, 0-th boy become happy at this day. On the 1-st day, Drazil invites 1-st boy and 1-st girl. They are both unhappy, so nothing changes...
PASSED
1,300
standard input
2 seconds
The first line contains two integer n and m (1 ≤ n, m ≤ 100). The second line contains integer b (0 ≤ b ≤ n), denoting the number of happy boys among friends of Drazil, and then follow b distinct integers x1, x2, ..., xb (0 ≤ xi &lt; n), denoting the list of indices of happy boys. The third line conatins integer g (0 ≤...
["Yes", "No", "Yes"]
#include <stdio.h> int main() { int boy[100], girl[100], happy_boys, happy_girls; int n, m, i, flag, temp, count=10001; int counter_boy=0, counter_girl=0; scanf("%d %d", &n, &m); for(i=0; i<100; i++) { boy[i] = 0; girl[i] = 0; } scanf("%d", &happy_boys); for (i=0; i <...
Vladik and Chloe decided to determine who of them is better at math. Vladik claimed that for any positive integer n he can represent fraction as a sum of three distinct positive fractions in form .Help Vladik with that, i.e for a given n find three distinct positive integers x, y and z such that . Because Chloe can't ...
If the answer exists, print 3 distinct numbers x, y and z (1 ≤ x, y, z ≤ 109, x ≠ y, x ≠ z, y ≠ z). Otherwise print -1. If there are multiple answers, print any of them.
C
f60ea0f2caaec16894e84ba87f90c061
85e9199263adc09a3112f48e8ae918bd
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "constructive algorithms", "number theory", "brute force", "math" ]
1481726100
["3", "7"]
null
PASSED
1,500
standard input
1 second
The single line contains single integer n (1 ≤ n ≤ 104).
["2 7 42", "7 8 56"]
#include<stdio.h> int main() { int n; scanf("%d",&n); if(n-1) printf("%d %d %d\n",n,n+1,(n*(n+1))); else printf("-1\n"); return 0; }
Vladik and Chloe decided to determine who of them is better at math. Vladik claimed that for any positive integer n he can represent fraction as a sum of three distinct positive fractions in form .Help Vladik with that, i.e for a given n find three distinct positive integers x, y and z such that . Because Chloe can't ...
If the answer exists, print 3 distinct numbers x, y and z (1 ≤ x, y, z ≤ 109, x ≠ y, x ≠ z, y ≠ z). Otherwise print -1. If there are multiple answers, print any of them.
C
f60ea0f2caaec16894e84ba87f90c061
c7e4db1cf6e6b8383756f754a931b683
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "constructive algorithms", "number theory", "brute force", "math" ]
1481726100
["3", "7"]
null
PASSED
1,500
standard input
1 second
The single line contains single integer n (1 ≤ n ≤ 104).
["2 7 42", "7 8 56"]
#include<stdio.h> #include<math.h> #include<stdlib.h> #include<string.h> int main() { int n; scanf("%d",&n); if(n==1) printf("-1\n"); else { printf("%d ",n); printf("%d ",n+1); printf("%d\n",n*(n+1)); } return 0; }
Vladik and Chloe decided to determine who of them is better at math. Vladik claimed that for any positive integer n he can represent fraction as a sum of three distinct positive fractions in form .Help Vladik with that, i.e for a given n find three distinct positive integers x, y and z such that . Because Chloe can't ...
If the answer exists, print 3 distinct numbers x, y and z (1 ≤ x, y, z ≤ 109, x ≠ y, x ≠ z, y ≠ z). Otherwise print -1. If there are multiple answers, print any of them.
C
f60ea0f2caaec16894e84ba87f90c061
3464b54caff1f7b44e7262e4e002e853
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "constructive algorithms", "number theory", "brute force", "math" ]
1481726100
["3", "7"]
null
PASSED
1,500
standard input
1 second
The single line contains single integer n (1 ≤ n ≤ 104).
["2 7 42", "7 8 56"]
#include <stdio.h> int main() { long int n; scanf("%d",&n); if(n!=1)printf("%ld %ld %ld",n,n+1,n*(n+1)); else printf("%ld",-1); return 0; }
Vladik and Chloe decided to determine who of them is better at math. Vladik claimed that for any positive integer n he can represent fraction as a sum of three distinct positive fractions in form .Help Vladik with that, i.e for a given n find three distinct positive integers x, y and z such that . Because Chloe can't ...
If the answer exists, print 3 distinct numbers x, y and z (1 ≤ x, y, z ≤ 109, x ≠ y, x ≠ z, y ≠ z). Otherwise print -1. If there are multiple answers, print any of them.
C
f60ea0f2caaec16894e84ba87f90c061
0076080de17603701b6f51c13c616c0a
GNU C11
standard output
256 megabytes
train_001.jsonl
[ "constructive algorithms", "number theory", "brute force", "math" ]
1481726100
["3", "7"]
null
PASSED
1,500
standard input
1 second
The single line contains single integer n (1 ≤ n ≤ 104).
["2 7 42", "7 8 56"]
#include<stdio.h> #include<math.h> #include<string.h> #include<stdlib.h> #include<limits.h> #define MOD 1000000007 #define PI 3.14159265 #define seive_len 1000001 int *array; int seive[seive_len]; int prime_prime[seive_len]; int min(int a, int b) { return a<b?a:b; } int max(int a, int b) { return a>b?a:b; } ...