prob_desc_description stringlengths 63 3.8k | prob_desc_output_spec stringlengths 17 1.47k β | lang_cluster stringclasses 2
values | src_uid stringlengths 32 32 | code_uid stringlengths 32 32 | lang stringclasses 7
values | prob_desc_output_to stringclasses 3
values | prob_desc_memory_limit stringclasses 19
values | file_name stringclasses 111
values | tags listlengths 0 11 | prob_desc_created_at stringlengths 10 10 | prob_desc_sample_inputs stringlengths 2 802 | prob_desc_notes stringlengths 4 3k β | exec_outcome stringclasses 1
value | difficulty int64 -1 3.5k β | prob_desc_input_from stringclasses 3
values | prob_desc_time_limit stringclasses 27
values | prob_desc_input_spec stringlengths 28 2.42k β | prob_desc_sample_outputs stringlengths 2 796 | source_code stringlengths 42 65.5k | hidden_unit_tests stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
In a small restaurant there are a tables for one person and b tables for two persons. It it known that n groups of people come today, each consisting of one or two people. If a group consist of one person, it is seated at a vacant one-seater table. If there are none of them, it is seated at a vacant two-seater table. I... | Print the total number of people the restaurant denies service to. | C | e21e768dbb2e5f72873dc1c7de4879fd | d83f0f4ca96f96da04883818e8c48c64 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1499791500 | ["4 1 2\n1 2 1 1", "4 1 1\n1 1 2 1"] | NoteIn the first example the first group consists of one person, it is seated at a vacant one-seater table. The next group occupies a whole two-seater table. The third group consists of one person, it occupies one place at the remaining two-seater table. The fourth group consists of one person, he is seated at the rema... | PASSED | 1,200 | standard input | 1 second | The first line contains three integers n, a and b (1ββ€βnββ€β2Β·105, 1ββ€βa,βbββ€β2Β·105) β the number of groups coming to the restaurant, the number of one-seater and the number of two-seater tables. The second line contains a sequence of integers t1,βt2,β...,βtn (1ββ€βtiββ€β2) β the description of clients in chronological or... | ["0", "2"] | #include<stdio.h>
int main()
{
int i,j,n,rem=0,c=0,one_seat=0,two_seat=0,x=0;
scanf("%d%d%d",&n,&one_seat,&two_seat);
int ar[n];
for(i=0;i<n;i++)
{scanf("%d",&ar[i]);
}
for(i=0;i<n;i++)
{
if(ar[i]==1)
{
if(one_seat>0){
one_seat--;
... | |
In a small restaurant there are a tables for one person and b tables for two persons. It it known that n groups of people come today, each consisting of one or two people. If a group consist of one person, it is seated at a vacant one-seater table. If there are none of them, it is seated at a vacant two-seater table. I... | Print the total number of people the restaurant denies service to. | C | e21e768dbb2e5f72873dc1c7de4879fd | 5d7ecc944bddcfc264b5b666cfb204d9 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1499791500 | ["4 1 2\n1 2 1 1", "4 1 1\n1 1 2 1"] | NoteIn the first example the first group consists of one person, it is seated at a vacant one-seater table. The next group occupies a whole two-seater table. The third group consists of one person, it occupies one place at the remaining two-seater table. The fourth group consists of one person, he is seated at the rema... | PASSED | 1,200 | standard input | 1 second | The first line contains three integers n, a and b (1ββ€βnββ€β2Β·105, 1ββ€βa,βbββ€β2Β·105) β the number of groups coming to the restaurant, the number of one-seater and the number of two-seater tables. The second line contains a sequence of integers t1,βt2,β...,βtn (1ββ€βtiββ€β2) β the description of clients in chronological or... | ["0", "2"] | #include <stdio.h>
int main()
{
int n, a, b;
scanf("%d%d%d", &n, &a, &b);
int one = a, two = b, half = 0;
int deny = 0;
for (int i = 0; i < n; i++) {
int t;
scanf("%d", &t);
if (t == 1) {
if (one > 0)
one--;
else if (two > 0)
... | |
In a small restaurant there are a tables for one person and b tables for two persons. It it known that n groups of people come today, each consisting of one or two people. If a group consist of one person, it is seated at a vacant one-seater table. If there are none of them, it is seated at a vacant two-seater table. I... | Print the total number of people the restaurant denies service to. | C | e21e768dbb2e5f72873dc1c7de4879fd | 988fb7f34bef17d87172b751ff170d99 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1499791500 | ["4 1 2\n1 2 1 1", "4 1 1\n1 1 2 1"] | NoteIn the first example the first group consists of one person, it is seated at a vacant one-seater table. The next group occupies a whole two-seater table. The third group consists of one person, it occupies one place at the remaining two-seater table. The fourth group consists of one person, he is seated at the rema... | PASSED | 1,200 | standard input | 1 second | The first line contains three integers n, a and b (1ββ€βnββ€β2Β·105, 1ββ€βa,βbββ€β2Β·105) β the number of groups coming to the restaurant, the number of one-seater and the number of two-seater tables. The second line contains a sequence of integers t1,βt2,β...,βtn (1ββ€βtiββ€β2) β the description of clients in chronological or... | ["0", "2"] | #include <stdio.h>
int main(){
unsigned long int n, a, b, b2, i, denyMan=0;
scanf("%d%d%d", &n, &a, &b);
int sComer[200000];
b2=2*b;
for(i=0;i<n;i++){
scanf("%d", &sComer[i]);
if(sComer[i]==1){
if(a>0)a--;
else if(b!=0){
b2--;
b--;
}
else if(b2>0)b2--;
else denyMan++;
}
else if(sComer[i]==2){
if(b>0){
b--;
... | |
In a small restaurant there are a tables for one person and b tables for two persons. It it known that n groups of people come today, each consisting of one or two people. If a group consist of one person, it is seated at a vacant one-seater table. If there are none of them, it is seated at a vacant two-seater table. I... | Print the total number of people the restaurant denies service to. | C | e21e768dbb2e5f72873dc1c7de4879fd | e9905fcf416561226603a31d828ce84d | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1499791500 | ["4 1 2\n1 2 1 1", "4 1 1\n1 1 2 1"] | NoteIn the first example the first group consists of one person, it is seated at a vacant one-seater table. The next group occupies a whole two-seater table. The third group consists of one person, it occupies one place at the remaining two-seater table. The fourth group consists of one person, he is seated at the rema... | PASSED | 1,200 | standard input | 1 second | The first line contains three integers n, a and b (1ββ€βnββ€β2Β·105, 1ββ€βa,βbββ€β2Β·105) β the number of groups coming to the restaurant, the number of one-seater and the number of two-seater tables. The second line contains a sequence of integers t1,βt2,β...,βtn (1ββ€βtiββ€β2) β the description of clients in chronological or... | ["0", "2"] | #include<stdio.h>
int main()
{
int n,t1,t2,people[200000],t=0,i,sum=0;
scanf("%d%d%d",&n,&t1,&t2);
t2*=2;
for(i=0;i<n;i++)
{
scanf("%d",&people[i]);
if(people[i]==1)
{
if(t1)
t1-=1;
else if(t2)
{
t2-=2;
... | |
In a small restaurant there are a tables for one person and b tables for two persons. It it known that n groups of people come today, each consisting of one or two people. If a group consist of one person, it is seated at a vacant one-seater table. If there are none of them, it is seated at a vacant two-seater table. I... | Print the total number of people the restaurant denies service to. | C | e21e768dbb2e5f72873dc1c7de4879fd | 08c6bb04e9cedf26f087b0416bce560d | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1499791500 | ["4 1 2\n1 2 1 1", "4 1 1\n1 1 2 1"] | NoteIn the first example the first group consists of one person, it is seated at a vacant one-seater table. The next group occupies a whole two-seater table. The third group consists of one person, it occupies one place at the remaining two-seater table. The fourth group consists of one person, he is seated at the rema... | PASSED | 1,200 | standard input | 1 second | The first line contains three integers n, a and b (1ββ€βnββ€β2Β·105, 1ββ€βa,βbββ€β2Β·105) β the number of groups coming to the restaurant, the number of one-seater and the number of two-seater tables. The second line contains a sequence of integers t1,βt2,β...,βtn (1ββ€βtiββ€β2) β the description of clients in chronological or... | ["0", "2"] | #include<stdio.h>
int main()
{
int n, a, b, occupy = 0, cut = 0;
scanf("%d %d %d", &n, &a, &b);
for (int i = 0; i < n; i++)
{
int m;
scanf("%d", &m);
if (m == 2)
{
if (b > 0)
b--;
else
cut += 2;
}
else
{
if (a > 0)
a--;
else if (b > 0)
{
b--;
occupy++;
}
else i... | |
You have integer $$$n$$$. Calculate how many ways are there to fully cover belt-like area of $$$4n-2$$$ triangles with diamond shapes. Diamond shape consists of two triangles. You can move, rotate or flip the shape, but you cannot scale it. $$$2$$$ coverings are different if some $$$2$$$ triangles are covered by the sa... | For each test case, print the number of ways to fully cover belt-like area of $$$4n-2$$$ triangles using diamond shape. It can be shown that under given constraints this number of ways doesn't exceed $$$10^{18}$$$. | C | 740c05c036b646d8fb6b391af115d7f0 | eac72367be4b2c270300ee28c6773579 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"implementation",
"brute force",
"math"
] | 1586700300 | ["2\n2\n1"] | NoteIn the first test case, there are the following $$$2$$$ ways to fill the area: In the second test case, there is a unique way to fill the area: | PASSED | 900 | standard input | 1 second | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^{4}$$$)Β β the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^{9}$$$). | ["2\n1"] | #include <stdio.h>
int main()
{
int tc;
scanf("%d",&tc);
while(tc--){
long long n;
scanf("%lld",&n);
printf ("%lld\n",n);
}
} | |
You have integer $$$n$$$. Calculate how many ways are there to fully cover belt-like area of $$$4n-2$$$ triangles with diamond shapes. Diamond shape consists of two triangles. You can move, rotate or flip the shape, but you cannot scale it. $$$2$$$ coverings are different if some $$$2$$$ triangles are covered by the sa... | For each test case, print the number of ways to fully cover belt-like area of $$$4n-2$$$ triangles using diamond shape. It can be shown that under given constraints this number of ways doesn't exceed $$$10^{18}$$$. | C | 740c05c036b646d8fb6b391af115d7f0 | a55b54ce6bd2e04dc27a0b27b5f4218f | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"implementation",
"brute force",
"math"
] | 1586700300 | ["2\n2\n1"] | NoteIn the first test case, there are the following $$$2$$$ ways to fill the area: In the second test case, there is a unique way to fill the area: | PASSED | 900 | standard input | 1 second | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^{4}$$$)Β β the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^{9}$$$). | ["2\n1"] | #include<stdio.h>
int main()
{
int n,t,i;
scanf("%d",&t);
for(i=0;i<t;i++){
scanf("%d",&n);
printf("%d\n",n);
}
return 0;
}
| |
You have integer $$$n$$$. Calculate how many ways are there to fully cover belt-like area of $$$4n-2$$$ triangles with diamond shapes. Diamond shape consists of two triangles. You can move, rotate or flip the shape, but you cannot scale it. $$$2$$$ coverings are different if some $$$2$$$ triangles are covered by the sa... | For each test case, print the number of ways to fully cover belt-like area of $$$4n-2$$$ triangles using diamond shape. It can be shown that under given constraints this number of ways doesn't exceed $$$10^{18}$$$. | C | 740c05c036b646d8fb6b391af115d7f0 | b4c16321f5517e1e38e93b83c7b4b441 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"implementation",
"brute force",
"math"
] | 1586700300 | ["2\n2\n1"] | NoteIn the first test case, there are the following $$$2$$$ ways to fill the area: In the second test case, there is a unique way to fill the area: | PASSED | 900 | standard input | 1 second | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^{4}$$$)Β β the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^{9}$$$). | ["2\n1"] | #include<stdio.h>
int main()
{
int n,t;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
printf("%d\n",n);
}
} | |
You have integer $$$n$$$. Calculate how many ways are there to fully cover belt-like area of $$$4n-2$$$ triangles with diamond shapes. Diamond shape consists of two triangles. You can move, rotate or flip the shape, but you cannot scale it. $$$2$$$ coverings are different if some $$$2$$$ triangles are covered by the sa... | For each test case, print the number of ways to fully cover belt-like area of $$$4n-2$$$ triangles using diamond shape. It can be shown that under given constraints this number of ways doesn't exceed $$$10^{18}$$$. | C | 740c05c036b646d8fb6b391af115d7f0 | 27ea19648ff1962fd5d99ad93e6e3ad8 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"implementation",
"brute force",
"math"
] | 1586700300 | ["2\n2\n1"] | NoteIn the first test case, there are the following $$$2$$$ ways to fill the area: In the second test case, there is a unique way to fill the area: | PASSED | 900 | standard input | 1 second | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^{4}$$$)Β β the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^{9}$$$). | ["2\n1"] | #include<stdio.h>
int main()
{
int t,n,i,a;
scanf("%d",&t);
for(i=0;i<t;i++){
scanf("%d",&n);
switch(n){
case 1:printf("1\n");
break;
default:printf("%d\n",n);
}
}
}
| |
You have integer $$$n$$$. Calculate how many ways are there to fully cover belt-like area of $$$4n-2$$$ triangles with diamond shapes. Diamond shape consists of two triangles. You can move, rotate or flip the shape, but you cannot scale it. $$$2$$$ coverings are different if some $$$2$$$ triangles are covered by the sa... | For each test case, print the number of ways to fully cover belt-like area of $$$4n-2$$$ triangles using diamond shape. It can be shown that under given constraints this number of ways doesn't exceed $$$10^{18}$$$. | C | 740c05c036b646d8fb6b391af115d7f0 | b0c130ed9a4ee532bfb882a67424ac28 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"implementation",
"brute force",
"math"
] | 1586700300 | ["2\n2\n1"] | NoteIn the first test case, there are the following $$$2$$$ ways to fill the area: In the second test case, there is a unique way to fill the area: | PASSED | 900 | standard input | 1 second | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^{4}$$$)Β β the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^{9}$$$). | ["2\n1"] | #include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t--){
int n;
scanf("%d",&n);
printf("%d\n",n);
}
return 0;
} | |
You have integer $$$n$$$. Calculate how many ways are there to fully cover belt-like area of $$$4n-2$$$ triangles with diamond shapes. Diamond shape consists of two triangles. You can move, rotate or flip the shape, but you cannot scale it. $$$2$$$ coverings are different if some $$$2$$$ triangles are covered by the sa... | For each test case, print the number of ways to fully cover belt-like area of $$$4n-2$$$ triangles using diamond shape. It can be shown that under given constraints this number of ways doesn't exceed $$$10^{18}$$$. | C | 740c05c036b646d8fb6b391af115d7f0 | 8227d523e748f3124fd5f6913a4feb58 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"implementation",
"brute force",
"math"
] | 1586700300 | ["2\n2\n1"] | NoteIn the first test case, there are the following $$$2$$$ ways to fill the area: In the second test case, there is a unique way to fill the area: | PASSED | 900 | standard input | 1 second | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^{4}$$$)Β β the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^{9}$$$). | ["2\n1"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int i, j;
scanf("%d",&i);
int arr[i];
for(j=0;j<i;j++)
{
scanf("%d",&arr[j]);
}
for(;j>=0;j--)
{
arr[j]=(arr[j]);
}
for(j=0;j<i;j++)
{
printf("%d \n",arr[j]);
}
return 0;
}
| |
You have integer $$$n$$$. Calculate how many ways are there to fully cover belt-like area of $$$4n-2$$$ triangles with diamond shapes. Diamond shape consists of two triangles. You can move, rotate or flip the shape, but you cannot scale it. $$$2$$$ coverings are different if some $$$2$$$ triangles are covered by the sa... | For each test case, print the number of ways to fully cover belt-like area of $$$4n-2$$$ triangles using diamond shape. It can be shown that under given constraints this number of ways doesn't exceed $$$10^{18}$$$. | C | 740c05c036b646d8fb6b391af115d7f0 | dab92515d7cf469b7eac98f0e69b58d6 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"implementation",
"brute force",
"math"
] | 1586700300 | ["2\n2\n1"] | NoteIn the first test case, there are the following $$$2$$$ ways to fill the area: In the second test case, there is a unique way to fill the area: | PASSED | 900 | standard input | 1 second | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^{4}$$$)Β β the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^{9}$$$). | ["2\n1"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int i, j;
scanf("%d",&i);
int arr[i];
for(j=0;j<i;j++)
{
scanf("%d",&arr[j]);
}
for(j=0;j<i;j++)
{
printf("%d \n",arr[j]);
}
return 0;
}
| |
You have integer $$$n$$$. Calculate how many ways are there to fully cover belt-like area of $$$4n-2$$$ triangles with diamond shapes. Diamond shape consists of two triangles. You can move, rotate or flip the shape, but you cannot scale it. $$$2$$$ coverings are different if some $$$2$$$ triangles are covered by the sa... | For each test case, print the number of ways to fully cover belt-like area of $$$4n-2$$$ triangles using diamond shape. It can be shown that under given constraints this number of ways doesn't exceed $$$10^{18}$$$. | C | 740c05c036b646d8fb6b391af115d7f0 | 2645c16b2fd431e3e6b547f3f89562ba | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"implementation",
"brute force",
"math"
] | 1586700300 | ["2\n2\n1"] | NoteIn the first test case, there are the following $$$2$$$ ways to fill the area: In the second test case, there is a unique way to fill the area: | PASSED | 900 | standard input | 1 second | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^{4}$$$)Β β the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^{9}$$$). | ["2\n1"] | #include<stdio.h>
int main(void)
{
long long t;
long long n;
scanf("%lld", &t);
while (t--)
{
scanf("%lld", &n);
printf("%lld\n", n);
}
return 0;
} | |
You have integer $$$n$$$. Calculate how many ways are there to fully cover belt-like area of $$$4n-2$$$ triangles with diamond shapes. Diamond shape consists of two triangles. You can move, rotate or flip the shape, but you cannot scale it. $$$2$$$ coverings are different if some $$$2$$$ triangles are covered by the sa... | For each test case, print the number of ways to fully cover belt-like area of $$$4n-2$$$ triangles using diamond shape. It can be shown that under given constraints this number of ways doesn't exceed $$$10^{18}$$$. | C | 740c05c036b646d8fb6b391af115d7f0 | cf41150a3b812b7c76fcfa3b3891aee4 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"implementation",
"brute force",
"math"
] | 1586700300 | ["2\n2\n1"] | NoteIn the first test case, there are the following $$$2$$$ ways to fill the area: In the second test case, there is a unique way to fill the area: | PASSED | 900 | standard input | 1 second | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^{4}$$$)Β β the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^{9}$$$). | ["2\n1"] | #include <stdio.h>
int main()
{
long long int t, n;
scanf("%lld\n", &t);
for (long long i = 0; i < t; i++)
{
scanf("%lld\n", &n);
printf("%lld\n", n);
}
return 0;
}
| |
You have integer $$$n$$$. Calculate how many ways are there to fully cover belt-like area of $$$4n-2$$$ triangles with diamond shapes. Diamond shape consists of two triangles. You can move, rotate or flip the shape, but you cannot scale it. $$$2$$$ coverings are different if some $$$2$$$ triangles are covered by the sa... | For each test case, print the number of ways to fully cover belt-like area of $$$4n-2$$$ triangles using diamond shape. It can be shown that under given constraints this number of ways doesn't exceed $$$10^{18}$$$. | C | 740c05c036b646d8fb6b391af115d7f0 | 54c0370593eccb28337e8c0d3cdee479 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"implementation",
"brute force",
"math"
] | 1586700300 | ["2\n2\n1"] | NoteIn the first test case, there are the following $$$2$$$ ways to fill the area: In the second test case, there is a unique way to fill the area: | PASSED | 900 | standard input | 1 second | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^{4}$$$)Β β the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^{9}$$$). | ["2\n1"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
long long int t;
scanf("%lld", &t);
do
{
long long int n;
scanf("%lld", &n);
printf("%lld\n", n);
--t;
} while ( t != 0 );
//system("pause");
} | |
You have integer $$$n$$$. Calculate how many ways are there to fully cover belt-like area of $$$4n-2$$$ triangles with diamond shapes. Diamond shape consists of two triangles. You can move, rotate or flip the shape, but you cannot scale it. $$$2$$$ coverings are different if some $$$2$$$ triangles are covered by the sa... | For each test case, print the number of ways to fully cover belt-like area of $$$4n-2$$$ triangles using diamond shape. It can be shown that under given constraints this number of ways doesn't exceed $$$10^{18}$$$. | C | 740c05c036b646d8fb6b391af115d7f0 | 392ae6ae50b2d4d6020effd978cc682d | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"implementation",
"brute force",
"math"
] | 1586700300 | ["2\n2\n1"] | NoteIn the first test case, there are the following $$$2$$$ ways to fill the area: In the second test case, there is a unique way to fill the area: | PASSED | 900 | standard input | 1 second | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^{4}$$$)Β β the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^{9}$$$). | ["2\n1"] | #include <stdio.h>
#include <stdlib.h>
int main (void) {
int t;
scanf("%d",&t);
int n[t];
for(int i=0;i<t;i++)
scanf("%d",&n[i]);
for(int i=0;i<t;i++)
printf("%d\n",n[i]);
return 0;
} | |
You have integer $$$n$$$. Calculate how many ways are there to fully cover belt-like area of $$$4n-2$$$ triangles with diamond shapes. Diamond shape consists of two triangles. You can move, rotate or flip the shape, but you cannot scale it. $$$2$$$ coverings are different if some $$$2$$$ triangles are covered by the sa... | For each test case, print the number of ways to fully cover belt-like area of $$$4n-2$$$ triangles using diamond shape. It can be shown that under given constraints this number of ways doesn't exceed $$$10^{18}$$$. | C | 740c05c036b646d8fb6b391af115d7f0 | cee2d4795c9289029381c94df8ad410e | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"implementation",
"brute force",
"math"
] | 1586700300 | ["2\n2\n1"] | NoteIn the first test case, there are the following $$$2$$$ ways to fill the area: In the second test case, there is a unique way to fill the area: | PASSED | 900 | standard input | 1 second | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^{4}$$$)Β β the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^{9}$$$). | ["2\n1"] | #include <stdio.h>
#include <string.h>
#include <math.h>
int main()
{
long long int i,j,k,n,m,x,y,z,t;
scanf("%lld",&t);
for(long long int z1=0;z1<t;z1++)
{
scanf("%lld",&n);
printf("%lld\n",n);
}
} | |
You have integer $$$n$$$. Calculate how many ways are there to fully cover belt-like area of $$$4n-2$$$ triangles with diamond shapes. Diamond shape consists of two triangles. You can move, rotate or flip the shape, but you cannot scale it. $$$2$$$ coverings are different if some $$$2$$$ triangles are covered by the sa... | For each test case, print the number of ways to fully cover belt-like area of $$$4n-2$$$ triangles using diamond shape. It can be shown that under given constraints this number of ways doesn't exceed $$$10^{18}$$$. | C | 740c05c036b646d8fb6b391af115d7f0 | 9d0545edd3df48949aa8868921ac4431 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"implementation",
"brute force",
"math"
] | 1586700300 | ["2\n2\n1"] | NoteIn the first test case, there are the following $$$2$$$ ways to fill the area: In the second test case, there is a unique way to fill the area: | PASSED | 900 | standard input | 1 second | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^{4}$$$)Β β the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^{9}$$$). | ["2\n1"] | #include<stdio.h>
long long int t, n[10000];
int main()
{
scanf("%d",&t);
int i;
for (i = 0; i < t; i++)
{
scanf("%d", &n[i]);
}
for (i = 0; i < t; i++)
{
printf("%d\n", n[i]);
}
return 0;
} | |
You have integer $$$n$$$. Calculate how many ways are there to fully cover belt-like area of $$$4n-2$$$ triangles with diamond shapes. Diamond shape consists of two triangles. You can move, rotate or flip the shape, but you cannot scale it. $$$2$$$ coverings are different if some $$$2$$$ triangles are covered by the sa... | For each test case, print the number of ways to fully cover belt-like area of $$$4n-2$$$ triangles using diamond shape. It can be shown that under given constraints this number of ways doesn't exceed $$$10^{18}$$$. | C | 740c05c036b646d8fb6b391af115d7f0 | f91f8684cbfeec6952c00ca4e607d36b | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"implementation",
"brute force",
"math"
] | 1586700300 | ["2\n2\n1"] | NoteIn the first test case, there are the following $$$2$$$ ways to fill the area: In the second test case, there is a unique way to fill the area: | PASSED | 900 | standard input | 1 second | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^{4}$$$)Β β the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^{9}$$$). | ["2\n1"] | #include<stdio.h>
int main()
{
int a,b, n;
scanf("%d",&n);
for (int i=1;i<=n;i++)
{
scanf("%d",&a);
//scanf("%d",&b);
printf("%d\n",a);
//printf("%d\n",b);
}
}
| |
You have integer $$$n$$$. Calculate how many ways are there to fully cover belt-like area of $$$4n-2$$$ triangles with diamond shapes. Diamond shape consists of two triangles. You can move, rotate or flip the shape, but you cannot scale it. $$$2$$$ coverings are different if some $$$2$$$ triangles are covered by the sa... | For each test case, print the number of ways to fully cover belt-like area of $$$4n-2$$$ triangles using diamond shape. It can be shown that under given constraints this number of ways doesn't exceed $$$10^{18}$$$. | C | 740c05c036b646d8fb6b391af115d7f0 | 89823aa620d6492c3667e775963f323e | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"implementation",
"brute force",
"math"
] | 1586700300 | ["2\n2\n1"] | NoteIn the first test case, there are the following $$$2$$$ ways to fill the area: In the second test case, there is a unique way to fill the area: | PASSED | 900 | standard input | 1 second | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^{4}$$$)Β β the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^{9}$$$). | ["2\n1"] | #include<stdio.h>
int main() {
int t,n;
scanf("%d",&t);
while(t--) {
scanf("%d",&n);
printf("%d\n",n);
}
return 0;
}
| |
A colored stripe is represented by a horizontal row of n square cells, each cell is pained one of k colors. Your task is to repaint the minimum number of cells so that no two neighbouring cells are of the same color. You can use any color from 1 to k to repaint the cells. | Print a single integer β the required minimum number of repaintings. In the second line print any possible variant of the repainted stripe. | C | 0ecf60ea733eba71ef1cc1e736296d96 | 5d4103eff3ce43dbe45b83500305b521 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"greedy",
"brute force"
] | 1346081400 | ["6 3\nABBACC", "3 2\nBBB"] | null | PASSED | 1,600 | standard input | 2 seconds | The first input line contains two integers n and k (1ββ€βnββ€β5Β·105;Β 2ββ€βkββ€β26). The second line contains n uppercase English letters. Letter "A" stands for the first color, letter "B" stands for the second color and so on. The first k English letters may be used. Each letter represents the color of the corresponding ce... | ["2\nABCACA", "1\nBAB"] | #include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#define MAXLEN 1000000
#define min(a, b) (((a) < (b)) ? (a) : (b))
int k, n, bad, d[MAXLEN][2] ;
char s[MAXLEN], ans[MAXLEN];
char
another(char z, char z1)
{
char res = ((z == 'A' + k - 1) ? 'A' : z + 1);
if (res == z1){
res = ((res == 'A' + k ... | |
A colored stripe is represented by a horizontal row of n square cells, each cell is pained one of k colors. Your task is to repaint the minimum number of cells so that no two neighbouring cells are of the same color. You can use any color from 1 to k to repaint the cells. | Print a single integer β the required minimum number of repaintings. In the second line print any possible variant of the repainted stripe. | C | 0ecf60ea733eba71ef1cc1e736296d96 | ca03f6c2ff0cd23e6443add583ffca2b | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"greedy",
"brute force"
] | 1346081400 | ["6 3\nABBACC", "3 2\nBBB"] | null | PASSED | 1,600 | standard input | 2 seconds | The first input line contains two integers n and k (1ββ€βnββ€β5Β·105;Β 2ββ€βkββ€β26). The second line contains n uppercase English letters. Letter "A" stands for the first color, letter "B" stands for the second color and so on. The first k English letters may be used. Each letter represents the color of the corresponding ce... | ["2\nABCACA", "1\nBAB"] | #include<stdio.h>
#include<string.h>
char q[500000];
int main(void)
{
int i=0,j,n,k,len,tmp1,tmp2,ans;
scanf("%d %d",&n,&k);
getchar();
scanf("%s",q);
len=strlen(q);
if(k==2)
{
tmp1=0;tmp2=0;
for(i=0;i<len;i+=2)
{
if(q[i]=='B') tmp1++;
if(q[i+1... | |
A colored stripe is represented by a horizontal row of n square cells, each cell is pained one of k colors. Your task is to repaint the minimum number of cells so that no two neighbouring cells are of the same color. You can use any color from 1 to k to repaint the cells. | Print a single integer β the required minimum number of repaintings. In the second line print any possible variant of the repainted stripe. | C | 0ecf60ea733eba71ef1cc1e736296d96 | b745e21fecd0a42f4874867a46aa7415 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"greedy",
"brute force"
] | 1346081400 | ["6 3\nABBACC", "3 2\nBBB"] | null | PASSED | 1,600 | standard input | 2 seconds | The first input line contains two integers n and k (1ββ€βnββ€β5Β·105;Β 2ββ€βkββ€β26). The second line contains n uppercase English letters. Letter "A" stands for the first color, letter "B" stands for the second color and so on. The first k English letters may be used. Each letter represents the color of the corresponding ce... | ["2\nABCACA", "1\nBAB"] | #include <stdio.h>
#define LIMIT 500005
#define EMPTY -1
char ch[LIMIT][26],a[LIMIT];
int f[LIMIT][26];
int main()
{
int i,j,k,n,p,t,tmp;
while (scanf("%d%d%s",&n,&k,a)!=EOF) {
for (i=0; i<k; ++i)
f[0][i]=1;
f[0][a[0]-'A']=0;
for (i=1; i<n; ++i)
for (j=0; j<k; ... | |
A colored stripe is represented by a horizontal row of n square cells, each cell is pained one of k colors. Your task is to repaint the minimum number of cells so that no two neighbouring cells are of the same color. You can use any color from 1 to k to repaint the cells. | Print a single integer β the required minimum number of repaintings. In the second line print any possible variant of the repainted stripe. | C | 0ecf60ea733eba71ef1cc1e736296d96 | 7cd92a4a9cdf4b0593118642444ae938 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"greedy",
"brute force"
] | 1346081400 | ["6 3\nABBACC", "3 2\nBBB"] | null | PASSED | 1,600 | standard input | 2 seconds | The first input line contains two integers n and k (1ββ€βnββ€β5Β·105;Β 2ββ€βkββ€β26). The second line contains n uppercase English letters. Letter "A" stands for the first color, letter "B" stands for the second color and so on. The first k English letters may be used. Each letter represents the color of the corresponding ce... | ["2\nABCACA", "1\nBAB"] | #include <stdio.h>
int main()
{
int n,k,i,j,t,sum0,x,sum1,sum;
char ch[500005],c;
while(scanf("%d%d",&n,&k)!=EOF)
{
sum=0;
sum1=0;
sum0=0;
getchar();
for(i=0;i<n;i++)
scanf("%c",&ch[i]);
if(k==2)
{
for(i=0;i<n;i++)
... | |
A colored stripe is represented by a horizontal row of n square cells, each cell is pained one of k colors. Your task is to repaint the minimum number of cells so that no two neighbouring cells are of the same color. You can use any color from 1 to k to repaint the cells. | Print a single integer β the required minimum number of repaintings. In the second line print any possible variant of the repainted stripe. | C | 0ecf60ea733eba71ef1cc1e736296d96 | 9d9484c4598150a207fa4e28bb7101ec | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"greedy",
"brute force"
] | 1346081400 | ["6 3\nABBACC", "3 2\nBBB"] | null | PASSED | 1,600 | standard input | 2 seconds | The first input line contains two integers n and k (1ββ€βnββ€β5Β·105;Β 2ββ€βkββ€β26). The second line contains n uppercase English letters. Letter "A" stands for the first color, letter "B" stands for the second color and so on. The first k English letters may be used. Each letter represents the color of the corresponding ce... | ["2\nABCACA", "1\nBAB"] | #include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
int n,k;
char str[555555];
int letter[50][50];
void init(){
int i,j,t;
for(i=1;i<=k;i++){
for(j=i;j<=k;j++){
if(i==j){
if(i==k) t = i-1;
else t = i+1;
} else {
... | |
A colored stripe is represented by a horizontal row of n square cells, each cell is pained one of k colors. Your task is to repaint the minimum number of cells so that no two neighbouring cells are of the same color. You can use any color from 1 to k to repaint the cells. | Print a single integer β the required minimum number of repaintings. In the second line print any possible variant of the repainted stripe. | C | 0ecf60ea733eba71ef1cc1e736296d96 | 946f3db53024b395a8d93a07a1d630fb | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"greedy",
"brute force"
] | 1346081400 | ["6 3\nABBACC", "3 2\nBBB"] | null | PASSED | 1,600 | standard input | 2 seconds | The first input line contains two integers n and k (1ββ€βnββ€β5Β·105;Β 2ββ€βkββ€β26). The second line contains n uppercase English letters. Letter "A" stands for the first color, letter "B" stands for the second color and so on. The first k English letters may be used. Each letter represents the color of the corresponding ce... | ["2\nABCACA", "1\nBAB"] | #include<stdio.h>
int a[500000] = {};
char s[500001];
int main(){
int n, k, c = 0, i, j;
scanf("%d%d%s", &n, &k, s);
if (k > 2){
for (i = 0 ; i < n ; ++i){
if (s[i] == s[i + 1]){
for (j = 0 ; j < k - 1 ; ++j){
if ('A' + j != s[i] && 'A' + j != s[i + 2])
... | |
A colored stripe is represented by a horizontal row of n square cells, each cell is pained one of k colors. Your task is to repaint the minimum number of cells so that no two neighbouring cells are of the same color. You can use any color from 1 to k to repaint the cells. | Print a single integer β the required minimum number of repaintings. In the second line print any possible variant of the repainted stripe. | C | 0ecf60ea733eba71ef1cc1e736296d96 | 0149d0477e61b5566ec47a0b0404341c | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"greedy",
"brute force"
] | 1346081400 | ["6 3\nABBACC", "3 2\nBBB"] | null | PASSED | 1,600 | standard input | 2 seconds | The first input line contains two integers n and k (1ββ€βnββ€β5Β·105;Β 2ββ€βkββ€β26). The second line contains n uppercase English letters. Letter "A" stands for the first color, letter "B" stands for the second color and so on. The first k English letters may be used. Each letter represents the color of the corresponding ce... | ["2\nABCACA", "1\nBAB"] | #include<stdio.h>
main()
{
char a[26],s[500002];
int n,k,t=0,x,y;
scanf("%d%d%s",&n,&k,s);
s[n]='a';s[n+1]='\0';
for(x=0;x<k;a[x]=65+x,x++);
if(k!=2)
{
for(x=1;x<n;x++)
{
if(s[x]==s[x-1])
{t++;
for(y=0;y<k;y++)
{
... | |
Toad Rash has a binary string $$$s$$$. A binary string consists only of zeros and ones.Let $$$n$$$ be the length of $$$s$$$.Rash needs to find the number of such pairs of integers $$$l$$$, $$$r$$$ that $$$1 \leq l \leq r \leq n$$$ and there is at least one pair of integers $$$x$$$, $$$k$$$ such that $$$1 \leq x, k \leq... | Output one integer: the number of such pairs of integers $$$l$$$, $$$r$$$ that $$$1 \leq l \leq r \leq n$$$ and there is at least one pair of integers $$$x$$$, $$$k$$$ such that $$$1 \leq x, k \leq n$$$, $$$l \leq x < x + 2k \leq r$$$, and $$$s_x = s_{x+k} = s_{x+2k}$$$. | C | 71bace75df1279ae55a6e755159d4191 | 1e9421d4400257c354c1894fd0428166 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"brute force"
] | 1558884900 | ["010101", "11001100"] | NoteIn the first example, there are three $$$l$$$, $$$r$$$ pairs we need to count: $$$1$$$, $$$6$$$; $$$2$$$, $$$6$$$; and $$$1$$$, $$$5$$$.In the second example, there are no values $$$x$$$, $$$k$$$ for the initial string, so the answer is $$$0$$$. | PASSED | 1,900 | standard input | 4 seconds | The first line contains the string $$$s$$$ ($$$1 \leq |s| \leq 300\,000$$$), consisting of zeros and ones. | ["3", "0"] | /* https://codeforces.com/blog/entry/67189?#comment-513690 */
/* upsolve with Dukkha */
#include <stdio.h>
#include <string.h>
#define N 300000
int main() {
static char cc[N + 1];
static char dp[N][9];
int n, i, k, good;
long long cnt;
scanf("%s", cc);
n = strlen(cc);
cnt = 0;
for (k = 3; k < 9; k++)
for (... | |
Toad Rash has a binary string $$$s$$$. A binary string consists only of zeros and ones.Let $$$n$$$ be the length of $$$s$$$.Rash needs to find the number of such pairs of integers $$$l$$$, $$$r$$$ that $$$1 \leq l \leq r \leq n$$$ and there is at least one pair of integers $$$x$$$, $$$k$$$ such that $$$1 \leq x, k \leq... | Output one integer: the number of such pairs of integers $$$l$$$, $$$r$$$ that $$$1 \leq l \leq r \leq n$$$ and there is at least one pair of integers $$$x$$$, $$$k$$$ such that $$$1 \leq x, k \leq n$$$, $$$l \leq x < x + 2k \leq r$$$, and $$$s_x = s_{x+k} = s_{x+2k}$$$. | C | 71bace75df1279ae55a6e755159d4191 | 1ac4133dca7f4cecb8d4aa42bbccdbda | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"brute force"
] | 1558884900 | ["010101", "11001100"] | NoteIn the first example, there are three $$$l$$$, $$$r$$$ pairs we need to count: $$$1$$$, $$$6$$$; $$$2$$$, $$$6$$$; and $$$1$$$, $$$5$$$.In the second example, there are no values $$$x$$$, $$$k$$$ for the initial string, so the answer is $$$0$$$. | PASSED | 1,900 | standard input | 4 seconds | The first line contains the string $$$s$$$ ($$$1 \leq |s| \leq 300\,000$$$), consisting of zeros and ones. | ["3", "0"] | #include <stdio.h>
#include <string.h>
char s[300003];
int dp[300003], i, n, k;
long long res;
int main()
{
scanf("%s", &s);
n = strlen(s);
dp[n] = n;
for(i = n-1; i >= 0; i --){
dp[i] = dp[i+1];
for(k = 1; i + (k<<1) < dp[i]; k ++)
if(s[i] == s[i+k] && s[i] == s[i+(k<<1)])
... | |
Barney lives in NYC. NYC has infinite number of intersections numbered with positive integers starting from 1. There exists a bidirectional road between intersections i and 2i and another road between i and 2iβ+β1 for every positive integer i. You can clearly see that there exists a unique shortest path between any two... | For each event of second type print the sum of passing fee of all roads Barney passes in this event, in one line. Print the answers in chronological order of corresponding events. | C | 12814033bec4956e7561767a6778d77e | 6ec6fd9f17bd88119e65656c61f96706 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"data structures",
"implementation",
"trees",
"brute force"
] | 1468514100 | ["7\n1 3 4 30\n1 4 1 2\n1 3 6 8\n2 4 3\n1 6 1 40\n2 3 7\n2 2 4"] | NoteIn the example testcase:Here are the intersections used: Intersections on the path are 3, 1, 2 and 4. Intersections on the path are 4, 2 and 1. Intersections on the path are only 3 and 6. Intersections on the path are 4, 2, 1 and 3. Passing fee of roads on the path are 32, 32 and 30 in order. So answer equals... | PASSED | 1,500 | standard input | 1 second | The first line of input contains a single integer q (1ββ€βqββ€β1β000). The next q lines contain the information about the events in chronological order. Each event is described in form 1 v u w if it's an event when government makes a new rule about increasing the passing fee of all roads on the shortest path from u to v ... | ["94\n0\n32"] | #include<stdio.h>
#include<string.h>
#define N 165003
long long key[N];
long long val[N];
long long calc(long long x){
long long val = x%N;
while(key[val] && key[val]!=x){
val++;
if(val>N)
val=1;
}
key[val]=x;
return val;
}
long long swap(long long *a,long long *b){
long long temp = *a;
*a=*b;
*b=temp;
}... | |
Barney lives in NYC. NYC has infinite number of intersections numbered with positive integers starting from 1. There exists a bidirectional road between intersections i and 2i and another road between i and 2iβ+β1 for every positive integer i. You can clearly see that there exists a unique shortest path between any two... | For each event of second type print the sum of passing fee of all roads Barney passes in this event, in one line. Print the answers in chronological order of corresponding events. | C | 12814033bec4956e7561767a6778d77e | b9523faa40d44c93902ea2c6362edcbe | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"data structures",
"implementation",
"trees",
"brute force"
] | 1468514100 | ["7\n1 3 4 30\n1 4 1 2\n1 3 6 8\n2 4 3\n1 6 1 40\n2 3 7\n2 2 4"] | NoteIn the example testcase:Here are the intersections used: Intersections on the path are 3, 1, 2 and 4. Intersections on the path are 4, 2 and 1. Intersections on the path are only 3 and 6. Intersections on the path are 4, 2, 1 and 3. Passing fee of roads on the path are 32, 32 and 30 in order. So answer equals... | PASSED | 1,500 | standard input | 1 second | The first line of input contains a single integer q (1ββ€βqββ€β1β000). The next q lines contain the information about the events in chronological order. Each event is described in form 1 v u w if it's an event when government makes a new rule about increasing the passing fee of all roads on the shortest path from u to v ... | ["94\n0\n32"] | #include<stdio.h>
#include<string.h>
#define N 165003
long long key[N];
long long val[N];
long long calc(long long x){
long long val = x%N;
while(key[val] && key[val]!=x){
val++;
if(val>N)
val=1;
}
key[val]=x;
return val;
}
long long swap(long long *a,long long *b){
long long temp = *a;
*a=*b;
*b=temp;
}... | |
Vasya owns a cornfield which can be defined with two integers $$$n$$$ and $$$d$$$. The cornfield can be represented as rectangle with vertices having Cartesian coordinates $$$(0, d), (d, 0), (n, n - d)$$$ and $$$(n - d, n)$$$. An example of a cornfield with $$$n = 7$$$ and $$$d = 2$$$. Vasya also knows that there ar... | Print $$$m$$$ lines. The $$$i$$$-th line should contain "YES" if the position of the $$$i$$$-th grasshopper lies inside or on the border of the cornfield. Otherwise the $$$i$$$-th line should contain "NO". You can print each letter in any case (upper or lower). | C | 9c84eb518c273942650c7262e5d8b45f | 04261a146bb878788bb78b8f0531062c | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"geometry"
] | 1537707900 | ["7 2\n4\n2 4\n4 1\n6 3\n4 5", "8 7\n4\n4 4\n2 8\n8 1\n6 1"] | NoteThe cornfield from the first example is pictured above. Grasshoppers with indices $$$1$$$ (coordinates $$$(2, 4)$$$) and $$$4$$$ (coordinates $$$(4, 5)$$$) are inside the cornfield.The cornfield from the second example is pictured below. Grasshoppers with indices $$$1$$$ (coordinates $$$(4, 4)$$$), $$$3$$$ (coordin... | PASSED | 1,100 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$d$$$ ($$$1 \le d < n \le 100$$$). The second line contains a single integer $$$m$$$ ($$$1 \le m \le 100$$$) β the number of grasshoppers. The $$$i$$$-th of the next $$$m$$$ lines contains two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \le x_i, y_i \le n$$$) β position ... | ["YES\nNO\nNO\nYES", "YES\nNO\nYES\nYES"] | #include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int main()
{
int n,d,m,x,y;
scanf("%d %d",&n,&d);
if(1<=d && d<n && n<=100)
scanf("%d",&m);
if(m>=1 && m<=100)
for(int i=0;i<m;i++)
{
scanf("%d %d",&x,&y);
if((x+y)>=d && (x+y)<=(2*n-d)&& (x-y)<=d && (x-y)>=(-d))
{
printf("YES\n"); ... | |
Vasya owns a cornfield which can be defined with two integers $$$n$$$ and $$$d$$$. The cornfield can be represented as rectangle with vertices having Cartesian coordinates $$$(0, d), (d, 0), (n, n - d)$$$ and $$$(n - d, n)$$$. An example of a cornfield with $$$n = 7$$$ and $$$d = 2$$$. Vasya also knows that there ar... | Print $$$m$$$ lines. The $$$i$$$-th line should contain "YES" if the position of the $$$i$$$-th grasshopper lies inside or on the border of the cornfield. Otherwise the $$$i$$$-th line should contain "NO". You can print each letter in any case (upper or lower). | C | 9c84eb518c273942650c7262e5d8b45f | 656648af4a870626c7d88b639c97b955 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"geometry"
] | 1537707900 | ["7 2\n4\n2 4\n4 1\n6 3\n4 5", "8 7\n4\n4 4\n2 8\n8 1\n6 1"] | NoteThe cornfield from the first example is pictured above. Grasshoppers with indices $$$1$$$ (coordinates $$$(2, 4)$$$) and $$$4$$$ (coordinates $$$(4, 5)$$$) are inside the cornfield.The cornfield from the second example is pictured below. Grasshoppers with indices $$$1$$$ (coordinates $$$(4, 4)$$$), $$$3$$$ (coordin... | PASSED | 1,100 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$d$$$ ($$$1 \le d < n \le 100$$$). The second line contains a single integer $$$m$$$ ($$$1 \le m \le 100$$$) β the number of grasshoppers. The $$$i$$$-th of the next $$$m$$$ lines contains two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \le x_i, y_i \le n$$$) β position ... | ["YES\nNO\nNO\nYES", "YES\nNO\nYES\nYES"] | /* Codeforces 1030B - Vasya and Cornfield*/
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#define MAX(a, b) ((a > b) ? a : b)
double distance(double, double, int, int, int); // Calculate the distance from (x, y) to a line
int main()
{
int n, d, m;
scanf("%d %d %d", &n, &d, &m);
double x, y; // Positi... | |
Vasya owns a cornfield which can be defined with two integers $$$n$$$ and $$$d$$$. The cornfield can be represented as rectangle with vertices having Cartesian coordinates $$$(0, d), (d, 0), (n, n - d)$$$ and $$$(n - d, n)$$$. An example of a cornfield with $$$n = 7$$$ and $$$d = 2$$$. Vasya also knows that there ar... | Print $$$m$$$ lines. The $$$i$$$-th line should contain "YES" if the position of the $$$i$$$-th grasshopper lies inside or on the border of the cornfield. Otherwise the $$$i$$$-th line should contain "NO". You can print each letter in any case (upper or lower). | C | 9c84eb518c273942650c7262e5d8b45f | 51eb5b3d9794e4b61fc02721d87fab25 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"geometry"
] | 1537707900 | ["7 2\n4\n2 4\n4 1\n6 3\n4 5", "8 7\n4\n4 4\n2 8\n8 1\n6 1"] | NoteThe cornfield from the first example is pictured above. Grasshoppers with indices $$$1$$$ (coordinates $$$(2, 4)$$$) and $$$4$$$ (coordinates $$$(4, 5)$$$) are inside the cornfield.The cornfield from the second example is pictured below. Grasshoppers with indices $$$1$$$ (coordinates $$$(4, 4)$$$), $$$3$$$ (coordin... | PASSED | 1,100 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$d$$$ ($$$1 \le d < n \le 100$$$). The second line contains a single integer $$$m$$$ ($$$1 \le m \le 100$$$) β the number of grasshoppers. The $$$i$$$-th of the next $$$m$$$ lines contains two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \le x_i, y_i \le n$$$) β position ... | ["YES\nNO\nNO\nYES", "YES\nNO\nYES\nYES"] | #include<stdio.h>
int main()
{
int i=0, n,m, x, y, d;
scanf("%d %d", &n,&d);
scanf("%d", &m);
for(i=0;i<m;i++)
{
scanf("%d %d", &x, &y);
if(y<=x+d&&y>=x-d)
{
if(y>=d-x&&y<=2*n-d-x)
printf("YES\n");
else
printf("NO\n");
}
else
{
printf("NO\n");
}
}
} | |
Vasya owns a cornfield which can be defined with two integers $$$n$$$ and $$$d$$$. The cornfield can be represented as rectangle with vertices having Cartesian coordinates $$$(0, d), (d, 0), (n, n - d)$$$ and $$$(n - d, n)$$$. An example of a cornfield with $$$n = 7$$$ and $$$d = 2$$$. Vasya also knows that there ar... | Print $$$m$$$ lines. The $$$i$$$-th line should contain "YES" if the position of the $$$i$$$-th grasshopper lies inside or on the border of the cornfield. Otherwise the $$$i$$$-th line should contain "NO". You can print each letter in any case (upper or lower). | C | 9c84eb518c273942650c7262e5d8b45f | f5f9ad8cf4dd5dd41ba1d74702897eac | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"geometry"
] | 1537707900 | ["7 2\n4\n2 4\n4 1\n6 3\n4 5", "8 7\n4\n4 4\n2 8\n8 1\n6 1"] | NoteThe cornfield from the first example is pictured above. Grasshoppers with indices $$$1$$$ (coordinates $$$(2, 4)$$$) and $$$4$$$ (coordinates $$$(4, 5)$$$) are inside the cornfield.The cornfield from the second example is pictured below. Grasshoppers with indices $$$1$$$ (coordinates $$$(4, 4)$$$), $$$3$$$ (coordin... | PASSED | 1,100 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$d$$$ ($$$1 \le d < n \le 100$$$). The second line contains a single integer $$$m$$$ ($$$1 \le m \le 100$$$) β the number of grasshoppers. The $$$i$$$-th of the next $$$m$$$ lines contains two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \le x_i, y_i \le n$$$) β position ... | ["YES\nNO\nNO\nYES", "YES\nNO\nYES\nYES"] | #include<stdio.h>
#include<math.h>
int main()
{
float A,A1,A2,A3,A4,a1,a2,a3,a4,b1,b2,b3,b4,u1,u2,u3,u4,s;
int n,d,x,y,m,i,s1,s2,l;
scanf("%d%d",&n,&d);
scanf("%d",&m);
for(i=0;i<m;i++){
A=0,A1=0,A2=0,A3=0,A4=0,a1=0,a2=0,a3=0,a4=0,b1=0,b2=0,b3=0,b4=0,u1=0,u2=0,u3=0,u4=0,s=0,s1=0,s2=0;
... | |
Vasya owns a cornfield which can be defined with two integers $$$n$$$ and $$$d$$$. The cornfield can be represented as rectangle with vertices having Cartesian coordinates $$$(0, d), (d, 0), (n, n - d)$$$ and $$$(n - d, n)$$$. An example of a cornfield with $$$n = 7$$$ and $$$d = 2$$$. Vasya also knows that there ar... | Print $$$m$$$ lines. The $$$i$$$-th line should contain "YES" if the position of the $$$i$$$-th grasshopper lies inside or on the border of the cornfield. Otherwise the $$$i$$$-th line should contain "NO". You can print each letter in any case (upper or lower). | C | 9c84eb518c273942650c7262e5d8b45f | 12dece99627bd308b8c1442133174b27 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"geometry"
] | 1537707900 | ["7 2\n4\n2 4\n4 1\n6 3\n4 5", "8 7\n4\n4 4\n2 8\n8 1\n6 1"] | NoteThe cornfield from the first example is pictured above. Grasshoppers with indices $$$1$$$ (coordinates $$$(2, 4)$$$) and $$$4$$$ (coordinates $$$(4, 5)$$$) are inside the cornfield.The cornfield from the second example is pictured below. Grasshoppers with indices $$$1$$$ (coordinates $$$(4, 4)$$$), $$$3$$$ (coordin... | PASSED | 1,100 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$d$$$ ($$$1 \le d < n \le 100$$$). The second line contains a single integer $$$m$$$ ($$$1 \le m \le 100$$$) β the number of grasshoppers. The $$$i$$$-th of the next $$$m$$$ lines contains two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \le x_i, y_i \le n$$$) β position ... | ["YES\nNO\nNO\nYES", "YES\nNO\nYES\nYES"] | #include<stdio.h>
int main()
{
int n,d;
scanf("%d %d",&n,&d);
int m;
scanf("%d",&m);
int ara[m][2];
for(int j=0;j<m;j++)
{
scanf("%d %d",&ara[j][0],&ara[j][1]);
}
for(int i=0;i<m;i++)
{
if( ((ara[i][0]-ara[i][1]+d) >=0) && ((ara[i][0]-ara[i][1]-d) <=0) && ((ara[i]... | |
Vasya owns a cornfield which can be defined with two integers $$$n$$$ and $$$d$$$. The cornfield can be represented as rectangle with vertices having Cartesian coordinates $$$(0, d), (d, 0), (n, n - d)$$$ and $$$(n - d, n)$$$. An example of a cornfield with $$$n = 7$$$ and $$$d = 2$$$. Vasya also knows that there ar... | Print $$$m$$$ lines. The $$$i$$$-th line should contain "YES" if the position of the $$$i$$$-th grasshopper lies inside or on the border of the cornfield. Otherwise the $$$i$$$-th line should contain "NO". You can print each letter in any case (upper or lower). | C | 9c84eb518c273942650c7262e5d8b45f | 2d0b0424aa3d800743fa1a6e0f91aac2 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"geometry"
] | 1537707900 | ["7 2\n4\n2 4\n4 1\n6 3\n4 5", "8 7\n4\n4 4\n2 8\n8 1\n6 1"] | NoteThe cornfield from the first example is pictured above. Grasshoppers with indices $$$1$$$ (coordinates $$$(2, 4)$$$) and $$$4$$$ (coordinates $$$(4, 5)$$$) are inside the cornfield.The cornfield from the second example is pictured below. Grasshoppers with indices $$$1$$$ (coordinates $$$(4, 4)$$$), $$$3$$$ (coordin... | PASSED | 1,100 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$d$$$ ($$$1 \le d < n \le 100$$$). The second line contains a single integer $$$m$$$ ($$$1 \le m \le 100$$$) β the number of grasshoppers. The $$$i$$$-th of the next $$$m$$$ lines contains two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \le x_i, y_i \le n$$$) β position ... | ["YES\nNO\nNO\nYES", "YES\nNO\nYES\nYES"] | #include<stdio.h>
int main(){
int n , d;
int m;
int P[100][2];
scanf("%d %d",&n,&d);
scanf("%d",&m);
int i;
for(i = 0 ; i < m ; i++)
{
scanf("%d %d",&P[i][0], &P[i][1]);
}
for(i = 0 ; i < m ; i++)
{
if(P[i][0]+ P[i][1] >= d && P[i][1] - P[i][0] <= d &&P[i][0]+... | |
Vasya owns a cornfield which can be defined with two integers $$$n$$$ and $$$d$$$. The cornfield can be represented as rectangle with vertices having Cartesian coordinates $$$(0, d), (d, 0), (n, n - d)$$$ and $$$(n - d, n)$$$. An example of a cornfield with $$$n = 7$$$ and $$$d = 2$$$. Vasya also knows that there ar... | Print $$$m$$$ lines. The $$$i$$$-th line should contain "YES" if the position of the $$$i$$$-th grasshopper lies inside or on the border of the cornfield. Otherwise the $$$i$$$-th line should contain "NO". You can print each letter in any case (upper or lower). | C | 9c84eb518c273942650c7262e5d8b45f | fea117b6d08ef0848fc7a4f5830c0fa3 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"geometry"
] | 1537707900 | ["7 2\n4\n2 4\n4 1\n6 3\n4 5", "8 7\n4\n4 4\n2 8\n8 1\n6 1"] | NoteThe cornfield from the first example is pictured above. Grasshoppers with indices $$$1$$$ (coordinates $$$(2, 4)$$$) and $$$4$$$ (coordinates $$$(4, 5)$$$) are inside the cornfield.The cornfield from the second example is pictured below. Grasshoppers with indices $$$1$$$ (coordinates $$$(4, 4)$$$), $$$3$$$ (coordin... | PASSED | 1,100 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$d$$$ ($$$1 \le d < n \le 100$$$). The second line contains a single integer $$$m$$$ ($$$1 \le m \le 100$$$) β the number of grasshoppers. The $$$i$$$-th of the next $$$m$$$ lines contains two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \le x_i, y_i \le n$$$) β position ... | ["YES\nNO\nNO\nYES", "YES\nNO\nYES\nYES"] | #include<stdio.h>
int d,n;
int Y_1(int x,int y)
{
return d-x;
}
int Y_2(int x,int y)
{
return x+d;
}
int Y_3(int x,int y)
{
return 2*n-x-d;
}
int Y_4(int x,int y)
{
return x-d;
}
int main()
{
int i,m,x,y;
scanf("%d %d",&n,&d);
scanf("%d",&m);
if(n-d>d){
for(i=1;i<=m;i++)
{
... | |
Vasya owns a cornfield which can be defined with two integers $$$n$$$ and $$$d$$$. The cornfield can be represented as rectangle with vertices having Cartesian coordinates $$$(0, d), (d, 0), (n, n - d)$$$ and $$$(n - d, n)$$$. An example of a cornfield with $$$n = 7$$$ and $$$d = 2$$$. Vasya also knows that there ar... | Print $$$m$$$ lines. The $$$i$$$-th line should contain "YES" if the position of the $$$i$$$-th grasshopper lies inside or on the border of the cornfield. Otherwise the $$$i$$$-th line should contain "NO". You can print each letter in any case (upper or lower). | C | 9c84eb518c273942650c7262e5d8b45f | 2174f1b74bb080d9c708fa5964895f67 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"geometry"
] | 1537707900 | ["7 2\n4\n2 4\n4 1\n6 3\n4 5", "8 7\n4\n4 4\n2 8\n8 1\n6 1"] | NoteThe cornfield from the first example is pictured above. Grasshoppers with indices $$$1$$$ (coordinates $$$(2, 4)$$$) and $$$4$$$ (coordinates $$$(4, 5)$$$) are inside the cornfield.The cornfield from the second example is pictured below. Grasshoppers with indices $$$1$$$ (coordinates $$$(4, 4)$$$), $$$3$$$ (coordin... | PASSED | 1,100 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$d$$$ ($$$1 \le d < n \le 100$$$). The second line contains a single integer $$$m$$$ ($$$1 \le m \le 100$$$) β the number of grasshoppers. The $$$i$$$-th of the next $$$m$$$ lines contains two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \le x_i, y_i \le n$$$) β position ... | ["YES\nNO\nNO\nYES", "YES\nNO\nYES\nYES"] | #include <stdio.h>
#include <stdlib.h>
int d,n;
void inside(int x, int y)
{
if (y-x<=d&&y+x>=d&&y-x>=-d&&y+x<=2*n-d) printf("YES\n");
else printf("NO\n");
}
int main()
{
scanf("%d%d",&n,&d);
int q,i,x,y;
scanf("%d",&q);
for (i=0;i<q;i++)
{
scanf("%d%d",&x,&y);
inside(x,... | |
Vasya owns a cornfield which can be defined with two integers $$$n$$$ and $$$d$$$. The cornfield can be represented as rectangle with vertices having Cartesian coordinates $$$(0, d), (d, 0), (n, n - d)$$$ and $$$(n - d, n)$$$. An example of a cornfield with $$$n = 7$$$ and $$$d = 2$$$. Vasya also knows that there ar... | Print $$$m$$$ lines. The $$$i$$$-th line should contain "YES" if the position of the $$$i$$$-th grasshopper lies inside or on the border of the cornfield. Otherwise the $$$i$$$-th line should contain "NO". You can print each letter in any case (upper or lower). | C | 9c84eb518c273942650c7262e5d8b45f | 36135efa58efb0b92d45cfe9d0fc3877 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"geometry"
] | 1537707900 | ["7 2\n4\n2 4\n4 1\n6 3\n4 5", "8 7\n4\n4 4\n2 8\n8 1\n6 1"] | NoteThe cornfield from the first example is pictured above. Grasshoppers with indices $$$1$$$ (coordinates $$$(2, 4)$$$) and $$$4$$$ (coordinates $$$(4, 5)$$$) are inside the cornfield.The cornfield from the second example is pictured below. Grasshoppers with indices $$$1$$$ (coordinates $$$(4, 4)$$$), $$$3$$$ (coordin... | PASSED | 1,100 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$d$$$ ($$$1 \le d < n \le 100$$$). The second line contains a single integer $$$m$$$ ($$$1 \le m \le 100$$$) β the number of grasshoppers. The $$$i$$$-th of the next $$$m$$$ lines contains two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \le x_i, y_i \le n$$$) β position ... | ["YES\nNO\nNO\nYES", "YES\nNO\nYES\nYES"] | #include <stdio.h>
int main() {
int temp, d, n, m, i, x, y;
scanf("%d %d", &d, &n);
if (d > n) {
temp = d;
d = n;
n = temp;
}
scanf("%d", &m);
for(i=0; i<m; i++) {
scanf("%d %d", &x, &y);
if (y >= d-x && y >= x-d && y <= 2*n-x-d &... | |
Vasya owns a cornfield which can be defined with two integers $$$n$$$ and $$$d$$$. The cornfield can be represented as rectangle with vertices having Cartesian coordinates $$$(0, d), (d, 0), (n, n - d)$$$ and $$$(n - d, n)$$$. An example of a cornfield with $$$n = 7$$$ and $$$d = 2$$$. Vasya also knows that there ar... | Print $$$m$$$ lines. The $$$i$$$-th line should contain "YES" if the position of the $$$i$$$-th grasshopper lies inside or on the border of the cornfield. Otherwise the $$$i$$$-th line should contain "NO". You can print each letter in any case (upper or lower). | C | 9c84eb518c273942650c7262e5d8b45f | db1cb478086af1a553d30f850e5180dc | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"geometry"
] | 1537707900 | ["7 2\n4\n2 4\n4 1\n6 3\n4 5", "8 7\n4\n4 4\n2 8\n8 1\n6 1"] | NoteThe cornfield from the first example is pictured above. Grasshoppers with indices $$$1$$$ (coordinates $$$(2, 4)$$$) and $$$4$$$ (coordinates $$$(4, 5)$$$) are inside the cornfield.The cornfield from the second example is pictured below. Grasshoppers with indices $$$1$$$ (coordinates $$$(4, 4)$$$), $$$3$$$ (coordin... | PASSED | 1,100 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$d$$$ ($$$1 \le d < n \le 100$$$). The second line contains a single integer $$$m$$$ ($$$1 \le m \le 100$$$) β the number of grasshoppers. The $$$i$$$-th of the next $$$m$$$ lines contains two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \le x_i, y_i \le n$$$) β position ... | ["YES\nNO\nNO\nYES", "YES\nNO\nYES\nYES"] | #include<stdio.h>
int main()
{
int d, n, m, p, q, r, x,y, i;
scanf("%d%d%d", &n, &d, &m);
for(i=1;i<=m;i++)
{
scanf("%d%d", &x, &y);
q=abs(d-x);
r=n-d;
r=abs(r-x);
p=n-r;
if(y>=q && p>=y)
printf("YES\n");
else
printf("NO\n"... | |
Vasya owns a cornfield which can be defined with two integers $$$n$$$ and $$$d$$$. The cornfield can be represented as rectangle with vertices having Cartesian coordinates $$$(0, d), (d, 0), (n, n - d)$$$ and $$$(n - d, n)$$$. An example of a cornfield with $$$n = 7$$$ and $$$d = 2$$$. Vasya also knows that there ar... | Print $$$m$$$ lines. The $$$i$$$-th line should contain "YES" if the position of the $$$i$$$-th grasshopper lies inside or on the border of the cornfield. Otherwise the $$$i$$$-th line should contain "NO". You can print each letter in any case (upper or lower). | C | 9c84eb518c273942650c7262e5d8b45f | 2420ab8f643d3fb3159359814c55dac9 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"geometry"
] | 1537707900 | ["7 2\n4\n2 4\n4 1\n6 3\n4 5", "8 7\n4\n4 4\n2 8\n8 1\n6 1"] | NoteThe cornfield from the first example is pictured above. Grasshoppers with indices $$$1$$$ (coordinates $$$(2, 4)$$$) and $$$4$$$ (coordinates $$$(4, 5)$$$) are inside the cornfield.The cornfield from the second example is pictured below. Grasshoppers with indices $$$1$$$ (coordinates $$$(4, 4)$$$), $$$3$$$ (coordin... | PASSED | 1,100 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$d$$$ ($$$1 \le d < n \le 100$$$). The second line contains a single integer $$$m$$$ ($$$1 \le m \le 100$$$) β the number of grasshoppers. The $$$i$$$-th of the next $$$m$$$ lines contains two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \le x_i, y_i \le n$$$) β position ... | ["YES\nNO\nNO\nYES", "YES\nNO\nYES\nYES"] | #include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
/*int cmp(const void *a, const void *b)
{
return(*(int *)a-*(int *)b);
}*/
// qsort(a,n,sizeof(a[0]),cmp);
int main()
{
int n,d,m,i,x,y;
scanf("%d %d",&n,&d);
scanf("%d",&m);
for(i = 0; i < m; i++)
{
scanf("%d %... | |
Vasya owns a cornfield which can be defined with two integers $$$n$$$ and $$$d$$$. The cornfield can be represented as rectangle with vertices having Cartesian coordinates $$$(0, d), (d, 0), (n, n - d)$$$ and $$$(n - d, n)$$$. An example of a cornfield with $$$n = 7$$$ and $$$d = 2$$$. Vasya also knows that there ar... | Print $$$m$$$ lines. The $$$i$$$-th line should contain "YES" if the position of the $$$i$$$-th grasshopper lies inside or on the border of the cornfield. Otherwise the $$$i$$$-th line should contain "NO". You can print each letter in any case (upper or lower). | C | 9c84eb518c273942650c7262e5d8b45f | d7fbf1aa7f4493cd91fa8ae542b274c7 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"geometry"
] | 1537707900 | ["7 2\n4\n2 4\n4 1\n6 3\n4 5", "8 7\n4\n4 4\n2 8\n8 1\n6 1"] | NoteThe cornfield from the first example is pictured above. Grasshoppers with indices $$$1$$$ (coordinates $$$(2, 4)$$$) and $$$4$$$ (coordinates $$$(4, 5)$$$) are inside the cornfield.The cornfield from the second example is pictured below. Grasshoppers with indices $$$1$$$ (coordinates $$$(4, 4)$$$), $$$3$$$ (coordin... | PASSED | 1,100 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$d$$$ ($$$1 \le d < n \le 100$$$). The second line contains a single integer $$$m$$$ ($$$1 \le m \le 100$$$) β the number of grasshoppers. The $$$i$$$-th of the next $$$m$$$ lines contains two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \le x_i, y_i \le n$$$) β position ... | ["YES\nNO\nNO\nYES", "YES\nNO\nYES\nYES"] | #include<stdio.h>
int main()
{
int n,m,d;
scanf("%d %d",&n,&d);
scanf("%d",&m);
int x,y,count=0;
for(int i=0;i<m;i++)
{
scanf("%d",&x);
scanf("%d",&y);
if((x+y-d>=0)&&(x+y+d-2*n<=0)&&(y-x+d>=0)&&(y-x-d<=0))
printf("YES\n");
else
printf("NO\n");
}
}
| |
Vasya owns a cornfield which can be defined with two integers $$$n$$$ and $$$d$$$. The cornfield can be represented as rectangle with vertices having Cartesian coordinates $$$(0, d), (d, 0), (n, n - d)$$$ and $$$(n - d, n)$$$. An example of a cornfield with $$$n = 7$$$ and $$$d = 2$$$. Vasya also knows that there ar... | Print $$$m$$$ lines. The $$$i$$$-th line should contain "YES" if the position of the $$$i$$$-th grasshopper lies inside or on the border of the cornfield. Otherwise the $$$i$$$-th line should contain "NO". You can print each letter in any case (upper or lower). | C | 9c84eb518c273942650c7262e5d8b45f | 61e0003d3ca8090390a8d33cf6c2cc4c | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"geometry"
] | 1537707900 | ["7 2\n4\n2 4\n4 1\n6 3\n4 5", "8 7\n4\n4 4\n2 8\n8 1\n6 1"] | NoteThe cornfield from the first example is pictured above. Grasshoppers with indices $$$1$$$ (coordinates $$$(2, 4)$$$) and $$$4$$$ (coordinates $$$(4, 5)$$$) are inside the cornfield.The cornfield from the second example is pictured below. Grasshoppers with indices $$$1$$$ (coordinates $$$(4, 4)$$$), $$$3$$$ (coordin... | PASSED | 1,100 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$d$$$ ($$$1 \le d < n \le 100$$$). The second line contains a single integer $$$m$$$ ($$$1 \le m \le 100$$$) β the number of grasshoppers. The $$$i$$$-th of the next $$$m$$$ lines contains two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \le x_i, y_i \le n$$$) β position ... | ["YES\nNO\nNO\nYES", "YES\nNO\nYES\nYES"] | #include<stdio.h>
int main()
{
int n,d,m,i,x,y;
scanf("%d %d",&n,&d);
scanf("%d",&m);
for(i=0;i<m;i++){
scanf("%d %d",&x,&y);
if(x-y>d || y-x>d || x+y<d || x+y>2*n-d)
printf("NO\n");
else{
printf("YES\n");
}
}
return 0;
}
| |
Vasya owns a cornfield which can be defined with two integers $$$n$$$ and $$$d$$$. The cornfield can be represented as rectangle with vertices having Cartesian coordinates $$$(0, d), (d, 0), (n, n - d)$$$ and $$$(n - d, n)$$$. An example of a cornfield with $$$n = 7$$$ and $$$d = 2$$$. Vasya also knows that there ar... | Print $$$m$$$ lines. The $$$i$$$-th line should contain "YES" if the position of the $$$i$$$-th grasshopper lies inside or on the border of the cornfield. Otherwise the $$$i$$$-th line should contain "NO". You can print each letter in any case (upper or lower). | C | 9c84eb518c273942650c7262e5d8b45f | d24b60392e45909be089f1101ef2375a | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"geometry"
] | 1537707900 | ["7 2\n4\n2 4\n4 1\n6 3\n4 5", "8 7\n4\n4 4\n2 8\n8 1\n6 1"] | NoteThe cornfield from the first example is pictured above. Grasshoppers with indices $$$1$$$ (coordinates $$$(2, 4)$$$) and $$$4$$$ (coordinates $$$(4, 5)$$$) are inside the cornfield.The cornfield from the second example is pictured below. Grasshoppers with indices $$$1$$$ (coordinates $$$(4, 4)$$$), $$$3$$$ (coordin... | PASSED | 1,100 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$d$$$ ($$$1 \le d < n \le 100$$$). The second line contains a single integer $$$m$$$ ($$$1 \le m \le 100$$$) β the number of grasshoppers. The $$$i$$$-th of the next $$$m$$$ lines contains two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \le x_i, y_i \le n$$$) β position ... | ["YES\nNO\nNO\nYES", "YES\nNO\nYES\nYES"] | #include<stdio.h>
int main()
{
int n,d,m,t;
scanf("%d%d%d",&n,&d,&m);
t=m-1;;
int arr[m];
while(m--)
{
int a,b;
scanf("%d%d",&a,&b);
if((a+b>=d)&&(a+b<=(2*n)-d)&&(a-b<=d)&&(a-b>=-d))
arr[m]=1;
else
arr[m]=0;
}
for(int i=t;i>=0;i--)
{
if(arr[i]==1)
pri... | |
Vasya owns a cornfield which can be defined with two integers $$$n$$$ and $$$d$$$. The cornfield can be represented as rectangle with vertices having Cartesian coordinates $$$(0, d), (d, 0), (n, n - d)$$$ and $$$(n - d, n)$$$. An example of a cornfield with $$$n = 7$$$ and $$$d = 2$$$. Vasya also knows that there ar... | Print $$$m$$$ lines. The $$$i$$$-th line should contain "YES" if the position of the $$$i$$$-th grasshopper lies inside or on the border of the cornfield. Otherwise the $$$i$$$-th line should contain "NO". You can print each letter in any case (upper or lower). | C | 9c84eb518c273942650c7262e5d8b45f | 758d68741e66e6a1f3ee5c205e715bac | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"geometry"
] | 1537707900 | ["7 2\n4\n2 4\n4 1\n6 3\n4 5", "8 7\n4\n4 4\n2 8\n8 1\n6 1"] | NoteThe cornfield from the first example is pictured above. Grasshoppers with indices $$$1$$$ (coordinates $$$(2, 4)$$$) and $$$4$$$ (coordinates $$$(4, 5)$$$) are inside the cornfield.The cornfield from the second example is pictured below. Grasshoppers with indices $$$1$$$ (coordinates $$$(4, 4)$$$), $$$3$$$ (coordin... | PASSED | 1,100 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$d$$$ ($$$1 \le d < n \le 100$$$). The second line contains a single integer $$$m$$$ ($$$1 \le m \le 100$$$) β the number of grasshoppers. The $$$i$$$-th of the next $$$m$$$ lines contains two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \le x_i, y_i \le n$$$) β position ... | ["YES\nNO\nNO\nYES", "YES\nNO\nYES\nYES"] | #include<stdio.h>
int main()
{
int k,n,d,x[200],y[200],m,i=0,j=0;
scanf("%d %d %d",&n,&d,&m);
k=m;
while(m--){
scanf("%d %d",&x[i],&y[i]);
i++;
}
while(k--){
if(x[j]+y[j]-d<0||x[j]+y[j]-2*n+d>0||x[j]-y[j]-d>0||x[j]-y[j]+d<0) {printf("NO\n");j++;}
else {printf("YES\n");j++;}
... | |
Vasya owns a cornfield which can be defined with two integers $$$n$$$ and $$$d$$$. The cornfield can be represented as rectangle with vertices having Cartesian coordinates $$$(0, d), (d, 0), (n, n - d)$$$ and $$$(n - d, n)$$$. An example of a cornfield with $$$n = 7$$$ and $$$d = 2$$$. Vasya also knows that there ar... | Print $$$m$$$ lines. The $$$i$$$-th line should contain "YES" if the position of the $$$i$$$-th grasshopper lies inside or on the border of the cornfield. Otherwise the $$$i$$$-th line should contain "NO". You can print each letter in any case (upper or lower). | C | 9c84eb518c273942650c7262e5d8b45f | 170939669bbc8edc95d4c7fe7e426d46 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"geometry"
] | 1537707900 | ["7 2\n4\n2 4\n4 1\n6 3\n4 5", "8 7\n4\n4 4\n2 8\n8 1\n6 1"] | NoteThe cornfield from the first example is pictured above. Grasshoppers with indices $$$1$$$ (coordinates $$$(2, 4)$$$) and $$$4$$$ (coordinates $$$(4, 5)$$$) are inside the cornfield.The cornfield from the second example is pictured below. Grasshoppers with indices $$$1$$$ (coordinates $$$(4, 4)$$$), $$$3$$$ (coordin... | PASSED | 1,100 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$d$$$ ($$$1 \le d < n \le 100$$$). The second line contains a single integer $$$m$$$ ($$$1 \le m \le 100$$$) β the number of grasshoppers. The $$$i$$$-th of the next $$$m$$$ lines contains two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \le x_i, y_i \le n$$$) β position ... | ["YES\nNO\nNO\nYES", "YES\nNO\nYES\nYES"] | #include<stdio.h>
int main()
{
int n,d,x,y,m;
scanf("%d %d",&n,&d);
scanf("%d",&m);
while(m--)
{
scanf("%d%d",&x,&y);
if(x+y-d<0||x+y-2*n+d>0||x-y-d>0||x-y+d<0)
{
printf("NO\n");
}
else printf("YES\n");
}
return 0;
} | |
Vasya owns a cornfield which can be defined with two integers $$$n$$$ and $$$d$$$. The cornfield can be represented as rectangle with vertices having Cartesian coordinates $$$(0, d), (d, 0), (n, n - d)$$$ and $$$(n - d, n)$$$. An example of a cornfield with $$$n = 7$$$ and $$$d = 2$$$. Vasya also knows that there ar... | Print $$$m$$$ lines. The $$$i$$$-th line should contain "YES" if the position of the $$$i$$$-th grasshopper lies inside or on the border of the cornfield. Otherwise the $$$i$$$-th line should contain "NO". You can print each letter in any case (upper or lower). | C | 9c84eb518c273942650c7262e5d8b45f | 0551c77c979c519cb30794deb491a84e | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"geometry"
] | 1537707900 | ["7 2\n4\n2 4\n4 1\n6 3\n4 5", "8 7\n4\n4 4\n2 8\n8 1\n6 1"] | NoteThe cornfield from the first example is pictured above. Grasshoppers with indices $$$1$$$ (coordinates $$$(2, 4)$$$) and $$$4$$$ (coordinates $$$(4, 5)$$$) are inside the cornfield.The cornfield from the second example is pictured below. Grasshoppers with indices $$$1$$$ (coordinates $$$(4, 4)$$$), $$$3$$$ (coordin... | PASSED | 1,100 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$d$$$ ($$$1 \le d < n \le 100$$$). The second line contains a single integer $$$m$$$ ($$$1 \le m \le 100$$$) β the number of grasshoppers. The $$$i$$$-th of the next $$$m$$$ lines contains two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \le x_i, y_i \le n$$$) β position ... | ["YES\nNO\nNO\nYES", "YES\nNO\nYES\nYES"] | #include<stdio.h>
int main(){
int n,d;
scanf("%d%d",&n,&d);
int m,i;
scanf("%d",&m);
for(i=0;i<m;i++){
int x,y;
scanf("%d%d",&x,&y);
int l=x-(y+d);
int h=y-(x+d);
int f=x+y+d-(2*n);
int g=x+y-d;
if(l<0 && h<0 && f<0 && g>0){
printf("YES\n");
continue;
}
if(l==0 || h==0 || f==0 || g==0){
... | |
Vasya owns a cornfield which can be defined with two integers $$$n$$$ and $$$d$$$. The cornfield can be represented as rectangle with vertices having Cartesian coordinates $$$(0, d), (d, 0), (n, n - d)$$$ and $$$(n - d, n)$$$. An example of a cornfield with $$$n = 7$$$ and $$$d = 2$$$. Vasya also knows that there ar... | Print $$$m$$$ lines. The $$$i$$$-th line should contain "YES" if the position of the $$$i$$$-th grasshopper lies inside or on the border of the cornfield. Otherwise the $$$i$$$-th line should contain "NO". You can print each letter in any case (upper or lower). | C | 9c84eb518c273942650c7262e5d8b45f | f2b0143d713f5f61172b9be6dde526c8 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"geometry"
] | 1537707900 | ["7 2\n4\n2 4\n4 1\n6 3\n4 5", "8 7\n4\n4 4\n2 8\n8 1\n6 1"] | NoteThe cornfield from the first example is pictured above. Grasshoppers with indices $$$1$$$ (coordinates $$$(2, 4)$$$) and $$$4$$$ (coordinates $$$(4, 5)$$$) are inside the cornfield.The cornfield from the second example is pictured below. Grasshoppers with indices $$$1$$$ (coordinates $$$(4, 4)$$$), $$$3$$$ (coordin... | PASSED | 1,100 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$d$$$ ($$$1 \le d < n \le 100$$$). The second line contains a single integer $$$m$$$ ($$$1 \le m \le 100$$$) β the number of grasshoppers. The $$$i$$$-th of the next $$$m$$$ lines contains two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \le x_i, y_i \le n$$$) β position ... | ["YES\nNO\nNO\nYES", "YES\nNO\nYES\nYES"] | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
double area(int x1,int y1,int x2,int y2,int x3,int y3){
double a;
a = (x1*(y2-y3) + x2*(y3-y1) + x3*(y1-y2))/2.0;
a = fabs(a);
return a;
}
int main()
{
int n,d,m,i,j;
int** ptr;
double a,a1,a2,a3,a4,sum;
scanf("%d%d",&n,&d);
... | |
Polycarp is mad about coding, that is why he writes Sveta encoded messages. He calls the median letter in a word the letter which is in the middle of the word. If the word's length is even, the median letter is the left of the two middle letters. In the following examples, the median letter is highlighted: contest, inf... | Print the word that Polycarp encoded. | C | 2a414730d1bc7eef50bdb631ea966366 | 5482143e2108d97aa7fd1697ef713e1c | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1482057300 | ["5\nlogva", "2\nno", "4\nabba"] | NoteIn the first example Polycarp encoded the word volga. At first, he wrote down the letter l from the position 3, after that his word looked like voga. After that Polycarp wrote down the letter o from the position 2, his word became vga. Then Polycarp wrote down the letter g which was at the second position, the word... | PASSED | 900 | standard input | 1 second | The first line contains a positive integer n (1ββ€βnββ€β2000)Β β the length of the encoded word. The second line contains the string s of length n consisting of lowercase English lettersΒ β the encoding. | ["volga", "no", "baba"] | #include<stdio.h>
int main(void)
{
int Number,Count;
char E[5];
scanf("%d",&Number);
gets(E);
char String[Number+1],String_Decoded[Number+1];
gets(String);
if(Number%2)
for(Count=0;Count<Number;Count++)
{
if(Count==0)
String_Decoded[Number/2]=Stri... | |
Polycarp is mad about coding, that is why he writes Sveta encoded messages. He calls the median letter in a word the letter which is in the middle of the word. If the word's length is even, the median letter is the left of the two middle letters. In the following examples, the median letter is highlighted: contest, inf... | Print the word that Polycarp encoded. | C | 2a414730d1bc7eef50bdb631ea966366 | 28f68764e144985827f4b8d7f86c498e | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1482057300 | ["5\nlogva", "2\nno", "4\nabba"] | NoteIn the first example Polycarp encoded the word volga. At first, he wrote down the letter l from the position 3, after that his word looked like voga. After that Polycarp wrote down the letter o from the position 2, his word became vga. Then Polycarp wrote down the letter g which was at the second position, the word... | PASSED | 900 | standard input | 1 second | The first line contains a positive integer n (1ββ€βnββ€β2000)Β β the length of the encoded word. The second line contains the string s of length n consisting of lowercase English lettersΒ β the encoding. | ["volga", "no", "baba"] | #include <stdio.h>
int main(void) {
unsigned int n;
scanf("%u\n", &n);
char result_str[n + 1];
int med = n % 2 == 0 ? n / 2 : (n + 1) / 2;
result_str[med] = getchar();
if(n % 2 == 1) {
int sign = -1;
for(int i = 1; i < n; i++) {
int c = getchar();
med += s... | |
Polycarp is mad about coding, that is why he writes Sveta encoded messages. He calls the median letter in a word the letter which is in the middle of the word. If the word's length is even, the median letter is the left of the two middle letters. In the following examples, the median letter is highlighted: contest, inf... | Print the word that Polycarp encoded. | C | 2a414730d1bc7eef50bdb631ea966366 | 94af6a21057fb60a552c074eef52b8ca | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1482057300 | ["5\nlogva", "2\nno", "4\nabba"] | NoteIn the first example Polycarp encoded the word volga. At first, he wrote down the letter l from the position 3, after that his word looked like voga. After that Polycarp wrote down the letter o from the position 2, his word became vga. Then Polycarp wrote down the letter g which was at the second position, the word... | PASSED | 900 | standard input | 1 second | The first line contains a positive integer n (1ββ€βnββ€β2000)Β β the length of the encoded word. The second line contains the string s of length n consisting of lowercase English lettersΒ β the encoding. | ["volga", "no", "baba"] | #include<stdio.h>
#include<string.h>
#include<math.h>
void append(char str[], char ch, int pos)
{
char buf[3000];
strncpy(buf, str, pos);
buf[pos] = ch;
strcpy(buf + pos + 1, str+pos);
strcpy(str, buf);
free(buf);
//puts(str);
}
int main()
{
char str1[3000], str2[3000], ch;
int n, le... | |
Polycarp is mad about coding, that is why he writes Sveta encoded messages. He calls the median letter in a word the letter which is in the middle of the word. If the word's length is even, the median letter is the left of the two middle letters. In the following examples, the median letter is highlighted: contest, inf... | Print the word that Polycarp encoded. | C | 2a414730d1bc7eef50bdb631ea966366 | cd429ae44fe7ab3c48ab7e0bef686ee2 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1482057300 | ["5\nlogva", "2\nno", "4\nabba"] | NoteIn the first example Polycarp encoded the word volga. At first, he wrote down the letter l from the position 3, after that his word looked like voga. After that Polycarp wrote down the letter o from the position 2, his word became vga. Then Polycarp wrote down the letter g which was at the second position, the word... | PASSED | 900 | standard input | 1 second | The first line contains a positive integer n (1ββ€βnββ€β2000)Β β the length of the encoded word. The second line contains the string s of length n consisting of lowercase English lettersΒ β the encoding. | ["volga", "no", "baba"] | #include <stdio.h>
#include <string.h>
int main(void)
{
int n;
scanf("%d%*c",&n);
char s[2001];
gets(s);
int direction[2] = {0,n-1};
char decode[2001];
int count = n-1;
char dir = 1; // 1 is right and 0 is left
for (count; count >= 0; count--)
{
decode[direction[dir]] = s[count];
(dir)?d... | |
Polycarp is mad about coding, that is why he writes Sveta encoded messages. He calls the median letter in a word the letter which is in the middle of the word. If the word's length is even, the median letter is the left of the two middle letters. In the following examples, the median letter is highlighted: contest, inf... | Print the word that Polycarp encoded. | C | 2a414730d1bc7eef50bdb631ea966366 | 1159702cd8f005cdc0e137da05e05b6a | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1482057300 | ["5\nlogva", "2\nno", "4\nabba"] | NoteIn the first example Polycarp encoded the word volga. At first, he wrote down the letter l from the position 3, after that his word looked like voga. After that Polycarp wrote down the letter o from the position 2, his word became vga. Then Polycarp wrote down the letter g which was at the second position, the word... | PASSED | 900 | standard input | 1 second | The first line contains a positive integer n (1ββ€βnββ€β2000)Β β the length of the encoded word. The second line contains the string s of length n consisting of lowercase English lettersΒ β the encoding. | ["volga", "no", "baba"] | #include<stdio.h>
#include<string.h>
int main()
{
char a[4000], b[4000];
memset(b, 0, sizeof(b));
int n, i, j, len;
scanf("%d\n", &n);
fgets(a, 4000, stdin);
len=n;
if(n>2){
if(n%2!=0)
for(i=0; i<len; i++)
{
if(i==0){
/*if(n%2==0)
{
j=n/2 -1;
b[j]=a[i];
}*/
//else
... | |
Polycarp is mad about coding, that is why he writes Sveta encoded messages. He calls the median letter in a word the letter which is in the middle of the word. If the word's length is even, the median letter is the left of the two middle letters. In the following examples, the median letter is highlighted: contest, inf... | Print the word that Polycarp encoded. | C | 2a414730d1bc7eef50bdb631ea966366 | 7339d573ac4c37f9ced62af012f2cf56 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1482057300 | ["5\nlogva", "2\nno", "4\nabba"] | NoteIn the first example Polycarp encoded the word volga. At first, he wrote down the letter l from the position 3, after that his word looked like voga. After that Polycarp wrote down the letter o from the position 2, his word became vga. Then Polycarp wrote down the letter g which was at the second position, the word... | PASSED | 900 | standard input | 1 second | The first line contains a positive integer n (1ββ€βnββ€β2000)Β β the length of the encoded word. The second line contains the string s of length n consisting of lowercase English lettersΒ β the encoding. | ["volga", "no", "baba"] | #include<stdio.h>
#include<conio.h>
#include<string.h>
int main()
{
int n,i,k,j;
scanf("%d",&n);
char S[n];
scanf("%s",&S);
for(k=2;k<=n;k+=2)
{
printf("%c",S[n-k]);
}
if(n%2==1)
{
i=0;
}
else
{
i=1;
}
for(;i<n;i+=2)
{
printf("%... | |
Polycarp is mad about coding, that is why he writes Sveta encoded messages. He calls the median letter in a word the letter which is in the middle of the word. If the word's length is even, the median letter is the left of the two middle letters. In the following examples, the median letter is highlighted: contest, inf... | Print the word that Polycarp encoded. | C | 2a414730d1bc7eef50bdb631ea966366 | 63dca0807a86c390258baf398eb0a08c | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1482057300 | ["5\nlogva", "2\nno", "4\nabba"] | NoteIn the first example Polycarp encoded the word volga. At first, he wrote down the letter l from the position 3, after that his word looked like voga. After that Polycarp wrote down the letter o from the position 2, his word became vga. Then Polycarp wrote down the letter g which was at the second position, the word... | PASSED | 900 | standard input | 1 second | The first line contains a positive integer n (1ββ€βnββ€β2000)Β β the length of the encoded word. The second line contains the string s of length n consisting of lowercase English lettersΒ β the encoding. | ["volga", "no", "baba"] | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <ctype.h>
int main()
{
int n,i,m,j,f,k=0;
scanf("%d",&n);
char s2[n+1];
char s[n+1];
gets(s);
gets(s);
m=n/2;
j=n/2;
f=n;
if(n%2==1){
s2[m]=s[0];
for(i=1;i<n;i++){
i... | |
Polycarp is mad about coding, that is why he writes Sveta encoded messages. He calls the median letter in a word the letter which is in the middle of the word. If the word's length is even, the median letter is the left of the two middle letters. In the following examples, the median letter is highlighted: contest, inf... | Print the word that Polycarp encoded. | C | 2a414730d1bc7eef50bdb631ea966366 | 1138d4c469964e484eda336dada75bc7 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1482057300 | ["5\nlogva", "2\nno", "4\nabba"] | NoteIn the first example Polycarp encoded the word volga. At first, he wrote down the letter l from the position 3, after that his word looked like voga. After that Polycarp wrote down the letter o from the position 2, his word became vga. Then Polycarp wrote down the letter g which was at the second position, the word... | PASSED | 900 | standard input | 1 second | The first line contains a positive integer n (1ββ€βnββ€β2000)Β β the length of the encoded word. The second line contains the string s of length n consisting of lowercase English lettersΒ β the encoding. | ["volga", "no", "baba"] | #include<stdio.h>
int main()
{
int n, i;
char a[2001];
scanf("%d", &n);
scanf("%s", a);
n-=1;
for(i=n-1; i>=0; i-=2)
{
printf("%c", a[i]);
}
if(n%2==0) i=0;
else i = 1;
for(i; i<=n; i+=2) printf("%c", a[i]);
return 0;
} | |
Polycarp is mad about coding, that is why he writes Sveta encoded messages. He calls the median letter in a word the letter which is in the middle of the word. If the word's length is even, the median letter is the left of the two middle letters. In the following examples, the median letter is highlighted: contest, inf... | Print the word that Polycarp encoded. | C | 2a414730d1bc7eef50bdb631ea966366 | 9ebc81bf08678e46bed92ec7015687b4 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1482057300 | ["5\nlogva", "2\nno", "4\nabba"] | NoteIn the first example Polycarp encoded the word volga. At first, he wrote down the letter l from the position 3, after that his word looked like voga. After that Polycarp wrote down the letter o from the position 2, his word became vga. Then Polycarp wrote down the letter g which was at the second position, the word... | PASSED | 900 | standard input | 1 second | The first line contains a positive integer n (1ββ€βnββ€β2000)Β β the length of the encoded word. The second line contains the string s of length n consisting of lowercase English lettersΒ β the encoding. | ["volga", "no", "baba"] | #include<stdio.h>
int main(void)
{
int i,r,l,n;
scanf("%d",&n);
char string[n+2],answer[n+2];
scanf("%s",string);
if(!(n&1))
{
for(r=n/2-1,i=0;i<n&&r>=0;i+=2,r--)
answer[r]=string[i];
for(l=n/2,i=1;l<n&&i<n;l++,i+=2)
answer[l]=string[i];
answer[n]=... | |
Polycarp is mad about coding, that is why he writes Sveta encoded messages. He calls the median letter in a word the letter which is in the middle of the word. If the word's length is even, the median letter is the left of the two middle letters. In the following examples, the median letter is highlighted: contest, inf... | Print the word that Polycarp encoded. | C | 2a414730d1bc7eef50bdb631ea966366 | aab3ef273afc887fd3efc6523a4f6edc | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1482057300 | ["5\nlogva", "2\nno", "4\nabba"] | NoteIn the first example Polycarp encoded the word volga. At first, he wrote down the letter l from the position 3, after that his word looked like voga. After that Polycarp wrote down the letter o from the position 2, his word became vga. Then Polycarp wrote down the letter g which was at the second position, the word... | PASSED | 900 | standard input | 1 second | The first line contains a positive integer n (1ββ€βnββ€β2000)Β β the length of the encoded word. The second line contains the string s of length n consisting of lowercase English lettersΒ β the encoding. | ["volga", "no", "baba"] | #include <stdio.h>
int main() {
int i,n,j=1;
scanf("%d",&n);
char coded[n];
scanf("%s",coded);
char decoded[n];
for(i=0;i<n;i++)
{
if(n-j-1 <0)
{
if (n-j == 0)
{
decoded[n-i-1] = coded[n-j];
}
decoded[n] = '\0';
... | |
Valera wanted to prepare a Codesecrof round. He's already got one problem and he wants to set a time limit (TL) on it.Valera has written n correct solutions. For each correct solution, he knows its running time (in seconds). Valera has also wrote m wrong solutions and for each wrong solution he knows its running time (... | If there is a valid TL value, print it. Otherwise, print -1. | C | 49c47ebfd710a3733ce7ecb3a3c134a7 | f82578ddc92ef50fb625cc07617e830c | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy",
"brute force"
] | 1380641400 | ["3 6\n4 5 2\n8 9 6 10 7 11", "3 1\n3 4 5\n6"] | null | PASSED | 1,200 | standard input | 2 seconds | The first line contains two integers n, m (1ββ€βn,βmββ€β100). The second line contains n space-separated positive integers a1,βa2,β...,βan (1ββ€βaiββ€β100) β the running time of each of the n correct solutions in seconds. The third line contains m space-separated positive integers b1,βb2,β...,βbm (1ββ€βbiββ€β100) β the runni... | ["5", "-1"] | #include<stdio.h>
//#include<conio.h>
#include<stdlib.h>
int compare (const void * a, const void * b)
{
return ( *(int*)a - *(int*)b );
}
int main()
{
int n,m,i,j;
int a[101],b[101];
int max=0;
scanf("%d %d",&n,&m);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
... | |
Valera wanted to prepare a Codesecrof round. He's already got one problem and he wants to set a time limit (TL) on it.Valera has written n correct solutions. For each correct solution, he knows its running time (in seconds). Valera has also wrote m wrong solutions and for each wrong solution he knows its running time (... | If there is a valid TL value, print it. Otherwise, print -1. | C | 49c47ebfd710a3733ce7ecb3a3c134a7 | 465136d84928a885f5b6cb58f169d1dd | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy",
"brute force"
] | 1380641400 | ["3 6\n4 5 2\n8 9 6 10 7 11", "3 1\n3 4 5\n6"] | null | PASSED | 1,200 | standard input | 2 seconds | The first line contains two integers n, m (1ββ€βn,βmββ€β100). The second line contains n space-separated positive integers a1,βa2,β...,βan (1ββ€βaiββ€β100) β the running time of each of the n correct solutions in seconds. The third line contains m space-separated positive integers b1,βb2,β...,βbm (1ββ€βbiββ€β100) β the runni... | ["5", "-1"] | #include <stdio.h>
int main()
{
int a, b, n[101], m[101], i, k=101, l=0 ,s=101, p;
scanf("%d %d", &a, &b);
for(i=0; i<a; i++)
{
scanf("%d", &n[i]);
}
for(i=0; i<b; i++)
{
scanf("%d", &m[i]);
}
for(i=0; i<a; i++)
{
if(k>n[i])
{
k=n[i];
... | |
Valera wanted to prepare a Codesecrof round. He's already got one problem and he wants to set a time limit (TL) on it.Valera has written n correct solutions. For each correct solution, he knows its running time (in seconds). Valera has also wrote m wrong solutions and for each wrong solution he knows its running time (... | If there is a valid TL value, print it. Otherwise, print -1. | C | 49c47ebfd710a3733ce7ecb3a3c134a7 | 7e12a3e7c5219818bfb0f926953d0487 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy",
"brute force"
] | 1380641400 | ["3 6\n4 5 2\n8 9 6 10 7 11", "3 1\n3 4 5\n6"] | null | PASSED | 1,200 | standard input | 2 seconds | The first line contains two integers n, m (1ββ€βn,βmββ€β100). The second line contains n space-separated positive integers a1,βa2,β...,βan (1ββ€βaiββ€β100) β the running time of each of the n correct solutions in seconds. The third line contains m space-separated positive integers b1,βb2,β...,βbm (1ββ€βbiββ€β100) β the runni... | ["5", "-1"] | #include<stdio.h>
typedef unsigned u;
int main()
{
u mw,mr,Mr=0,w,r,n,T;
scanf("%u%u",&r,&w);
for(mw=mr=0xffffffffu;r--;mr>n?mr=n:0,Mr<n?Mr=n:0)scanf("%u",&n);
while(w--)scanf("%u",&n),mw>n?mw=n:0;T=(mr<<=1)<Mr?Mr:mr;
printf(T<mw?"%u\n":"-1\n",T);
return 0;
}
| |
Valera wanted to prepare a Codesecrof round. He's already got one problem and he wants to set a time limit (TL) on it.Valera has written n correct solutions. For each correct solution, he knows its running time (in seconds). Valera has also wrote m wrong solutions and for each wrong solution he knows its running time (... | If there is a valid TL value, print it. Otherwise, print -1. | C | 49c47ebfd710a3733ce7ecb3a3c134a7 | 27b04e5116b33ce8d9df7cba42cff484 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy",
"brute force"
] | 1380641400 | ["3 6\n4 5 2\n8 9 6 10 7 11", "3 1\n3 4 5\n6"] | null | PASSED | 1,200 | standard input | 2 seconds | The first line contains two integers n, m (1ββ€βn,βmββ€β100). The second line contains n space-separated positive integers a1,βa2,β...,βan (1ββ€βaiββ€β100) β the running time of each of the n correct solutions in seconds. The third line contains m space-separated positive integers b1,βb2,β...,βbm (1ββ€βbiββ€β100) β the runni... | ["5", "-1"] | #include<stdio.h>
int main(){
int n,m,i,q,p,t;
int a[110],b[110];
scanf("%d%d",&n,&m);
for(i=0;i<n;i++)scanf("%d",a+i);
for(i=0;i<m;i++)scanf("%d",b+i);
p=q=a[0];
t=b[0];
for(i=1;i<n;i++){
if(p>a[i])p=a[i];
if(q<a[i])q=a[i];
}
for(i=1;i<m;i++)
if(t>b[i])t=... | |
Valera wanted to prepare a Codesecrof round. He's already got one problem and he wants to set a time limit (TL) on it.Valera has written n correct solutions. For each correct solution, he knows its running time (in seconds). Valera has also wrote m wrong solutions and for each wrong solution he knows its running time (... | If there is a valid TL value, print it. Otherwise, print -1. | C | 49c47ebfd710a3733ce7ecb3a3c134a7 | ccc7b1dd2892b9b53899c6aca05aea86 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy",
"brute force"
] | 1380641400 | ["3 6\n4 5 2\n8 9 6 10 7 11", "3 1\n3 4 5\n6"] | null | PASSED | 1,200 | standard input | 2 seconds | The first line contains two integers n, m (1ββ€βn,βmββ€β100). The second line contains n space-separated positive integers a1,βa2,β...,βan (1ββ€βaiββ€β100) β the running time of each of the n correct solutions in seconds. The third line contains m space-separated positive integers b1,βb2,β...,βbm (1ββ€βbiββ€β100) β the runni... | ["5", "-1"] | #include<stdio.h>
int main(){
int n,m,k,l,q,i;
scanf("%d %d ",&n,&m);
int arr[n],are[m];
k = 0;
l = 101;
for(i=0;i<n;i++){
scanf("%d", &arr[i]);
if(arr[i] > k)
k = arr[i];
if(arr[i] < l)
l = arr[i];
}
l = 2*l;
if(l>k)
k=l;
q = 101;
for(i=0;i<m;i++){
scanf("%d", &are[... | |
Valera wanted to prepare a Codesecrof round. He's already got one problem and he wants to set a time limit (TL) on it.Valera has written n correct solutions. For each correct solution, he knows its running time (in seconds). Valera has also wrote m wrong solutions and for each wrong solution he knows its running time (... | If there is a valid TL value, print it. Otherwise, print -1. | C | 49c47ebfd710a3733ce7ecb3a3c134a7 | 13258cbb0fa8cbb4f07a1217419ad904 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy",
"brute force"
] | 1380641400 | ["3 6\n4 5 2\n8 9 6 10 7 11", "3 1\n3 4 5\n6"] | null | PASSED | 1,200 | standard input | 2 seconds | The first line contains two integers n, m (1ββ€βn,βmββ€β100). The second line contains n space-separated positive integers a1,βa2,β...,βan (1ββ€βaiββ€β100) β the running time of each of the n correct solutions in seconds. The third line contains m space-separated positive integers b1,βb2,β...,βbm (1ββ€βbiββ€β100) β the runni... | ["5", "-1"] | #include<stdio.h>
int A[101];
int main()
{
int n,m;
scanf("%d %d",&n,&m);
int i,j,max=-1,min1=101;
for(i=0;i<n;i++)
{
scanf("%d",&A[i]);
if(A[i]>max)
max=A[i];
if(A[i]<min1)
min1=A[i];
}
int min=101,a;
for(i=0;i<m;i++)
{
scanf("%d",&a);
if(a<min)
min=a;
}
min--;
if(max<2*min1)
max=2*min... | |
Valera wanted to prepare a Codesecrof round. He's already got one problem and he wants to set a time limit (TL) on it.Valera has written n correct solutions. For each correct solution, he knows its running time (in seconds). Valera has also wrote m wrong solutions and for each wrong solution he knows its running time (... | If there is a valid TL value, print it. Otherwise, print -1. | C | 49c47ebfd710a3733ce7ecb3a3c134a7 | f10b589df783ae9408e590203dbb8aca | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy",
"brute force"
] | 1380641400 | ["3 6\n4 5 2\n8 9 6 10 7 11", "3 1\n3 4 5\n6"] | null | PASSED | 1,200 | standard input | 2 seconds | The first line contains two integers n, m (1ββ€βn,βmββ€β100). The second line contains n space-separated positive integers a1,βa2,β...,βan (1ββ€βaiββ€β100) β the running time of each of the n correct solutions in seconds. The third line contains m space-separated positive integers b1,βb2,β...,βbm (1ββ€βbiββ€β100) β the runni... | ["5", "-1"] | #include<stdio.h>
int main()
{
int n,m,a[500]={0},b[500]={0},i,j,min=0,max=0,ans=0;
scanf("%d%d",&n,&m);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<m;i++)
{
scanf("%d",&b[i]);
}
if(n==1)
{
min=b[0];
for(i=0;i<m;i++)
{
if(b[i]<min)
... | |
Valera wanted to prepare a Codesecrof round. He's already got one problem and he wants to set a time limit (TL) on it.Valera has written n correct solutions. For each correct solution, he knows its running time (in seconds). Valera has also wrote m wrong solutions and for each wrong solution he knows its running time (... | If there is a valid TL value, print it. Otherwise, print -1. | C | 49c47ebfd710a3733ce7ecb3a3c134a7 | 4136fd55b245adc26b9ddf4dc13ffd12 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy",
"brute force"
] | 1380641400 | ["3 6\n4 5 2\n8 9 6 10 7 11", "3 1\n3 4 5\n6"] | null | PASSED | 1,200 | standard input | 2 seconds | The first line contains two integers n, m (1ββ€βn,βmββ€β100). The second line contains n space-separated positive integers a1,βa2,β...,βan (1ββ€βaiββ€β100) β the running time of each of the n correct solutions in seconds. The third line contains m space-separated positive integers b1,βb2,β...,βbm (1ββ€βbiββ€β100) β the runni... | ["5", "-1"] | #include <stdio.h>
int pas[101];
int fail[101];
int main()
{
int minp=1000,maxp=0;
int minf=1000,maxf=0;
int n,m,i,j,k,l,b;
scanf("%d %d",&n,&m);
for(i=1;i<=n;i++)
{
scanf("%d",&pas[i]);
if(pas[i]<minp)
minp=pas[i];
if(pas[i]>maxp)
maxp=pas[i];
}
for(i=1;i<=... | |
Valera wanted to prepare a Codesecrof round. He's already got one problem and he wants to set a time limit (TL) on it.Valera has written n correct solutions. For each correct solution, he knows its running time (in seconds). Valera has also wrote m wrong solutions and for each wrong solution he knows its running time (... | If there is a valid TL value, print it. Otherwise, print -1. | C | 49c47ebfd710a3733ce7ecb3a3c134a7 | 0a458664d939a70b5ecda222f714e408 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy",
"brute force"
] | 1380641400 | ["3 6\n4 5 2\n8 9 6 10 7 11", "3 1\n3 4 5\n6"] | null | PASSED | 1,200 | standard input | 2 seconds | The first line contains two integers n, m (1ββ€βn,βmββ€β100). The second line contains n space-separated positive integers a1,βa2,β...,βan (1ββ€βaiββ€β100) β the running time of each of the n correct solutions in seconds. The third line contains m space-separated positive integers b1,βb2,β...,βbm (1ββ€βbiββ€β100) β the runni... | ["5", "-1"] | #include<stdio.h>
int main()
{
int start,end,i,n,m,a[1005],b[1005],a_max=0,a_min=1000,b_min=1000;
scanf("%d%d",&n,&m);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
if(a[i]<a_min)
a_min=a[i];
if(a[i]>a_max)
a_max=a[i];
}
for(i=0;i<m;i++)
{
scanf("%d",&b[i]);
if(b[i]<b_min)
b_min=b[i];
}
if(a_max>2*a_mi... | |
Valera wanted to prepare a Codesecrof round. He's already got one problem and he wants to set a time limit (TL) on it.Valera has written n correct solutions. For each correct solution, he knows its running time (in seconds). Valera has also wrote m wrong solutions and for each wrong solution he knows its running time (... | If there is a valid TL value, print it. Otherwise, print -1. | C | 49c47ebfd710a3733ce7ecb3a3c134a7 | 6389d72806f4713966c9a93b5b6e7d17 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy",
"brute force"
] | 1380641400 | ["3 6\n4 5 2\n8 9 6 10 7 11", "3 1\n3 4 5\n6"] | null | PASSED | 1,200 | standard input | 2 seconds | The first line contains two integers n, m (1ββ€βn,βmββ€β100). The second line contains n space-separated positive integers a1,βa2,β...,βan (1ββ€βaiββ€β100) β the running time of each of the n correct solutions in seconds. The third line contains m space-separated positive integers b1,βb2,β...,βbm (1ββ€βbiββ€β100) β the runni... | ["5", "-1"] | /* CodeForces 350A GNU/C */
#include <stdio.h>
#define MAX 100
int main()
{
unsigned n = 0, //Number of correct solutions
m = 0; //Number of wrong solutions
unsigned correctSolutions[MAX],
wrongSolutions[MAX];
unsigned minCorrect = MAX,
maxCorrect = 0,
minWr... | |
Valera wanted to prepare a Codesecrof round. He's already got one problem and he wants to set a time limit (TL) on it.Valera has written n correct solutions. For each correct solution, he knows its running time (in seconds). Valera has also wrote m wrong solutions and for each wrong solution he knows its running time (... | If there is a valid TL value, print it. Otherwise, print -1. | C | 49c47ebfd710a3733ce7ecb3a3c134a7 | c804aef4b05307770e90f682d616fa3e | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy",
"brute force"
] | 1380641400 | ["3 6\n4 5 2\n8 9 6 10 7 11", "3 1\n3 4 5\n6"] | null | PASSED | 1,200 | standard input | 2 seconds | The first line contains two integers n, m (1ββ€βn,βmββ€β100). The second line contains n space-separated positive integers a1,βa2,β...,βan (1ββ€βaiββ€β100) β the running time of each of the n correct solutions in seconds. The third line contains m space-separated positive integers b1,βb2,β...,βbm (1ββ€βbiββ€β100) β the runni... | ["5", "-1"] | #include <stdio.h>
#define MAX 107
int main()
{
int n, m, max = 0, min = MAX, i, x, ans;
scanf("%d %d", &n, &m);
for(i=0;i<n;++i)
{
scanf("%d", &x);
if(x > max)
{
max = x;
}
if(x < min)
{
min = x;
}
}
ans = (max >= 2 * min) ? max : 2 * min;
for(i=0;i<m;++i)
{
scanf("%d", &x);
if(x <= an... | |
Valera wanted to prepare a Codesecrof round. He's already got one problem and he wants to set a time limit (TL) on it.Valera has written n correct solutions. For each correct solution, he knows its running time (in seconds). Valera has also wrote m wrong solutions and for each wrong solution he knows its running time (... | If there is a valid TL value, print it. Otherwise, print -1. | C | 49c47ebfd710a3733ce7ecb3a3c134a7 | 7be94b139b2b57d1f9c82e8898715103 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy",
"brute force"
] | 1380641400 | ["3 6\n4 5 2\n8 9 6 10 7 11", "3 1\n3 4 5\n6"] | null | PASSED | 1,200 | standard input | 2 seconds | The first line contains two integers n, m (1ββ€βn,βmββ€β100). The second line contains n space-separated positive integers a1,βa2,β...,βan (1ββ€βaiββ€β100) β the running time of each of the n correct solutions in seconds. The third line contains m space-separated positive integers b1,βb2,β...,βbm (1ββ€βbiββ€β100) β the runni... | ["5", "-1"] | #include<stdio.h>
int a[105],b[105];
int main()
{
int n,m;
int i,max,min,j;
scanf("%d%d",&n,&m);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<m;i++)
scanf("%d",&b[i]);
max=a[0];
min=b[0];
for(i=1;i<m;i++)
{
if(min>b[i])
min=b[i];
}
for(i=1;i<n;i++)
{
if(max<a[i])
max=a[i];
}
// printf("%d %d... | |
Valera wanted to prepare a Codesecrof round. He's already got one problem and he wants to set a time limit (TL) on it.Valera has written n correct solutions. For each correct solution, he knows its running time (in seconds). Valera has also wrote m wrong solutions and for each wrong solution he knows its running time (... | If there is a valid TL value, print it. Otherwise, print -1. | C | 49c47ebfd710a3733ce7ecb3a3c134a7 | da4e8a96b946bd36929f628e851fc54e | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy",
"brute force"
] | 1380641400 | ["3 6\n4 5 2\n8 9 6 10 7 11", "3 1\n3 4 5\n6"] | null | PASSED | 1,200 | standard input | 2 seconds | The first line contains two integers n, m (1ββ€βn,βmββ€β100). The second line contains n space-separated positive integers a1,βa2,β...,βan (1ββ€βaiββ€β100) β the running time of each of the n correct solutions in seconds. The third line contains m space-separated positive integers b1,βb2,β...,βbm (1ββ€βbiββ€β100) β the runni... | ["5", "-1"] | #include <stdio.h>
int cmpfunc(const void *a, const void *b)
{
return (*(int*)a-*(int*)b);
}
int main()
{
int ans, n, m, a[101], b[101], i, j;
scanf("%d %d", &n, &m);
for(i=0; i<n; i++)
scanf("%d", &a[i]);
for(i=0; i<m; i++)
scanf("%d", &b[i]);
qsort(a, n, sizeof(int), cmpfunc)... | |
Valera wanted to prepare a Codesecrof round. He's already got one problem and he wants to set a time limit (TL) on it.Valera has written n correct solutions. For each correct solution, he knows its running time (in seconds). Valera has also wrote m wrong solutions and for each wrong solution he knows its running time (... | If there is a valid TL value, print it. Otherwise, print -1. | C | 49c47ebfd710a3733ce7ecb3a3c134a7 | 72109cb843e70eaf04750c35696c9ed6 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy",
"brute force"
] | 1380641400 | ["3 6\n4 5 2\n8 9 6 10 7 11", "3 1\n3 4 5\n6"] | null | PASSED | 1,200 | standard input | 2 seconds | The first line contains two integers n, m (1ββ€βn,βmββ€β100). The second line contains n space-separated positive integers a1,βa2,β...,βan (1ββ€βaiββ€β100) β the running time of each of the n correct solutions in seconds. The third line contains m space-separated positive integers b1,βb2,β...,βbm (1ββ€βbiββ€β100) β the runni... | ["5", "-1"] | #include<stdio.h>
int main()
{
int i,j,k=0,t,n,m,a[100],b[100],ex=0;
scanf("%d %d",&n,&m);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<m;i++){
scanf("%d",&b[i]);
if(i==0)
k=b[0];
else if(k>b[i])
k=b[i];}
for(i=0;i<n;i++)
for(j=i;j<n;j++)
{if(a[i]>a[j])
{t=a[i];
a[i]=a[j];
a[j]=t;}t=0;
}for(i=0;i<n;i++)
{
if(2*a[i]<=a... | |
Valera wanted to prepare a Codesecrof round. He's already got one problem and he wants to set a time limit (TL) on it.Valera has written n correct solutions. For each correct solution, he knows its running time (in seconds). Valera has also wrote m wrong solutions and for each wrong solution he knows its running time (... | If there is a valid TL value, print it. Otherwise, print -1. | C | 49c47ebfd710a3733ce7ecb3a3c134a7 | aca82ac4a5c05b83df5e16223c710583 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy",
"brute force"
] | 1380641400 | ["3 6\n4 5 2\n8 9 6 10 7 11", "3 1\n3 4 5\n6"] | null | PASSED | 1,200 | standard input | 2 seconds | The first line contains two integers n, m (1ββ€βn,βmββ€β100). The second line contains n space-separated positive integers a1,βa2,β...,βan (1ββ€βaiββ€β100) β the running time of each of the n correct solutions in seconds. The third line contains m space-separated positive integers b1,βb2,β...,βbm (1ββ€βbiββ€β100) β the runni... | ["5", "-1"] | #include <stdio.h>
#include <stdlib.h>
int part(int *a, int p, int r)
{
int x = a[r];
int i, j, t;
i = p - 1;
for (j = p; j < r; j++) {
if (a[j] < x) {
i++;
t = a[j];
a[j] = a[i];
a[i] = t;
}
}
t = a[i + 1];
a[i + 1] = a[r];
... | |
Valera wanted to prepare a Codesecrof round. He's already got one problem and he wants to set a time limit (TL) on it.Valera has written n correct solutions. For each correct solution, he knows its running time (in seconds). Valera has also wrote m wrong solutions and for each wrong solution he knows its running time (... | If there is a valid TL value, print it. Otherwise, print -1. | C | 49c47ebfd710a3733ce7ecb3a3c134a7 | 0b20b2c6ccbfcc3ef6030f2c6f97e4f8 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy",
"brute force"
] | 1380641400 | ["3 6\n4 5 2\n8 9 6 10 7 11", "3 1\n3 4 5\n6"] | null | PASSED | 1,200 | standard input | 2 seconds | The first line contains two integers n, m (1ββ€βn,βmββ€β100). The second line contains n space-separated positive integers a1,βa2,β...,βan (1ββ€βaiββ€β100) β the running time of each of the n correct solutions in seconds. The third line contains m space-separated positive integers b1,βb2,β...,βbm (1ββ€βbiββ€β100) β the runni... | ["5", "-1"] | #include <stdio.h>
int compare (const void * a, const void * b)
{
return ( *(int*)a - *(int*)b );
}
int main(void) {
int i,a,b;
int cr[1010],wr[1010];
// your code goes here
scanf("%d%d",&a,&b);
for(i=0;i<a;i++)
{
scanf("%d",&cr[i]);
}
for(i=0;i<b;i++){
sca... | |
Valera wanted to prepare a Codesecrof round. He's already got one problem and he wants to set a time limit (TL) on it.Valera has written n correct solutions. For each correct solution, he knows its running time (in seconds). Valera has also wrote m wrong solutions and for each wrong solution he knows its running time (... | If there is a valid TL value, print it. Otherwise, print -1. | C | 49c47ebfd710a3733ce7ecb3a3c134a7 | dc72d29dae727a7cca03b3b68d74596e | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy",
"brute force"
] | 1380641400 | ["3 6\n4 5 2\n8 9 6 10 7 11", "3 1\n3 4 5\n6"] | null | PASSED | 1,200 | standard input | 2 seconds | The first line contains two integers n, m (1ββ€βn,βmββ€β100). The second line contains n space-separated positive integers a1,βa2,β...,βan (1ββ€βaiββ€β100) β the running time of each of the n correct solutions in seconds. The third line contains m space-separated positive integers b1,βb2,β...,βbm (1ββ€βbiββ€β100) β the runni... | ["5", "-1"] | #include<stdio.h>
#include<stdlib.h>
int min(int a,int b)
{
if(a<b)
return a;
else
return b;
}
int main()
{
int n,m;
int i,j,cmax=-1,c[101],wr[101],cmin=100000000,wmin=10000000;
scanf("%d%d",&n,&m);
for(i=0;i<n;i++)
{
scanf("%d",&c[i]);
cmin=min(cmin,c[i]);
if(c[i]>cmax)
cmax=c[i];
}
for(i=0;i<m;i... | |
Valera wanted to prepare a Codesecrof round. He's already got one problem and he wants to set a time limit (TL) on it.Valera has written n correct solutions. For each correct solution, he knows its running time (in seconds). Valera has also wrote m wrong solutions and for each wrong solution he knows its running time (... | If there is a valid TL value, print it. Otherwise, print -1. | C | 49c47ebfd710a3733ce7ecb3a3c134a7 | da6ee7d2ccece6b31b8011f4b66ebced | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy",
"brute force"
] | 1380641400 | ["3 6\n4 5 2\n8 9 6 10 7 11", "3 1\n3 4 5\n6"] | null | PASSED | 1,200 | standard input | 2 seconds | The first line contains two integers n, m (1ββ€βn,βmββ€β100). The second line contains n space-separated positive integers a1,βa2,β...,βan (1ββ€βaiββ€β100) β the running time of each of the n correct solutions in seconds. The third line contains m space-separated positive integers b1,βb2,β...,βbm (1ββ€βbiββ€β100) β the runni... | ["5", "-1"] | #include <stdio.h>
#include <stdlib.h>
#include <windows.h>
int cmpfunc (const void * a, const void * b)
{
return ( *(int*)a - *(int*)b );
}
int main() {
int i,n,m;
int minr,maxr,minw;
int r[100],w[100];
int num;
scanf("%d %d",&n,&m);
for (i=0 ; i<n ; i++) {
scanf("%d",&r[i]);
... | |
Valera wanted to prepare a Codesecrof round. He's already got one problem and he wants to set a time limit (TL) on it.Valera has written n correct solutions. For each correct solution, he knows its running time (in seconds). Valera has also wrote m wrong solutions and for each wrong solution he knows its running time (... | If there is a valid TL value, print it. Otherwise, print -1. | C | 49c47ebfd710a3733ce7ecb3a3c134a7 | 5171ed199230edbb41e04ee027674810 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy",
"brute force"
] | 1380641400 | ["3 6\n4 5 2\n8 9 6 10 7 11", "3 1\n3 4 5\n6"] | null | PASSED | 1,200 | standard input | 2 seconds | The first line contains two integers n, m (1ββ€βn,βmββ€β100). The second line contains n space-separated positive integers a1,βa2,β...,βan (1ββ€βaiββ€β100) β the running time of each of the n correct solutions in seconds. The third line contains m space-separated positive integers b1,βb2,β...,βbm (1ββ€βbiββ€β100) β the runni... | ["5", "-1"] | #include<stdio.h>
#include<stdlib.h>
int main()
{
int a[1000],b[1000],c,d,e,i,j,k,l,max=1,min=100,min1=100,n,m;
scanf("%d",&n);
scanf("%d",&m);
max=1;
min=100;
min1=100;
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(j=0;j<m;j++)
{
scanf("%d",&b[j]);
}
fo... | |
Valera wanted to prepare a Codesecrof round. He's already got one problem and he wants to set a time limit (TL) on it.Valera has written n correct solutions. For each correct solution, he knows its running time (in seconds). Valera has also wrote m wrong solutions and for each wrong solution he knows its running time (... | If there is a valid TL value, print it. Otherwise, print -1. | C | 49c47ebfd710a3733ce7ecb3a3c134a7 | 0b165345388b3e7e6b396c3ca2d37733 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy",
"brute force"
] | 1380641400 | ["3 6\n4 5 2\n8 9 6 10 7 11", "3 1\n3 4 5\n6"] | null | PASSED | 1,200 | standard input | 2 seconds | The first line contains two integers n, m (1ββ€βn,βmββ€β100). The second line contains n space-separated positive integers a1,βa2,β...,βan (1ββ€βaiββ€β100) β the running time of each of the n correct solutions in seconds. The third line contains m space-separated positive integers b1,βb2,β...,βbm (1ββ€βbiββ€β100) β the runni... | ["5", "-1"] | #include<stdio.h>
#include<limits.h>
int fmax(int a,int b);
int main()
{
int n,m;
scanf("%d%d",&n,&m);
int a[n],b[m],i;
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
/*if(a[i]>p)
p=a[i];
if(a[i]<v)
v=a[i];*/
}
for(i=0;i<m;i+... | |
Valera wanted to prepare a Codesecrof round. He's already got one problem and he wants to set a time limit (TL) on it.Valera has written n correct solutions. For each correct solution, he knows its running time (in seconds). Valera has also wrote m wrong solutions and for each wrong solution he knows its running time (... | If there is a valid TL value, print it. Otherwise, print -1. | C | 49c47ebfd710a3733ce7ecb3a3c134a7 | 4b01d408a97fcc46926d461c8beb2a20 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy",
"brute force"
] | 1380641400 | ["3 6\n4 5 2\n8 9 6 10 7 11", "3 1\n3 4 5\n6"] | null | PASSED | 1,200 | standard input | 2 seconds | The first line contains two integers n, m (1ββ€βn,βmββ€β100). The second line contains n space-separated positive integers a1,βa2,β...,βan (1ββ€βaiββ€β100) β the running time of each of the n correct solutions in seconds. The third line contains m space-separated positive integers b1,βb2,β...,βbm (1ββ€βbiββ€β100) β the runni... | ["5", "-1"] | #define r(i,j) for(i=0;i++<j;)
#define s(a) scanf("%d",&a)
main(){int ans,a,b,v,m =101,n=-1,l=101,i;
s(a),s(b);r(i,a)s(v),(v>n)?n=v:0,(v<m)?m=v:0;r(i,b)s(v),(v<l)?l=v:0;
(m*2>n)?n=m*2:0;printf("%d",(n<l)?n:-1);return 0;} | |
Valera wanted to prepare a Codesecrof round. He's already got one problem and he wants to set a time limit (TL) on it.Valera has written n correct solutions. For each correct solution, he knows its running time (in seconds). Valera has also wrote m wrong solutions and for each wrong solution he knows its running time (... | If there is a valid TL value, print it. Otherwise, print -1. | C | 49c47ebfd710a3733ce7ecb3a3c134a7 | 78cc6803b24e7076659dbb77b7a9691e | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy",
"brute force"
] | 1380641400 | ["3 6\n4 5 2\n8 9 6 10 7 11", "3 1\n3 4 5\n6"] | null | PASSED | 1,200 | standard input | 2 seconds | The first line contains two integers n, m (1ββ€βn,βmββ€β100). The second line contains n space-separated positive integers a1,βa2,β...,βan (1ββ€βaiββ€β100) β the running time of each of the n correct solutions in seconds. The third line contains m space-separated positive integers b1,βb2,β...,βbm (1ββ€βbiββ€β100) β the runni... | ["5", "-1"] | #include<stdio.h>
#include<stdlib.h>
int max(int a,int b)
{
return (a>b?a:b);
}
int compare (const void * a, const void * b)
{
return ( *(long long int*)a - *(long long int*)b );
}
int main()
{
int n,m,i,d,j;
scanf("%d %d",&n,&m);
int a[n];
int b[m];
for(i=0;i<n;i++)
scanf("%d",&a[i]);... | |
Valera wanted to prepare a Codesecrof round. He's already got one problem and he wants to set a time limit (TL) on it.Valera has written n correct solutions. For each correct solution, he knows its running time (in seconds). Valera has also wrote m wrong solutions and for each wrong solution he knows its running time (... | If there is a valid TL value, print it. Otherwise, print -1. | C | 49c47ebfd710a3733ce7ecb3a3c134a7 | b31a5f96b48f4896b144f82740c6a223 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy",
"brute force"
] | 1380641400 | ["3 6\n4 5 2\n8 9 6 10 7 11", "3 1\n3 4 5\n6"] | null | PASSED | 1,200 | standard input | 2 seconds | The first line contains two integers n, m (1ββ€βn,βmββ€β100). The second line contains n space-separated positive integers a1,βa2,β...,βan (1ββ€βaiββ€β100) β the running time of each of the n correct solutions in seconds. The third line contains m space-separated positive integers b1,βb2,β...,βbm (1ββ€βbiββ€β100) β the runni... | ["5", "-1"] | #include <stdio.h>
int main()
{
int n, m, x1 = 0, y1 = 100, x2 = 0, y2 = 100, i;
scanf("%d %d", &n, &m);
for (i = 0; i < n; i++) {
int x;
scanf("%d", &x);
if (x > x1) x1 = x;
if (x < y1) y1 = x;
}
for (i = 0; i < m; i++) {
int... | |
Valera wanted to prepare a Codesecrof round. He's already got one problem and he wants to set a time limit (TL) on it.Valera has written n correct solutions. For each correct solution, he knows its running time (in seconds). Valera has also wrote m wrong solutions and for each wrong solution he knows its running time (... | If there is a valid TL value, print it. Otherwise, print -1. | C | 49c47ebfd710a3733ce7ecb3a3c134a7 | 30900a122255b599af479ddb4f9936eb | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy",
"brute force"
] | 1380641400 | ["3 6\n4 5 2\n8 9 6 10 7 11", "3 1\n3 4 5\n6"] | null | PASSED | 1,200 | standard input | 2 seconds | The first line contains two integers n, m (1ββ€βn,βmββ€β100). The second line contains n space-separated positive integers a1,βa2,β...,βan (1ββ€βaiββ€β100) β the running time of each of the n correct solutions in seconds. The third line contains m space-separated positive integers b1,βb2,β...,βbm (1ββ€βbiββ€β100) β the runni... | ["5", "-1"] | #include<stdio.h>
#include<stdlib.h>
#define BUF 4096
#define true 1
#define false 0
typedef int bool;
char ibuf[BUF];
int ipt = BUF;
long long readint();
int main()
{
int n,m;
int maxcor=0,mincor=300,tmp;
int maxwrg=0,minwrg=300;
n=readint();
m=readint();
while(n--)
{
tmp=readint();
if(tmp>maxcor)
maxc... | |
Valera wanted to prepare a Codesecrof round. He's already got one problem and he wants to set a time limit (TL) on it.Valera has written n correct solutions. For each correct solution, he knows its running time (in seconds). Valera has also wrote m wrong solutions and for each wrong solution he knows its running time (... | If there is a valid TL value, print it. Otherwise, print -1. | C | 49c47ebfd710a3733ce7ecb3a3c134a7 | e374fcc01450341c6187887eb6f26c88 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy",
"brute force"
] | 1380641400 | ["3 6\n4 5 2\n8 9 6 10 7 11", "3 1\n3 4 5\n6"] | null | PASSED | 1,200 | standard input | 2 seconds | The first line contains two integers n, m (1ββ€βn,βmββ€β100). The second line contains n space-separated positive integers a1,βa2,β...,βan (1ββ€βaiββ€β100) β the running time of each of the n correct solutions in seconds. The third line contains m space-separated positive integers b1,βb2,β...,βbm (1ββ€βbiββ€β100) β the runni... | ["5", "-1"] | #include<stdio.h>
int main()
{
int max=0;
int min1=1000000;
int min2=1000000;
int n,m,i;
scanf("%d %d",&n,&m);
int c[n],w[m];
for(i=0;i<n;i++)
{
scanf("%d",&c[i]);
if(c[i]>max)
{
max=c[i];
}
if(c[i]<min1)
{
min1=c[i];
}
}
for(i=0;i<m;i++)
{
scanf("%d",&w[i]);
if(w[i]<min2)
{
min2... | |
Valera wanted to prepare a Codesecrof round. He's already got one problem and he wants to set a time limit (TL) on it.Valera has written n correct solutions. For each correct solution, he knows its running time (in seconds). Valera has also wrote m wrong solutions and for each wrong solution he knows its running time (... | If there is a valid TL value, print it. Otherwise, print -1. | C | 49c47ebfd710a3733ce7ecb3a3c134a7 | 5e2e54161a7e4d21e05d0b78b3f2c4e2 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy",
"brute force"
] | 1380641400 | ["3 6\n4 5 2\n8 9 6 10 7 11", "3 1\n3 4 5\n6"] | null | PASSED | 1,200 | standard input | 2 seconds | The first line contains two integers n, m (1ββ€βn,βmββ€β100). The second line contains n space-separated positive integers a1,βa2,β...,βan (1ββ€βaiββ€β100) β the running time of each of the n correct solutions in seconds. The third line contains m space-separated positive integers b1,βb2,β...,βbm (1ββ€βbiββ€β100) β the runni... | ["5", "-1"] | #include<stdio.h>
int main(void)
{
int n,m,i,t,max1=0,min1=101,max2=0,min2=101,v;
scanf("%d%d",&n,&m);
for(i=0;i<n;i++)
{
scanf("%d",&t);
if(t>=max1)
max1=t;
if(t<=min1)
min1=t;
}
for(i=0;i<m;i++)
{
scanf("%d",&t);
if(t>=max2)
max2=t;
if(t<=min2)
min2=t;
}
v=2*min1;
if(v<max1)
v=max1... | |
Valera wanted to prepare a Codesecrof round. He's already got one problem and he wants to set a time limit (TL) on it.Valera has written n correct solutions. For each correct solution, he knows its running time (in seconds). Valera has also wrote m wrong solutions and for each wrong solution he knows its running time (... | If there is a valid TL value, print it. Otherwise, print -1. | C | 49c47ebfd710a3733ce7ecb3a3c134a7 | ef35d0d4a9c0bde9a382bae3f05aed2c | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"greedy",
"brute force"
] | 1380641400 | ["3 6\n4 5 2\n8 9 6 10 7 11", "3 1\n3 4 5\n6"] | null | PASSED | 1,200 | standard input | 2 seconds | The first line contains two integers n, m (1ββ€βn,βmββ€β100). The second line contains n space-separated positive integers a1,βa2,β...,βan (1ββ€βaiββ€β100) β the running time of each of the n correct solutions in seconds. The third line contains m space-separated positive integers b1,βb2,β...,βbm (1ββ€βbiββ€β100) β the runni... | ["5", "-1"] | #include<stdio.h>
int main()
{
int n,m,i,nn[100],mm[100],minn,max,minm,temp;
scanf("%d %d",&n,&m);
scanf("\n%d",&nn[0]);
for(i=1;i<n;i++)
scanf(" %d",&nn[i]);
scanf("\n%d",&mm[0]);
for(i=1;i<m;i++)
scanf(" %d",&mm[i]);
minn=nn[0];max=nn[0];
for(i=1;i<n;i++)
{
if(nn[i]>max)
max=nn[i];
if(nn[i]<minn)... | |
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 | 7794aaf71a47ed9be813799990f40d39 | 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 v1,t,s,d,h,v,e,v2;
double pi=2*acos(0.0);
scanf ("%lf%lf%lf%lf",&d,&h,&v,&e);
v1=(pi*(d/2.0)*(d/2.0)*h);
v2=(pi*(d/2.0)*(d/2.0)*e);
if(v>v2)
{
s=v-v2;
s=v1/s;
printf ("YES\n%.12lf\n",s);
}
else
{
... | |
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 | 5306354d13745b9afb6ea3aefb9d122d | 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;
double g;
scanf("%lf%lf%lf%lf",&d,&h,&v,&e);
if(e*0.78539816339*d*d >= v) {
printf("NO\n");
}
else {
g = h/((v/(0.78539816339*d*d)) - e);
printf("YES\n");
printf("%lf\n",g);
}
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 | d328e728c932ad4ba8a4b7ff77771a73 | 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.14159265
int main()
{
float d,h,v,e,r;
scanf("%f%f%f%f",&d,&h,&v,&e);
r=d/2;
if((v/(r*r)*pi)-e<=0)
printf("NO");
else
printf("YES\n%f",h/((v/((r*r)*pi)-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 | 7ded62b63c895990bcf880eaa1c3496e | 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.14159265358979323846264338327950
int main(void) {
int d, h, v, e;
double r;
scanf("%d %d %d %d", &d, &h, &v, &e);
r = d / 2.;
if (PI * r * r * e > v)
puts("NO");
else
printf("YES\n%.12f\n", PI * r * r * h / (v - PI * r * r * 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 | 6bb4ad294804a47410dac4020ab9fcc4 | 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 argc, char const *argv[])
{
double d, h, v, e;
while(~scanf("%lf %lf %lf %lf", &d, &h, &v, &e))
{
e=e*pi*(d/2)*(d/2);
if(e>=v)
{
puts("NO");
}
else
{
printf("YES\n%.12f\n", pi*h*(d/2)*(d/2)/(v-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 | 3eafeed6acb46ff3da6b93e11df8b2a9 | 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>
#define pi 3.1415926
int main()
{
double d, h, v, e;
double oriV, incV, decV;
double baseSize;
double time;
scanf("%lf %lf %lf %lf", &d, &h, &v, &e);
baseSize = pi*d*d/4;
incV = e*baseSize;
decV = v;
if (incV>=decV)
{... | |
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 | 5112cb232ba184aee5809211e880e9de | 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 a,b,c,d,x,r,p,t;
scanf("%lf %lf %lf %lf",&a,&b,&c,&d);
x=3.14159265*(a/2)*d*(a/2);
if(x>=c)
{
printf("NO");
}
else
{
r=c-x;
p=3.14159265*(a/2)*(a/2)*b;
t=p/r;
printf("YES\n%.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 | c3aa3ec18f9cd8772a59334c14b89526 | 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>
int main()
{
double d,h,v,e,V,s,val;
scanf("%lf %lf %lf %lf",&d,&h,&v,&e);
//e=E*2*pi*d*d/4;
double S;
double pi;
pi=3.1415926535897932;
S=(pi*d*d)/4;
V=v/S;
val=S*h;
s=h/(V-e);
if((V-e)<=0)
{
printf("NO");
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 | bf693c8c855911c6048a958da4050a0f | 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"] | /*******************************************************************************\
|*********S*** ****** ************* ************* ************** * ******|
|*********** ******** ************ ************ *********** ** ******|
|********* ********** *********** *** *********** * ********* *** ... | |
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 | f2ba37473f341101e480bf2d0f095145 | 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%lf%lf%lf", &d, &h, &v, &e);
double s = M_PI * d * d / 4;
double hspd_pour = e;
double hspd_drink = v / s;
if (hspd_pour < hspd_drink - 1e-6) {
puts("YES");
double time = h / (hspd_drink - hspd_pour);... | |
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 | 0da3413b5f8fe5e70113256afdefc2e6 | 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>
double d,h,e,v;
int main()
{
double pi =3.14159265358979323846264338327950288;
scanf("%lf %lf %lf %lf",&d,&h,&v,&e);
if(4*v>d*d*e*pi){
printf("YES\n%.12lf",d*d*pi*h/(4*v-d*d*e*pi));
} else {
printf("NO");
}
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 | 538a735227fff64fe60634e1fbd6c4de | 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 pi=acos(-1);
double t,r;
int d,h,v,e;
scanf("%d %d %d %d", &d, &h, &v, &e);
r=v-(0.25*pi*d*d*e);
if(r>0)
{
t=(0.25*pi*d*d*h)/r;
if(t<=10000)
{
printf("YES\n");
printf("%lf", t);
}
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 | 12e15e3f38427b9b1249074fc7d3f5f7 | 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;
scanf("%d%d%d%d",&d,&h,&v,&e);
double area;
area=h/((v/((3.1415926535*d*d)/(4.0)))-e);
if(area<0)
printf("NO");
else
{
if(area>10000)
printf("NO");
else
printf("YES\n%.12lf",area);
}
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 | 02c3613a45ff5480d0543795f68760bd | 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 _USE_MATH_DEFINES // for C
//#include <math.h>
int main()
{
// your code goes here
double Pi=3.14159265358979323846;
int d,h,v,e;
scanf("%d %d %d %d",&d,&h,&v,&e);
double Sd=Pi*1.0*(d/2.0)*(d/2.0);
double s=(h*1.0)/((-e)*1.0+(v*1.0)/(Sd*1.0));
//print
if (s<(10*10*10*10*1... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.