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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
You are given two positive integers $$$n$$$ and $$$k$$$. Print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.For example, if $$$n=3$$$, and $$$k=7$$$, then all numbers that are not divisible by $$$3$$$ are: $$$1, 2, 4, 5, 7, 8, 10, 11, 13 \dots$$$. The $$$7$$$-th number among them is $$$10$$$. | For each test case print the $$$k$$$-th positive integer that is not divisible by $$$n$$$. | C | 7d6f76e24fe9a352beea820ab56f03b6 | 64e75223f0fb8c1fe58559122d2c93ad | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"binary search",
"math"
] | 1589034900 | ["6\n3 7\n4 12\n2 1000000000\n7 97\n1000000000 1000000000\n2 1"] | null | PASSED | 1,200 | standard input | 1 second | The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$2 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$). | ["10\n15\n1999999999\n113\n1000000001\n1"] | #include<stdio.h>
int main()
{
unsigned int t,n,k,i,var,quo,rem;
scanf("%u",&t);
for(i=0;i<t;i++)
{
scanf("%u%u",&n,&k);
var = n-1;
quo = k/var;
rem = k%var;
if(rem!=0)
{printf("%u\n",n*quo+rem);}
else
{
printf("%u\n",n*quo-1);
... | |
You are given two positive integers $$$n$$$ and $$$k$$$. Print the $$$k$$$-th positive integer that is not divisible by $$$n$$$.For example, if $$$n=3$$$, and $$$k=7$$$, then all numbers that are not divisible by $$$3$$$ are: $$$1, 2, 4, 5, 7, 8, 10, 11, 13 \dots$$$. The $$$7$$$-th number among them is $$$10$$$. | For each test case print the $$$k$$$-th positive integer that is not divisible by $$$n$$$. | C | 7d6f76e24fe9a352beea820ab56f03b6 | 5c858ddfe3213db013b8a7a43e1f5bbb | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"binary search",
"math"
] | 1589034900 | ["6\n3 7\n4 12\n2 1000000000\n7 97\n1000000000 1000000000\n2 1"] | null | PASSED | 1,200 | standard input | 1 second | The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$2 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$). | ["10\n15\n1999999999\n113\n1000000001\n1"] | #include <stdio.h>
int main()
{
int t, n, k;
scanf("%d", &t);
for(int l = 0; l < t; l++)
{
scanf("%d%d", &n, &k);
int r = k / n;
int n1 = r * n;
int n2 = n1 + r + k % n;
while(n2 / n > n1 / n)
{
int aux = n2;
n2 = n2 + (n2 / n - n1 / n);
n1 = aux;
}
printf("%d\n", n2);
}
return 0;
} | |
Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. Besides, he can take several exams on one day, and in any order.According to the schedule, a studen... | Print a single integer — the minimum possible number of the day when Valera can take the last exam if he takes all the exams so that all the records in his record book go in the order of non-decreasing date. | C | 71bc7c4eb577441f2563e40d95306752 | 544d66d9d1096f7a44a74845072ccf2b | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1413709200 | ["3\n5 2\n3 1\n4 2", "3\n6 1\n5 2\n4 3"] | NoteIn the first sample Valera first takes an exam in the second subject on the first day (the teacher writes down the schedule date that is 3). On the next day he takes an exam in the third subject (the teacher writes down the schedule date, 4), then he takes an exam in the first subject (the teacher writes down the m... | PASSED | 1,400 | standard input | 1 second | The first line contains a single positive integer n (1 ≤ n ≤ 5000) — the number of exams Valera will take. Each of the next n lines contains two positive space-separated integers ai and bi (1 ≤ bi < ai ≤ 109) — the date of the exam in the schedule and the early date of passing the i-th exam, correspondingly. | ["2", "6"] | #include<stdio.h>
int main()
{
long long int n,x[5001],y[5001],i,j,t,Ans=0,c;
scanf("%I64d",&n);
for(i=0; i<n; i++) scanf("%I64d %I64d",&x[i],&y[i]);
for(i=0; i<n-1; i++)
{
for(j=0; j<n-1; j++)
{
if(x[j]>x[j+1])
{
t=x[j];
x[j]=... | |
Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. Besides, he can take several exams on one day, and in any order.According to the schedule, a studen... | Print a single integer — the minimum possible number of the day when Valera can take the last exam if he takes all the exams so that all the records in his record book go in the order of non-decreasing date. | C | 71bc7c4eb577441f2563e40d95306752 | 4f4b46d788d71c20eb173a3015ee0d90 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1413709200 | ["3\n5 2\n3 1\n4 2", "3\n6 1\n5 2\n4 3"] | NoteIn the first sample Valera first takes an exam in the second subject on the first day (the teacher writes down the schedule date that is 3). On the next day he takes an exam in the third subject (the teacher writes down the schedule date, 4), then he takes an exam in the first subject (the teacher writes down the m... | PASSED | 1,400 | standard input | 1 second | The first line contains a single positive integer n (1 ≤ n ≤ 5000) — the number of exams Valera will take. Each of the next n lines contains two positive space-separated integers ai and bi (1 ≤ bi < ai ≤ 109) — the date of the exam in the schedule and the early date of passing the i-th exam, correspondingly. | ["2", "6"] | #include<stdio.h>
#include<stdlib.h>
struct x
{
int a,b;
}per[10000];
int cmp(const void *a,const void *b)
{
if((*(struct x*)a).a != (*(struct x*)b).a)
return (*(struct x*)a).a - (*(struct x*)b).a;
else
return (*(struct x*)a).b - (*(struct x*)b).b;
}
int main(void)
{
int n,i,day = 0;
... | |
Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. Besides, he can take several exams on one day, and in any order.According to the schedule, a studen... | Print a single integer — the minimum possible number of the day when Valera can take the last exam if he takes all the exams so that all the records in his record book go in the order of non-decreasing date. | C | 71bc7c4eb577441f2563e40d95306752 | 77401ebcc17d760befd0bf23735e96b7 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1413709200 | ["3\n5 2\n3 1\n4 2", "3\n6 1\n5 2\n4 3"] | NoteIn the first sample Valera first takes an exam in the second subject on the first day (the teacher writes down the schedule date that is 3). On the next day he takes an exam in the third subject (the teacher writes down the schedule date, 4), then he takes an exam in the first subject (the teacher writes down the m... | PASSED | 1,400 | standard input | 1 second | The first line contains a single positive integer n (1 ≤ n ≤ 5000) — the number of exams Valera will take. Each of the next n lines contains two positive space-separated integers ai and bi (1 ≤ bi < ai ≤ 109) — the date of the exam in the schedule and the early date of passing the i-th exam, correspondingly. | ["2", "6"] | #include <stdio.h>
#include <stdlib.h>
static struct exam {
int a, b;
} ee[5000];
int compare(const void *a, const void *b) {
struct exam *pa = (struct exam *) a;
struct exam *pb = (struct exam *) b;
return pa->a != pb->a ? pa->a - pb->a : pa->b - pb->b;
}
int main() {
int i, n, min;
scanf("%d", &n);
for (i... | |
Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. Besides, he can take several exams on one day, and in any order.According to the schedule, a studen... | Print a single integer — the minimum possible number of the day when Valera can take the last exam if he takes all the exams so that all the records in his record book go in the order of non-decreasing date. | C | 71bc7c4eb577441f2563e40d95306752 | 8f40ccd3bf3009f2d808a8e159517790 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1413709200 | ["3\n5 2\n3 1\n4 2", "3\n6 1\n5 2\n4 3"] | NoteIn the first sample Valera first takes an exam in the second subject on the first day (the teacher writes down the schedule date that is 3). On the next day he takes an exam in the third subject (the teacher writes down the schedule date, 4), then he takes an exam in the first subject (the teacher writes down the m... | PASSED | 1,400 | standard input | 1 second | The first line contains a single positive integer n (1 ≤ n ≤ 5000) — the number of exams Valera will take. Each of the next n lines contains two positive space-separated integers ai and bi (1 ≤ bi < ai ≤ 109) — the date of the exam in the schedule and the early date of passing the i-th exam, correspondingly. | ["2", "6"] | #include <stdio.h>
int main() {
int n, m, k;
int a[6000];
int b[6000];
int max;
int i, j = 0;
scanf("%d", &n);
for (i = 0; i < n; i++){
scanf("%d %d", a + i, b + i);
}
for (i = 0; i < n-1; i++) {
for (j = n-2; j >= i; j--) {
if (b[j] > b[j+1]) {
k = a[j];
a[j] = a[j+1];
a[j+1] = k;
... | |
Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. Besides, he can take several exams on one day, and in any order.According to the schedule, a studen... | Print a single integer — the minimum possible number of the day when Valera can take the last exam if he takes all the exams so that all the records in his record book go in the order of non-decreasing date. | C | 71bc7c4eb577441f2563e40d95306752 | c0cbd53217caf69a645dce51ca32d7a5 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1413709200 | ["3\n5 2\n3 1\n4 2", "3\n6 1\n5 2\n4 3"] | NoteIn the first sample Valera first takes an exam in the second subject on the first day (the teacher writes down the schedule date that is 3). On the next day he takes an exam in the third subject (the teacher writes down the schedule date, 4), then he takes an exam in the first subject (the teacher writes down the m... | PASSED | 1,400 | standard input | 1 second | The first line contains a single positive integer n (1 ≤ n ≤ 5000) — the number of exams Valera will take. Each of the next n lines contains two positive space-separated integers ai and bi (1 ≤ bi < ai ≤ 109) — the date of the exam in the schedule and the early date of passing the i-th exam, correspondingly. | ["2", "6"] | #include<stdio.h>
main()
{
long long int a,b,c,d,i,swap,last=-1;
scanf("%I64d",&a);
long long int arr[5000];
long long int brr[5000];
for(i=0;i<a;i++)
{
scanf("%I64d",&arr[i]);
scanf("%I64d",&brr[i]);
}
for(c=0;c<a-1;c++)
for(d=0;d<a-c-1;d++)
{
if(arr[d]>a... | |
Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. Besides, he can take several exams on one day, and in any order.According to the schedule, a studen... | Print a single integer — the minimum possible number of the day when Valera can take the last exam if he takes all the exams so that all the records in his record book go in the order of non-decreasing date. | C | 71bc7c4eb577441f2563e40d95306752 | 350eb8437e020755170c33274655efe9 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1413709200 | ["3\n5 2\n3 1\n4 2", "3\n6 1\n5 2\n4 3"] | NoteIn the first sample Valera first takes an exam in the second subject on the first day (the teacher writes down the schedule date that is 3). On the next day he takes an exam in the third subject (the teacher writes down the schedule date, 4), then he takes an exam in the first subject (the teacher writes down the m... | PASSED | 1,400 | standard input | 1 second | The first line contains a single positive integer n (1 ≤ n ≤ 5000) — the number of exams Valera will take. Each of the next n lines contains two positive space-separated integers ai and bi (1 ≤ bi < ai ≤ 109) — the date of the exam in the schedule and the early date of passing the i-th exam, correspondingly. | ["2", "6"] | #include <stdio.h>
int x[5001][2],n;
void sort(void);
int main()
{
int i,j,day=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
for(j=0;j<2;j++)
{
scanf("%d",&x[i][j]);
}
}
sort();
for(i=0;i<n;i++)
{
if(x[i][1]>=day)
{
day=x[i][1];
}
else
{
day=x[i][0];
}
}
printf("%d\n",day);
return 0;
}
voi... | |
Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. Besides, he can take several exams on one day, and in any order.According to the schedule, a studen... | Print a single integer — the minimum possible number of the day when Valera can take the last exam if he takes all the exams so that all the records in his record book go in the order of non-decreasing date. | C | 71bc7c4eb577441f2563e40d95306752 | 951a690f8105ca2ac913d43e6c374c1f | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1413709200 | ["3\n5 2\n3 1\n4 2", "3\n6 1\n5 2\n4 3"] | NoteIn the first sample Valera first takes an exam in the second subject on the first day (the teacher writes down the schedule date that is 3). On the next day he takes an exam in the third subject (the teacher writes down the schedule date, 4), then he takes an exam in the first subject (the teacher writes down the m... | PASSED | 1,400 | standard input | 1 second | The first line contains a single positive integer n (1 ≤ n ≤ 5000) — the number of exams Valera will take. Each of the next n lines contains two positive space-separated integers ai and bi (1 ≤ bi < ai ≤ 109) — the date of the exam in the schedule and the early date of passing the i-th exam, correspondingly. | ["2", "6"] | #include<stdio.h>
int main()
{
long long int n,i,j,t,p,x;
scanf("%I64d",&n);
long long int a[n],b[n];
for(i=0;i<n;i++)
{
scanf("%I64d %I64d",&a[i],&b[i]);
}
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(a[i]>a[j])
{
t=a[i];
... | |
Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. Besides, he can take several exams on one day, and in any order.According to the schedule, a studen... | Print a single integer — the minimum possible number of the day when Valera can take the last exam if he takes all the exams so that all the records in his record book go in the order of non-decreasing date. | C | 71bc7c4eb577441f2563e40d95306752 | 29926ec8d3f19ea54d420e54d984a2a3 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1413709200 | ["3\n5 2\n3 1\n4 2", "3\n6 1\n5 2\n4 3"] | NoteIn the first sample Valera first takes an exam in the second subject on the first day (the teacher writes down the schedule date that is 3). On the next day he takes an exam in the third subject (the teacher writes down the schedule date, 4), then he takes an exam in the first subject (the teacher writes down the m... | PASSED | 1,400 | standard input | 1 second | The first line contains a single positive integer n (1 ≤ n ≤ 5000) — the number of exams Valera will take. Each of the next n lines contains two positive space-separated integers ai and bi (1 ≤ bi < ai ≤ 109) — the date of the exam in the schedule and the early date of passing the i-th exam, correspondingly. | ["2", "6"] | #include<stdio.h>
#include<stdlib.h>
#define MAX 5001
typedef struct Date{
long a,b;
}Date;
Date date[MAX];
int cmp(const void *s1, const void *s2){
const Date * d1 = (const Date *)s1;
const Date * d2 = (const Date *)s2;
if( (d1->a) - d2->a == 0)
return (d1->b) - (d2->b);
else
return (d1->a) - (d2->a);
}
int m... | |
Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. Besides, he can take several exams on one day, and in any order.According to the schedule, a studen... | Print a single integer — the minimum possible number of the day when Valera can take the last exam if he takes all the exams so that all the records in his record book go in the order of non-decreasing date. | C | 71bc7c4eb577441f2563e40d95306752 | efbc548dfae316963f9faa0fee6adf3a | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1413709200 | ["3\n5 2\n3 1\n4 2", "3\n6 1\n5 2\n4 3"] | NoteIn the first sample Valera first takes an exam in the second subject on the first day (the teacher writes down the schedule date that is 3). On the next day he takes an exam in the third subject (the teacher writes down the schedule date, 4), then he takes an exam in the first subject (the teacher writes down the m... | PASSED | 1,400 | standard input | 1 second | The first line contains a single positive integer n (1 ≤ n ≤ 5000) — the number of exams Valera will take. Each of the next n lines contains two positive space-separated integers ai and bi (1 ≤ bi < ai ≤ 109) — the date of the exam in the schedule and the early date of passing the i-th exam, correspondingly. | ["2", "6"] | #include <stdio.h>
#include <stdlib.h>
struct exams_t {
int a;
int b;
};
int compare_structs(const void* a, const void* b) {
const struct exams_t* a1 = (const struct exams_t*) a;
const struct exams_t* b1 = (const struct exams_t*) b;
// printf("a: %d, b: %d\n", a1.a, a1.b);
if (a1->a < b1->a)... | |
Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. Besides, he can take several exams on one day, and in any order.According to the schedule, a studen... | Print a single integer — the minimum possible number of the day when Valera can take the last exam if he takes all the exams so that all the records in his record book go in the order of non-decreasing date. | C | 71bc7c4eb577441f2563e40d95306752 | e33066ff16c213ed10e2d2bf87f83d94 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1413709200 | ["3\n5 2\n3 1\n4 2", "3\n6 1\n5 2\n4 3"] | NoteIn the first sample Valera first takes an exam in the second subject on the first day (the teacher writes down the schedule date that is 3). On the next day he takes an exam in the third subject (the teacher writes down the schedule date, 4), then he takes an exam in the first subject (the teacher writes down the m... | PASSED | 1,400 | standard input | 1 second | The first line contains a single positive integer n (1 ≤ n ≤ 5000) — the number of exams Valera will take. Each of the next n lines contains two positive space-separated integers ai and bi (1 ≤ bi < ai ≤ 109) — the date of the exam in the schedule and the early date of passing the i-th exam, correspondingly. | ["2", "6"] | #include <stdio.h>
#include <stdlib.h>
#define MAX_N (5000)
typedef struct {
int a;
int b;
} exam;
int cmp(const void * arg1, const void * arg2) {
const exam * ex1 = (const exam *)arg1;
const exam * ex2 = (const exam *)arg2;
if ( ex1->a != ex2-> a)
return ex1->a - ex2->a;
return ex1->b - ex2->b;
}
int main... | |
Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. Besides, he can take several exams on one day, and in any order.According to the schedule, a studen... | Print a single integer — the minimum possible number of the day when Valera can take the last exam if he takes all the exams so that all the records in his record book go in the order of non-decreasing date. | C | 71bc7c4eb577441f2563e40d95306752 | cdff3c083e1ad4831e5e33fbb3c47dfc | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1413709200 | ["3\n5 2\n3 1\n4 2", "3\n6 1\n5 2\n4 3"] | NoteIn the first sample Valera first takes an exam in the second subject on the first day (the teacher writes down the schedule date that is 3). On the next day he takes an exam in the third subject (the teacher writes down the schedule date, 4), then he takes an exam in the first subject (the teacher writes down the m... | PASSED | 1,400 | standard input | 1 second | The first line contains a single positive integer n (1 ≤ n ≤ 5000) — the number of exams Valera will take. Each of the next n lines contains two positive space-separated integers ai and bi (1 ≤ bi < ai ≤ 109) — the date of the exam in the schedule and the early date of passing the i-th exam, correspondingly. | ["2", "6"] | #include <stdio.h>
#include <stdlib.h>
int n,i,j;
int cmpfunc(const void *a, const void * b){
const int *x = *(const int**) a;
const int *y = *(const int**) b;
if(x[0]!=y[0]){
return x[0]-y[0];
}else{
return x[1]-y[1];
}
}
int main(){
scanf("%d", &n);
int **x;
x=malloc(n*sizeof(int*));
... | |
Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. Besides, he can take several exams on one day, and in any order.According to the schedule, a studen... | Print a single integer — the minimum possible number of the day when Valera can take the last exam if he takes all the exams so that all the records in his record book go in the order of non-decreasing date. | C | 71bc7c4eb577441f2563e40d95306752 | f6d0ad125078ba473f17c5deed440869 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1413709200 | ["3\n5 2\n3 1\n4 2", "3\n6 1\n5 2\n4 3"] | NoteIn the first sample Valera first takes an exam in the second subject on the first day (the teacher writes down the schedule date that is 3). On the next day he takes an exam in the third subject (the teacher writes down the schedule date, 4), then he takes an exam in the first subject (the teacher writes down the m... | PASSED | 1,400 | standard input | 1 second | The first line contains a single positive integer n (1 ≤ n ≤ 5000) — the number of exams Valera will take. Each of the next n lines contains two positive space-separated integers ai and bi (1 ≤ bi < ai ≤ 109) — the date of the exam in the schedule and the early date of passing the i-th exam, correspondingly. | ["2", "6"] | #include <stdio.h>
#include <stdlib.h>
int compare (const void * a, const void * b)
{
return ( *(int*)a - *(int*)b );
}
int a[5010][2];
int main()
{
int n,d;
scanf("%d",&n);;
int i;
for(i=0;i<n;i++) {
scanf("%d%d",&a[i][0],&a[i][1]);
}
qsort(a,n,2*sizeof(int),compare);
d=a[0][1]... | |
Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. Besides, he can take several exams on one day, and in any order.According to the schedule, a studen... | Print a single integer — the minimum possible number of the day when Valera can take the last exam if he takes all the exams so that all the records in his record book go in the order of non-decreasing date. | C | 71bc7c4eb577441f2563e40d95306752 | d9a22fd1576f31cb7f1072a83df72381 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1413709200 | ["3\n5 2\n3 1\n4 2", "3\n6 1\n5 2\n4 3"] | NoteIn the first sample Valera first takes an exam in the second subject on the first day (the teacher writes down the schedule date that is 3). On the next day he takes an exam in the third subject (the teacher writes down the schedule date, 4), then he takes an exam in the first subject (the teacher writes down the m... | PASSED | 1,400 | standard input | 1 second | The first line contains a single positive integer n (1 ≤ n ≤ 5000) — the number of exams Valera will take. Each of the next n lines contains two positive space-separated integers ai and bi (1 ≤ bi < ai ≤ 109) — the date of the exam in the schedule and the early date of passing the i-th exam, correspondingly. | ["2", "6"] | #include<stdio.h>
int main()
{
long long int n,i,j,t,c=0;
scanf("%lld",&n);
long long int a[n],b[n];
for(i=0;i<n;i++)
{
scanf("%lld %lld",&a[i],&b[i]);
}
for(i=0;i<n;i++)
{
for(j=i;j<n;j++)
{
if(a[i]>a[j])
{
t=a[i];
... | |
Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. Besides, he can take several exams on one day, and in any order.According to the schedule, a studen... | Print a single integer — the minimum possible number of the day when Valera can take the last exam if he takes all the exams so that all the records in his record book go in the order of non-decreasing date. | C | 71bc7c4eb577441f2563e40d95306752 | 4d703bfccbfa34ad71fce9fc56d4b7fc | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1413709200 | ["3\n5 2\n3 1\n4 2", "3\n6 1\n5 2\n4 3"] | NoteIn the first sample Valera first takes an exam in the second subject on the first day (the teacher writes down the schedule date that is 3). On the next day he takes an exam in the third subject (the teacher writes down the schedule date, 4), then he takes an exam in the first subject (the teacher writes down the m... | PASSED | 1,400 | standard input | 1 second | The first line contains a single positive integer n (1 ≤ n ≤ 5000) — the number of exams Valera will take. Each of the next n lines contains two positive space-separated integers ai and bi (1 ≤ bi < ai ≤ 109) — the date of the exam in the schedule and the early date of passing the i-th exam, correspondingly. | ["2", "6"] | //思路就是设计一个排序算法!
//我还在猜测题意!
#include<stdio.h>
#define EXAM 5000
void swap(int *a,int *b){
int tmp=*a;
*a=*b;
*b=tmp;
}
int min(int a,int b) {
if(a>b) return b;
else return a;
}
int main() {
int exam;
//exam表示考试的科目的数量!
scanf("%d",&exam);
int i,j;
int a[EXAM],b[EXAM];
for(i=0;i<exam;i++) {
scanf("%d%d",&a[i],... | |
Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. Besides, he can take several exams on one day, and in any order.According to the schedule, a studen... | Print a single integer — the minimum possible number of the day when Valera can take the last exam if he takes all the exams so that all the records in his record book go in the order of non-decreasing date. | C | 71bc7c4eb577441f2563e40d95306752 | 940441be628b0bd2b419e78ef79362ff | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1413709200 | ["3\n5 2\n3 1\n4 2", "3\n6 1\n5 2\n4 3"] | NoteIn the first sample Valera first takes an exam in the second subject on the first day (the teacher writes down the schedule date that is 3). On the next day he takes an exam in the third subject (the teacher writes down the schedule date, 4), then he takes an exam in the first subject (the teacher writes down the m... | PASSED | 1,400 | standard input | 1 second | The first line contains a single positive integer n (1 ≤ n ≤ 5000) — the number of exams Valera will take. Each of the next n lines contains two positive space-separated integers ai and bi (1 ≤ bi < ai ≤ 109) — the date of the exam in the schedule and the early date of passing the i-th exam, correspondingly. | ["2", "6"] | #include<stdio.h>
typedef struct node
{
int ad;
int bd;
}p;
int cmp(const void *a,const void *b)
{
const p* a1=a;
const p* a2=b;
if((a1->ad)-(a2->ad)==0)
return ((a1->bd)-(a2->bd));
return((a1->ad)-(a2->ad));
}
p a[5002];
int main()
{
int n,i;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d %d",&a[i].ad,&a[i].b... | |
Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. Besides, he can take several exams on one day, and in any order.According to the schedule, a studen... | Print a single integer — the minimum possible number of the day when Valera can take the last exam if he takes all the exams so that all the records in his record book go in the order of non-decreasing date. | C | 71bc7c4eb577441f2563e40d95306752 | b13db1b52334f1956544c4d0d3e04db0 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1413709200 | ["3\n5 2\n3 1\n4 2", "3\n6 1\n5 2\n4 3"] | NoteIn the first sample Valera first takes an exam in the second subject on the first day (the teacher writes down the schedule date that is 3). On the next day he takes an exam in the third subject (the teacher writes down the schedule date, 4), then he takes an exam in the first subject (the teacher writes down the m... | PASSED | 1,400 | standard input | 1 second | The first line contains a single positive integer n (1 ≤ n ≤ 5000) — the number of exams Valera will take. Each of the next n lines contains two positive space-separated integers ai and bi (1 ≤ bi < ai ≤ 109) — the date of the exam in the schedule and the early date of passing the i-th exam, correspondingly. | ["2", "6"] | #include<stdio.h>
int min(int a,int b)
{
if(a>b)
return b;
return a;
}
int max(int a,int b)
{
if(a>b)
return a;
return b;
}
void merge(int a[][3],int lo,int mi,int hi,int k)
{
int i,j,c,b;
c=mi-lo+1;
b=hi-mi;
int left[c][3],right[b][3];
for(i=0;i<c;i++)
{
left[i][k]=a[lo+i][k];
left[i][1-k]=a[lo+i][1-... | |
Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. Besides, he can take several exams on one day, and in any order.According to the schedule, a studen... | Print a single integer — the minimum possible number of the day when Valera can take the last exam if he takes all the exams so that all the records in his record book go in the order of non-decreasing date. | C | 71bc7c4eb577441f2563e40d95306752 | ed6f87b490f8a164747a02a08d8aed67 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1413709200 | ["3\n5 2\n3 1\n4 2", "3\n6 1\n5 2\n4 3"] | NoteIn the first sample Valera first takes an exam in the second subject on the first day (the teacher writes down the schedule date that is 3). On the next day he takes an exam in the third subject (the teacher writes down the schedule date, 4), then he takes an exam in the first subject (the teacher writes down the m... | PASSED | 1,400 | standard input | 1 second | The first line contains a single positive integer n (1 ≤ n ≤ 5000) — the number of exams Valera will take. Each of the next n lines contains two positive space-separated integers ai and bi (1 ≤ bi < ai ≤ 109) — the date of the exam in the schedule and the early date of passing the i-th exam, correspondingly. | ["2", "6"] | # include <stdio.h>
# include <stdlib.h>
typedef struct exam
{
long a;
long b;
}exam;
int compar(exam * e1, exam * e2)
{
if(e1->a - e2->a == 0)
return e1->b - e2->b;
else
return e1->a - e2->a;
}
int main(void)
{
long n;
scanf("%ld", &n);
exam exams[n];
long i;
for(i = 0; i < n; i++)
{
scanf("%ld%ld",... | |
Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. Besides, he can take several exams on one day, and in any order.According to the schedule, a studen... | Print a single integer — the minimum possible number of the day when Valera can take the last exam if he takes all the exams so that all the records in his record book go in the order of non-decreasing date. | C | 71bc7c4eb577441f2563e40d95306752 | 60d9a63a9bca7c035fa6573959fef27b | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1413709200 | ["3\n5 2\n3 1\n4 2", "3\n6 1\n5 2\n4 3"] | NoteIn the first sample Valera first takes an exam in the second subject on the first day (the teacher writes down the schedule date that is 3). On the next day he takes an exam in the third subject (the teacher writes down the schedule date, 4), then he takes an exam in the first subject (the teacher writes down the m... | PASSED | 1,400 | standard input | 1 second | The first line contains a single positive integer n (1 ≤ n ≤ 5000) — the number of exams Valera will take. Each of the next n lines contains two positive space-separated integers ai and bi (1 ≤ bi < ai ≤ 109) — the date of the exam in the schedule and the early date of passing the i-th exam, correspondingly. | ["2", "6"] | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int n;
struct D{
int a;
int b;
}data[5000];
void swap(struct D *A,struct D *B){
struct D t;
t=*A;
*A=*B;
*B=t;
}
int num;
int main(){
int i,j;
int tmp;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d %d",&data[i].a,&data[i].b);
... | |
Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. Besides, he can take several exams on one day, and in any order.According to the schedule, a studen... | Print a single integer — the minimum possible number of the day when Valera can take the last exam if he takes all the exams so that all the records in his record book go in the order of non-decreasing date. | C | 71bc7c4eb577441f2563e40d95306752 | 17b92ab49c4ffa4bdd1f94e398c2ff9a | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1413709200 | ["3\n5 2\n3 1\n4 2", "3\n6 1\n5 2\n4 3"] | NoteIn the first sample Valera first takes an exam in the second subject on the first day (the teacher writes down the schedule date that is 3). On the next day he takes an exam in the third subject (the teacher writes down the schedule date, 4), then he takes an exam in the first subject (the teacher writes down the m... | PASSED | 1,400 | standard input | 1 second | The first line contains a single positive integer n (1 ≤ n ≤ 5000) — the number of exams Valera will take. Each of the next n lines contains two positive space-separated integers ai and bi (1 ≤ bi < ai ≤ 109) — the date of the exam in the schedule and the early date of passing the i-th exam, correspondingly. | ["2", "6"] | #include <stdio.h>
typedef struct {
int later_day;
int early_day;
} Subject;
int compare(Subject subject1, Subject subject2) {
if (subject1.later_day > subject2.later_day)
return 1;
if (subject1.later_day < subject2.later_day)
return -1;
if (subject1.early_day > subject2.early_day)... | |
Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. Besides, he can take several exams on one day, and in any order.According to the schedule, a studen... | Print a single integer — the minimum possible number of the day when Valera can take the last exam if he takes all the exams so that all the records in his record book go in the order of non-decreasing date. | C | 71bc7c4eb577441f2563e40d95306752 | 01e384cd677f697ad6a57703c08d06a5 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1413709200 | ["3\n5 2\n3 1\n4 2", "3\n6 1\n5 2\n4 3"] | NoteIn the first sample Valera first takes an exam in the second subject on the first day (the teacher writes down the schedule date that is 3). On the next day he takes an exam in the third subject (the teacher writes down the schedule date, 4), then he takes an exam in the first subject (the teacher writes down the m... | PASSED | 1,400 | standard input | 1 second | The first line contains a single positive integer n (1 ≤ n ≤ 5000) — the number of exams Valera will take. Each of the next n lines contains two positive space-separated integers ai and bi (1 ≤ bi < ai ≤ 109) — the date of the exam in the schedule and the early date of passing the i-th exam, correspondingly. | ["2", "6"] | #include<stdio.h>
int main()
{
long a[5111],b[5111],n,i,j,t,o;
scanf("%ld",&n);
for(i=1;i<=n;i++)
{
scanf("%ld %ld",&a[i],&b[i]);
}
for(i=1;i<=n-1;i++)
{
for(j=1;j<=n-i;j++)
{
if(a[j]>a[j+1])
{
t=a[j];
a[j]=a[j+1... | |
Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. Besides, he can take several exams on one day, and in any order.According to the schedule, a studen... | Print a single integer — the minimum possible number of the day when Valera can take the last exam if he takes all the exams so that all the records in his record book go in the order of non-decreasing date. | C | 71bc7c4eb577441f2563e40d95306752 | d02da23030a3816ef09de45048a26fbe | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1413709200 | ["3\n5 2\n3 1\n4 2", "3\n6 1\n5 2\n4 3"] | NoteIn the first sample Valera first takes an exam in the second subject on the first day (the teacher writes down the schedule date that is 3). On the next day he takes an exam in the third subject (the teacher writes down the schedule date, 4), then he takes an exam in the first subject (the teacher writes down the m... | PASSED | 1,400 | standard input | 1 second | The first line contains a single positive integer n (1 ≤ n ≤ 5000) — the number of exams Valera will take. Each of the next n lines contains two positive space-separated integers ai and bi (1 ≤ bi < ai ≤ 109) — the date of the exam in the schedule and the early date of passing the i-th exam, correspondingly. | ["2", "6"] | #include <stdio.h>
#include <stdlib.h>
#include <limits.h>
int cmpfunc (const void * a, const void * b)
{
return ( *(int*)a - *(int*)b );
}
typedef struct yeah{
int a;
int b;
}ye;
ye ar[5010];
void merge(ye arr[], int l, int m, int r)
{
int i, j, k;
int n1 = m - l + 1;
int n2 = r - m;
/* create... | |
Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. Besides, he can take several exams on one day, and in any order.According to the schedule, a studen... | Print a single integer — the minimum possible number of the day when Valera can take the last exam if he takes all the exams so that all the records in his record book go in the order of non-decreasing date. | C | 71bc7c4eb577441f2563e40d95306752 | a37910c06ba3a7c2fbddb4d97a29fd9a | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1413709200 | ["3\n5 2\n3 1\n4 2", "3\n6 1\n5 2\n4 3"] | NoteIn the first sample Valera first takes an exam in the second subject on the first day (the teacher writes down the schedule date that is 3). On the next day he takes an exam in the third subject (the teacher writes down the schedule date, 4), then he takes an exam in the first subject (the teacher writes down the m... | PASSED | 1,400 | standard input | 1 second | The first line contains a single positive integer n (1 ≤ n ≤ 5000) — the number of exams Valera will take. Each of the next n lines contains two positive space-separated integers ai and bi (1 ≤ bi < ai ≤ 109) — the date of the exam in the schedule and the early date of passing the i-th exam, correspondingly. | ["2", "6"] | #include <stdio.h>
#include <stdlib.h>
#define SIZE 5000
struct exam {
int a, b;
};
int cmp (const void *_a, const void * _b)
{
struct exam a = *(struct exam *)_a;
struct exam b = *(struct exam *)_b;
return a.a != b.a ? a.a - b.a : a.b - b.b;
}
int main()
{
int n, i, d;
struct exam ex[SIZE];
scanf ("%d", &n... | |
Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. Besides, he can take several exams on one day, and in any order.According to the schedule, a studen... | Print a single integer — the minimum possible number of the day when Valera can take the last exam if he takes all the exams so that all the records in his record book go in the order of non-decreasing date. | C | 71bc7c4eb577441f2563e40d95306752 | 64064023454d29e812c26bfd1e6ca4f8 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1413709200 | ["3\n5 2\n3 1\n4 2", "3\n6 1\n5 2\n4 3"] | NoteIn the first sample Valera first takes an exam in the second subject on the first day (the teacher writes down the schedule date that is 3). On the next day he takes an exam in the third subject (the teacher writes down the schedule date, 4), then he takes an exam in the first subject (the teacher writes down the m... | PASSED | 1,400 | standard input | 1 second | The first line contains a single positive integer n (1 ≤ n ≤ 5000) — the number of exams Valera will take. Each of the next n lines contains two positive space-separated integers ai and bi (1 ≤ bi < ai ≤ 109) — the date of the exam in the schedule and the early date of passing the i-th exam, correspondingly. | ["2", "6"] | #include <stdio.h>
#include<ctype.h>
#include<string.h>
#include<stdlib.h>
#define gc getchar//_unlocked
#define M 1000000007
typedef long long ll;
/************************************************************************/
long long getnum()
{
char ch;
long long num=0;
while( ... | |
Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. Besides, he can take several exams on one day, and in any order.According to the schedule, a studen... | Print a single integer — the minimum possible number of the day when Valera can take the last exam if he takes all the exams so that all the records in his record book go in the order of non-decreasing date. | C | 71bc7c4eb577441f2563e40d95306752 | 8b638931ff9bc17dab1aa9e22e3fa522 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1413709200 | ["3\n5 2\n3 1\n4 2", "3\n6 1\n5 2\n4 3"] | NoteIn the first sample Valera first takes an exam in the second subject on the first day (the teacher writes down the schedule date that is 3). On the next day he takes an exam in the third subject (the teacher writes down the schedule date, 4), then he takes an exam in the first subject (the teacher writes down the m... | PASSED | 1,400 | standard input | 1 second | The first line contains a single positive integer n (1 ≤ n ≤ 5000) — the number of exams Valera will take. Each of the next n lines contains two positive space-separated integers ai and bi (1 ≤ bi < ai ≤ 109) — the date of the exam in the schedule and the early date of passing the i-th exam, correspondingly. | ["2", "6"] | #include<stdio.h>
struct exam{
int later;
int former;
};
int main(){
int n,date,x,y,i,j;
struct exam in[5100];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d %d",&x,&y);
j=i-1;
while(j>=0){
if((x<in[j].later) || (x==in[j].later && y<=in[j].former)){
... | |
Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. Besides, he can take several exams on one day, and in any order.According to the schedule, a studen... | Print a single integer — the minimum possible number of the day when Valera can take the last exam if he takes all the exams so that all the records in his record book go in the order of non-decreasing date. | C | 71bc7c4eb577441f2563e40d95306752 | fad68e74379003b6204e5b052c6ffa3b | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1413709200 | ["3\n5 2\n3 1\n4 2", "3\n6 1\n5 2\n4 3"] | NoteIn the first sample Valera first takes an exam in the second subject on the first day (the teacher writes down the schedule date that is 3). On the next day he takes an exam in the third subject (the teacher writes down the schedule date, 4), then he takes an exam in the first subject (the teacher writes down the m... | PASSED | 1,400 | standard input | 1 second | The first line contains a single positive integer n (1 ≤ n ≤ 5000) — the number of exams Valera will take. Each of the next n lines contains two positive space-separated integers ai and bi (1 ≤ bi < ai ≤ 109) — the date of the exam in the schedule and the early date of passing the i-th exam, correspondingly. | ["2", "6"] | #include <stdio.h>
#include <stdlib.h>
#define MAX_N (5000)
typedef struct {
int a;
int b;
} exam;
int cmp(const void * arg1, const void * arg2) {
const exam * ex1 = (const exam *)arg1;
const exam * ex2 = (const exam *)arg2;
if ( ex1->a != ex2-> a)
return ex1->a - ex2->a;
return ex1->b - ex2->b;
}
... | |
Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. Besides, he can take several exams on one day, and in any order.According to the schedule, a studen... | Print a single integer — the minimum possible number of the day when Valera can take the last exam if he takes all the exams so that all the records in his record book go in the order of non-decreasing date. | C | 71bc7c4eb577441f2563e40d95306752 | 6ed351887f40cec51d841d5291a3e1f9 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1413709200 | ["3\n5 2\n3 1\n4 2", "3\n6 1\n5 2\n4 3"] | NoteIn the first sample Valera first takes an exam in the second subject on the first day (the teacher writes down the schedule date that is 3). On the next day he takes an exam in the third subject (the teacher writes down the schedule date, 4), then he takes an exam in the first subject (the teacher writes down the m... | PASSED | 1,400 | standard input | 1 second | The first line contains a single positive integer n (1 ≤ n ≤ 5000) — the number of exams Valera will take. Each of the next n lines contains two positive space-separated integers ai and bi (1 ≤ bi < ai ≤ 109) — the date of the exam in the schedule and the early date of passing the i-th exam, correspondingly. | ["2", "6"] | #include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
#define min(x,y) (x)<(y)?(x):(y)
typedef struct
{
int u;
int v;
}day;
int compare(day *a, day *b)
{
return (a->u - b->u);
}
int compare2(day *a, day *b)
{
return (a->v - b->v);
}
int main()
{
day a[5001];
int n,i,j,k;
scanf("%d",&n)... | |
Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. Besides, he can take several exams on one day, and in any order.According to the schedule, a studen... | Print a single integer — the minimum possible number of the day when Valera can take the last exam if he takes all the exams so that all the records in his record book go in the order of non-decreasing date. | C | 71bc7c4eb577441f2563e40d95306752 | 451689dccfc937a6593c3a96818ffd0b | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1413709200 | ["3\n5 2\n3 1\n4 2", "3\n6 1\n5 2\n4 3"] | NoteIn the first sample Valera first takes an exam in the second subject on the first day (the teacher writes down the schedule date that is 3). On the next day he takes an exam in the third subject (the teacher writes down the schedule date, 4), then he takes an exam in the first subject (the teacher writes down the m... | PASSED | 1,400 | standard input | 1 second | The first line contains a single positive integer n (1 ≤ n ≤ 5000) — the number of exams Valera will take. Each of the next n lines contains two positive space-separated integers ai and bi (1 ≤ bi < ai ≤ 109) — the date of the exam in the schedule and the early date of passing the i-th exam, correspondingly. | ["2", "6"] | #include<stdio.h>
#include<stdlib.h>
int cmp(const void *a,const void *b)
{
//return *(int*)a-*(int*)b;
int *pa=(int*)a;
int *pb=(int*)b;
if(pa[0]==pb[0])
{
if(pa[1]>pb[1])
return 1;
else return -1;
}
else if(pa[0]>pb[0])
return 1;
else
return -1;
}
int main()
{
int n,m,i,j,k=0,x=-1;
int a[100009... | |
Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. Besides, he can take several exams on one day, and in any order.According to the schedule, a studen... | Print a single integer — the minimum possible number of the day when Valera can take the last exam if he takes all the exams so that all the records in his record book go in the order of non-decreasing date. | C | 71bc7c4eb577441f2563e40d95306752 | cb58e50596c9c157e8a818671cb46547 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1413709200 | ["3\n5 2\n3 1\n4 2", "3\n6 1\n5 2\n4 3"] | NoteIn the first sample Valera first takes an exam in the second subject on the first day (the teacher writes down the schedule date that is 3). On the next day he takes an exam in the third subject (the teacher writes down the schedule date, 4), then he takes an exam in the first subject (the teacher writes down the m... | PASSED | 1,400 | standard input | 1 second | The first line contains a single positive integer n (1 ≤ n ≤ 5000) — the number of exams Valera will take. Each of the next n lines contains two positive space-separated integers ai and bi (1 ≤ bi < ai ≤ 109) — the date of the exam in the schedule and the early date of passing the i-th exam, correspondingly. | ["2", "6"] | #include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
struct stud{
long long f;
long long p;
};
int comp(const void *a, const void *b){
const struct stud *da = (const struct stud*)a;
const struct stud *db = (const struct st... | |
Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. Besides, he can take several exams on one day, and in any order.According to the schedule, a studen... | Print a single integer — the minimum possible number of the day when Valera can take the last exam if he takes all the exams so that all the records in his record book go in the order of non-decreasing date. | C | 71bc7c4eb577441f2563e40d95306752 | 48975bef2a06048af87d1910bf198e5c | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1413709200 | ["3\n5 2\n3 1\n4 2", "3\n6 1\n5 2\n4 3"] | NoteIn the first sample Valera first takes an exam in the second subject on the first day (the teacher writes down the schedule date that is 3). On the next day he takes an exam in the third subject (the teacher writes down the schedule date, 4), then he takes an exam in the first subject (the teacher writes down the m... | PASSED | 1,400 | standard input | 1 second | The first line contains a single positive integer n (1 ≤ n ≤ 5000) — the number of exams Valera will take. Each of the next n lines contains two positive space-separated integers ai and bi (1 ≤ bi < ai ≤ 109) — the date of the exam in the schedule and the early date of passing the i-th exam, correspondingly. | ["2", "6"] | #include<stdio.h>
int main()
{int n;
scanf("%d",&n);
int a[n];
int b[n];
int i;
for(i=0;i<n;i++)
scanf("%d %d",&a[i],&b[i]);
int j;
int temp,temp1;
for(i=0;i<n;i++)
{for(j=0;j<n-1;j++)
{if(a[j]==a[j+1])
{if(b[j]>b[j+1])
{temp=b[j];
b[j]=b[j+1];
b[j+1]=temp;
}}
if(a[j+1]<a[j])
{
temp=a[j];
temp1=b[j];
b[j]=b[j+1];
b[j+1... | |
Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. Besides, he can take several exams on one day, and in any order.According to the schedule, a studen... | Print a single integer — the minimum possible number of the day when Valera can take the last exam if he takes all the exams so that all the records in his record book go in the order of non-decreasing date. | C | 71bc7c4eb577441f2563e40d95306752 | 7dc535cfd326d1ab3772440d1ecdace1 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1413709200 | ["3\n5 2\n3 1\n4 2", "3\n6 1\n5 2\n4 3"] | NoteIn the first sample Valera first takes an exam in the second subject on the first day (the teacher writes down the schedule date that is 3). On the next day he takes an exam in the third subject (the teacher writes down the schedule date, 4), then he takes an exam in the first subject (the teacher writes down the m... | PASSED | 1,400 | standard input | 1 second | The first line contains a single positive integer n (1 ≤ n ≤ 5000) — the number of exams Valera will take. Each of the next n lines contains two positive space-separated integers ai and bi (1 ≤ bi < ai ≤ 109) — the date of the exam in the schedule and the early date of passing the i-th exam, correspondingly. | ["2", "6"] | #include<stdio.h>
long long int min(long long int a[],long long int b[],long long int c[],long long int n)
{
long long int min;
long long int l=-1,i;
min=1000000001;
for(i=0;i<n;i++)
{
if(a[i]==min && c[i]==0){
if(b[i]<b[l]){
min=a[i];
l=i;
... | |
Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. Besides, he can take several exams on one day, and in any order.According to the schedule, a studen... | Print a single integer — the minimum possible number of the day when Valera can take the last exam if he takes all the exams so that all the records in his record book go in the order of non-decreasing date. | C | 71bc7c4eb577441f2563e40d95306752 | d38424cfafff74d9c3209bd9cad0c812 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1413709200 | ["3\n5 2\n3 1\n4 2", "3\n6 1\n5 2\n4 3"] | NoteIn the first sample Valera first takes an exam in the second subject on the first day (the teacher writes down the schedule date that is 3). On the next day he takes an exam in the third subject (the teacher writes down the schedule date, 4), then he takes an exam in the first subject (the teacher writes down the m... | PASSED | 1,400 | standard input | 1 second | The first line contains a single positive integer n (1 ≤ n ≤ 5000) — the number of exams Valera will take. Each of the next n lines contains two positive space-separated integers ai and bi (1 ≤ bi < ai ≤ 109) — the date of the exam in the schedule and the early date of passing the i-th exam, correspondingly. | ["2", "6"] | #include <stdio.h>
void A(int ZA[], int ZB[], int ZC[], int ZD[], int a, int b)
{
int c, d, e, f;
if (a < b) {
c = a + (b - a + 1) / 2;
A(ZA, ZB, ZC, ZD, a, c - 1);
A(ZA, ZB, ZC, ZD, c, b);
d = c - 1;
e = 0;
f = a;
while (a <= d && c <= b) {
if (ZA[a] < ZA[c] || ZA[a] == ZA[c] && ZB[a] < ZB[c]) {
... | |
Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. Besides, he can take several exams on one day, and in any order.According to the schedule, a studen... | Print a single integer — the minimum possible number of the day when Valera can take the last exam if he takes all the exams so that all the records in his record book go in the order of non-decreasing date. | C | 71bc7c4eb577441f2563e40d95306752 | 71e60652b479f51a4ee43dbd342e6e3c | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1413709200 | ["3\n5 2\n3 1\n4 2", "3\n6 1\n5 2\n4 3"] | NoteIn the first sample Valera first takes an exam in the second subject on the first day (the teacher writes down the schedule date that is 3). On the next day he takes an exam in the third subject (the teacher writes down the schedule date, 4), then he takes an exam in the first subject (the teacher writes down the m... | PASSED | 1,400 | standard input | 1 second | The first line contains a single positive integer n (1 ≤ n ≤ 5000) — the number of exams Valera will take. Each of the next n lines contains two positive space-separated integers ai and bi (1 ≤ bi < ai ≤ 109) — the date of the exam in the schedule and the early date of passing the i-th exam, correspondingly. | ["2", "6"] | #include <stdio.h>
void A(int ZA[], int ZB[], int a, int b)
{
int c, d, e, f;
if (a < b) {
c = a + (b - a + 1) / 2;
d = ZA[c];
ZA[c] = ZA[b];
ZA[b] = d;
d = ZB[c];
ZB[c] = ZB[b];
ZB[b] = d;
f = a - 1;
for (e = a; e < b; ++e)
if (ZA[e] < ZA[b] || ZA[e] == ZA[b] && ZB[e] < ZB[b]) {
f += 1;
... | |
Hongcow likes solving puzzles.One day, Hongcow finds two identical puzzle pieces, with the instructions "make a rectangle" next to them. The pieces can be described by an n by m grid of characters, where the character 'X' denotes a part of the puzzle and '.' denotes an empty part of the grid. It is guaranteed that the ... | Output "YES" if it is possible for Hongcow to make a rectangle. Output "NO" otherwise. | C | b395be2597f4cc0478bc45f774fa1c01 | 76e3de9c0b7504a161feb2d2905180a9 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1481992500 | ["2 3\nXXX\nXXX", "2 2\n.X\nXX", "5 5\n.....\n..X..\n.....\n.....\n....."] | NoteFor the first sample, one example of a rectangle we can form is as follows 111222111222For the second sample, it is impossible to put two of those pieces without rotating or flipping to form a rectangle.In the third sample, we can shift the first tile by one to the right, and then compose the following rectangle: .... | PASSED | 1,400 | standard input | 2 seconds | The first line of input will contain two integers n and m (1 ≤ n, m ≤ 500), the dimensions of the puzzle piece. The next n lines will describe the jigsaw piece. Each line will have length m and will consist of characters '.' and 'X' only. 'X' corresponds to a part of the puzzle piece, '.' is an empty space. It is guara... | ["YES", "NO", "YES"] | #include <stdio.h>
int main(void) {
int m,n,flag=1,i,j,m1=-1,m2=-1;
scanf("%d%d",&n,&m);
getchar();
char mat[n][m];
for(i=0;i<n;i++){
for(j=0;j<m;j++)
scanf("%c",&mat[i][j]);
getchar();
}
for(i=0;i<n;i++)
{for(j=0;j<m;j++)
{
i... | |
Hongcow likes solving puzzles.One day, Hongcow finds two identical puzzle pieces, with the instructions "make a rectangle" next to them. The pieces can be described by an n by m grid of characters, where the character 'X' denotes a part of the puzzle and '.' denotes an empty part of the grid. It is guaranteed that the ... | Output "YES" if it is possible for Hongcow to make a rectangle. Output "NO" otherwise. | C | b395be2597f4cc0478bc45f774fa1c01 | 985246e7ff37184fe06167be42e78673 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1481992500 | ["2 3\nXXX\nXXX", "2 2\n.X\nXX", "5 5\n.....\n..X..\n.....\n.....\n....."] | NoteFor the first sample, one example of a rectangle we can form is as follows 111222111222For the second sample, it is impossible to put two of those pieces without rotating or flipping to form a rectangle.In the third sample, we can shift the first tile by one to the right, and then compose the following rectangle: .... | PASSED | 1,400 | standard input | 2 seconds | The first line of input will contain two integers n and m (1 ≤ n, m ≤ 500), the dimensions of the puzzle piece. The next n lines will describe the jigsaw piece. Each line will have length m and will consist of characters '.' and 'X' only. 'X' corresponds to a part of the puzzle piece, '.' is an empty space. It is guara... | ["YES", "NO", "YES"] | #include <stdio.h>
#include <stdlib.h>
int main(void)
{
int m, n, i1 = -1, i2 = -1, j1 = -1, j2 = -1;
scanf("%d%d", &n, &m);
char c[n][m], enter;
scanf("%c", &enter);
for (int i = 0; i < n; ++i){
for (int j = 0; j < m; ++j){
scanf("%c", &c[i][j]);
if (c[i][j] == 'X' ... | |
Hongcow likes solving puzzles.One day, Hongcow finds two identical puzzle pieces, with the instructions "make a rectangle" next to them. The pieces can be described by an n by m grid of characters, where the character 'X' denotes a part of the puzzle and '.' denotes an empty part of the grid. It is guaranteed that the ... | Output "YES" if it is possible for Hongcow to make a rectangle. Output "NO" otherwise. | C | b395be2597f4cc0478bc45f774fa1c01 | 9277a47b6971eb6c6f7b9d53f995caf8 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1481992500 | ["2 3\nXXX\nXXX", "2 2\n.X\nXX", "5 5\n.....\n..X..\n.....\n.....\n....."] | NoteFor the first sample, one example of a rectangle we can form is as follows 111222111222For the second sample, it is impossible to put two of those pieces without rotating or flipping to form a rectangle.In the third sample, we can shift the first tile by one to the right, and then compose the following rectangle: .... | PASSED | 1,400 | standard input | 2 seconds | The first line of input will contain two integers n and m (1 ≤ n, m ≤ 500), the dimensions of the puzzle piece. The next n lines will describe the jigsaw piece. Each line will have length m and will consist of characters '.' and 'X' only. 'X' corresponds to a part of the puzzle piece, '.' is an empty space. It is guara... | ["YES", "NO", "YES"] | #include <stdio.h>
#include <string.h>
int main(void) {
int n = 0, m = 0, i = 0;
int contain = 0, poss = 1;
char init[501] = {0, }, *p = init, *q = 0;
char board[500][501] = {{0, }};
scanf("%d %d", &n, &m);
for (i=0;i<n;i++) {
scanf("%s", board[i]);
}
for (i=0;i<n;i++)... | |
Hongcow likes solving puzzles.One day, Hongcow finds two identical puzzle pieces, with the instructions "make a rectangle" next to them. The pieces can be described by an n by m grid of characters, where the character 'X' denotes a part of the puzzle and '.' denotes an empty part of the grid. It is guaranteed that the ... | Output "YES" if it is possible for Hongcow to make a rectangle. Output "NO" otherwise. | C | b395be2597f4cc0478bc45f774fa1c01 | 16cc59c1795af1eccccf0aa26d269a66 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1481992500 | ["2 3\nXXX\nXXX", "2 2\n.X\nXX", "5 5\n.....\n..X..\n.....\n.....\n....."] | NoteFor the first sample, one example of a rectangle we can form is as follows 111222111222For the second sample, it is impossible to put two of those pieces without rotating or flipping to form a rectangle.In the third sample, we can shift the first tile by one to the right, and then compose the following rectangle: .... | PASSED | 1,400 | standard input | 2 seconds | The first line of input will contain two integers n and m (1 ≤ n, m ≤ 500), the dimensions of the puzzle piece. The next n lines will describe the jigsaw piece. Each line will have length m and will consist of characters '.' and 'X' only. 'X' corresponds to a part of the puzzle piece, '.' is an empty space. It is guara... | ["YES", "NO", "YES"] | #include <stdio.h>
int main(void) {
char matr[500][500];
int n, m, x = 0, i, j, x1 = 0, y = 0, y1 = 0, zvezdocki[2] = {0};
scanf("%d %d", &n ,&m);
for (i = 0; i < n; i++)
scanf("%s\n", matr[i]);
for(i = 0; i < n; i++) {
for(j = 0; j < m; j++)
if (matr[i][j] == 'X')
... | |
Hongcow likes solving puzzles.One day, Hongcow finds two identical puzzle pieces, with the instructions "make a rectangle" next to them. The pieces can be described by an n by m grid of characters, where the character 'X' denotes a part of the puzzle and '.' denotes an empty part of the grid. It is guaranteed that the ... | Output "YES" if it is possible for Hongcow to make a rectangle. Output "NO" otherwise. | C | b395be2597f4cc0478bc45f774fa1c01 | 8cdc2e3d95a0ff2bce4f6106d89cf5ee | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1481992500 | ["2 3\nXXX\nXXX", "2 2\n.X\nXX", "5 5\n.....\n..X..\n.....\n.....\n....."] | NoteFor the first sample, one example of a rectangle we can form is as follows 111222111222For the second sample, it is impossible to put two of those pieces without rotating or flipping to form a rectangle.In the third sample, we can shift the first tile by one to the right, and then compose the following rectangle: .... | PASSED | 1,400 | standard input | 2 seconds | The first line of input will contain two integers n and m (1 ≤ n, m ≤ 500), the dimensions of the puzzle piece. The next n lines will describe the jigsaw piece. Each line will have length m and will consist of characters '.' and 'X' only. 'X' corresponds to a part of the puzzle piece, '.' is an empty space. It is guara... | ["YES", "NO", "YES"] | #include <limits.h>
#include <stdio.h>
int main() {
int i, j, n, m, cnt, imin, jmin, imax, jmax;
static char cc[500][501];
scanf("%d%d", &n, &m);
for (i = 0; i < n; i++)
scanf("%s", cc[i]);
imin = jmin = INT_MAX;
imax = jmax = 0;
cnt = 0;
for (i = 0; i < n; i++)
for (j = 0; j < m; j++)
if (cc[i][j] == ... | |
Hongcow likes solving puzzles.One day, Hongcow finds two identical puzzle pieces, with the instructions "make a rectangle" next to them. The pieces can be described by an n by m grid of characters, where the character 'X' denotes a part of the puzzle and '.' denotes an empty part of the grid. It is guaranteed that the ... | Output "YES" if it is possible for Hongcow to make a rectangle. Output "NO" otherwise. | C | b395be2597f4cc0478bc45f774fa1c01 | 6092fe3914fd10b674582e8a2ba60a60 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1481992500 | ["2 3\nXXX\nXXX", "2 2\n.X\nXX", "5 5\n.....\n..X..\n.....\n.....\n....."] | NoteFor the first sample, one example of a rectangle we can form is as follows 111222111222For the second sample, it is impossible to put two of those pieces without rotating or flipping to form a rectangle.In the third sample, we can shift the first tile by one to the right, and then compose the following rectangle: .... | PASSED | 1,400 | standard input | 2 seconds | The first line of input will contain two integers n and m (1 ≤ n, m ≤ 500), the dimensions of the puzzle piece. The next n lines will describe the jigsaw piece. Each line will have length m and will consist of characters '.' and 'X' only. 'X' corresponds to a part of the puzzle piece, '.' is an empty space. It is guara... | ["YES", "NO", "YES"] | #include <stdio.h>
int main(void) {
char matr[500][500];
int n, m, x = 0, i, j, x1 = 0, y = 0, y1 = 0, sakib[2] = {0};
scanf("%d %d", &n ,&m);
for (i = 0; i < n; i++){
scanf("%s\n", matr[i]);
}
for(i = 0; i < n; i++) {
for(j = 0; j < m; j++)
if (matr[i][j] == 'X')
... | |
Hongcow likes solving puzzles.One day, Hongcow finds two identical puzzle pieces, with the instructions "make a rectangle" next to them. The pieces can be described by an n by m grid of characters, where the character 'X' denotes a part of the puzzle and '.' denotes an empty part of the grid. It is guaranteed that the ... | Output "YES" if it is possible for Hongcow to make a rectangle. Output "NO" otherwise. | C | b395be2597f4cc0478bc45f774fa1c01 | 1bf2536dc07672c5071d15a1679f0ecd | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1481992500 | ["2 3\nXXX\nXXX", "2 2\n.X\nXX", "5 5\n.....\n..X..\n.....\n.....\n....."] | NoteFor the first sample, one example of a rectangle we can form is as follows 111222111222For the second sample, it is impossible to put two of those pieces without rotating or flipping to form a rectangle.In the third sample, we can shift the first tile by one to the right, and then compose the following rectangle: .... | PASSED | 1,400 | standard input | 2 seconds | The first line of input will contain two integers n and m (1 ≤ n, m ≤ 500), the dimensions of the puzzle piece. The next n lines will describe the jigsaw piece. Each line will have length m and will consist of characters '.' and 'X' only. 'X' corresponds to a part of the puzzle piece, '.' is an empty space. It is guara... | ["YES", "NO", "YES"] | #include<stdio.h>
int main(void)
{
int a, a2 = 0, n, m, l = 0, l2;
char c, p;
scanf("%d %d\n", &n, &m);
for (int i = 0; i < n; i++){
p = '.';
l2 = 0;
a = 0;
for (int j = 0; j < m; j++){
c = getchar();
if (c == 'X'){
if (!a){
a = j + 1;
}
if (p == '.' && l2){
printf("NO");
r... | |
Hongcow likes solving puzzles.One day, Hongcow finds two identical puzzle pieces, with the instructions "make a rectangle" next to them. The pieces can be described by an n by m grid of characters, where the character 'X' denotes a part of the puzzle and '.' denotes an empty part of the grid. It is guaranteed that the ... | Output "YES" if it is possible for Hongcow to make a rectangle. Output "NO" otherwise. | C | b395be2597f4cc0478bc45f774fa1c01 | 220c5949273b0563a14a01fb1ec7a70d | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1481992500 | ["2 3\nXXX\nXXX", "2 2\n.X\nXX", "5 5\n.....\n..X..\n.....\n.....\n....."] | NoteFor the first sample, one example of a rectangle we can form is as follows 111222111222For the second sample, it is impossible to put two of those pieces without rotating or flipping to form a rectangle.In the third sample, we can shift the first tile by one to the right, and then compose the following rectangle: .... | PASSED | 1,400 | standard input | 2 seconds | The first line of input will contain two integers n and m (1 ≤ n, m ≤ 500), the dimensions of the puzzle piece. The next n lines will describe the jigsaw piece. Each line will have length m and will consist of characters '.' and 'X' only. 'X' corresponds to a part of the puzzle piece, '.' is an empty space. It is guara... | ["YES", "NO", "YES"] | /* Copyright (C) tjua, Dec. 2016 */
/* Codeforces Round #385 (Div. 2) */
/* Problem B */
/* deal: is input puzzle a rectangle */
#include <stdio.h>
#include <string.h>
#include <assert.h>
#define a10 ".....""....."
#define a50 a10 a10 a10 a10 a10
#define a100 a50 a50
#define a500 a100 a100 a100 a100 a100
int main(... | |
Hongcow likes solving puzzles.One day, Hongcow finds two identical puzzle pieces, with the instructions "make a rectangle" next to them. The pieces can be described by an n by m grid of characters, where the character 'X' denotes a part of the puzzle and '.' denotes an empty part of the grid. It is guaranteed that the ... | Output "YES" if it is possible for Hongcow to make a rectangle. Output "NO" otherwise. | C | b395be2597f4cc0478bc45f774fa1c01 | 71330518695276e918f0291e5a74d40c | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1481992500 | ["2 3\nXXX\nXXX", "2 2\n.X\nXX", "5 5\n.....\n..X..\n.....\n.....\n....."] | NoteFor the first sample, one example of a rectangle we can form is as follows 111222111222For the second sample, it is impossible to put two of those pieces without rotating or flipping to form a rectangle.In the third sample, we can shift the first tile by one to the right, and then compose the following rectangle: .... | PASSED | 1,400 | standard input | 2 seconds | The first line of input will contain two integers n and m (1 ≤ n, m ≤ 500), the dimensions of the puzzle piece. The next n lines will describe the jigsaw piece. Each line will have length m and will consist of characters '.' and 'X' only. 'X' corresponds to a part of the puzzle piece, '.' is an empty space. It is guara... | ["YES", "NO", "YES"] | #include<stdio.h>
int main()
{
int arr[510]={0},count=0,c,p=0;
int i,j,n,m;
char str[510][510];
scanf("%d%d",&n,&m);
for(i=0;i<n;i++)
scanf("%s",str[i]);
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
if(str[i][j]=='X')
{
arr[j]=1;
... | |
Hongcow likes solving puzzles.One day, Hongcow finds two identical puzzle pieces, with the instructions "make a rectangle" next to them. The pieces can be described by an n by m grid of characters, where the character 'X' denotes a part of the puzzle and '.' denotes an empty part of the grid. It is guaranteed that the ... | Output "YES" if it is possible for Hongcow to make a rectangle. Output "NO" otherwise. | C | b395be2597f4cc0478bc45f774fa1c01 | 043fb285ff04191928cc1803abcb390b | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1481992500 | ["2 3\nXXX\nXXX", "2 2\n.X\nXX", "5 5\n.....\n..X..\n.....\n.....\n....."] | NoteFor the first sample, one example of a rectangle we can form is as follows 111222111222For the second sample, it is impossible to put two of those pieces without rotating or flipping to form a rectangle.In the third sample, we can shift the first tile by one to the right, and then compose the following rectangle: .... | PASSED | 1,400 | standard input | 2 seconds | The first line of input will contain two integers n and m (1 ≤ n, m ≤ 500), the dimensions of the puzzle piece. The next n lines will describe the jigsaw piece. Each line will have length m and will consist of characters '.' and 'X' only. 'X' corresponds to a part of the puzzle piece, '.' is an empty space. It is guara... | ["YES", "NO", "YES"] | #include <string.h>
#include <stdio.h>
int main(void) {
int possible = 1;
char puzzle[501][501], line[501] = { 0 };
int n, m, i, j, fo = 0, first;
for (i = 0; i < 500; i++) {
line[i] = 0;
for (j = 0; j < 500; j++) {
puzzle[i][j] = 0;
}
}
scanf("%d %d", &n, &m);
for (i = 0; i < n; i++) {
scanf("%s", ... | |
Hongcow likes solving puzzles.One day, Hongcow finds two identical puzzle pieces, with the instructions "make a rectangle" next to them. The pieces can be described by an n by m grid of characters, where the character 'X' denotes a part of the puzzle and '.' denotes an empty part of the grid. It is guaranteed that the ... | Output "YES" if it is possible for Hongcow to make a rectangle. Output "NO" otherwise. | C | b395be2597f4cc0478bc45f774fa1c01 | 1285ad15d5ee0dca43aed4caae4fe725 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1481992500 | ["2 3\nXXX\nXXX", "2 2\n.X\nXX", "5 5\n.....\n..X..\n.....\n.....\n....."] | NoteFor the first sample, one example of a rectangle we can form is as follows 111222111222For the second sample, it is impossible to put two of those pieces without rotating or flipping to form a rectangle.In the third sample, we can shift the first tile by one to the right, and then compose the following rectangle: .... | PASSED | 1,400 | standard input | 2 seconds | The first line of input will contain two integers n and m (1 ≤ n, m ≤ 500), the dimensions of the puzzle piece. The next n lines will describe the jigsaw piece. Each line will have length m and will consist of characters '.' and 'X' only. 'X' corresponds to a part of the puzzle piece, '.' is an empty space. It is guara... | ["YES", "NO", "YES"] | #include<stdio.h>
int arr[502][502];
int ar[502];
int main()
{
int n,m,i,j,a,ans=0,pass,close,anss=1,k=0;
char s[502];
scanf("%d %d",&n,&m);
i=0;j=0;
for(i=0;i<n;i++)
{
scanf("%s",s);
for(j=0;j<m;j++)
{
if(s[j]=='X')
arr[i][j]=1;
}
}
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
if(arr[i][j]==1... | |
A root tree is a directed acyclic graph that contains one node (root), from which there is exactly one path to any other node.A root tree is binary if each node has at most two outgoing arcs.When a binary tree is painted on the plane, all arcs should be directed from top to bottom. That is, each arc going from u to v m... | If it is impossible to build a binary root tree on the given points, print "-1". Otherwise, print a single real number — the total length of the arcs in the minimum binary tree. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6. | C | 0080bead488b85df3458cc772b27cc17 | e868d898c57b9e4c3080a205bbf9dfb1 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"flows",
"trees"
] | 1362065400 | ["3\n0 0\n1 0\n2 1", "4\n0 0\n1 0\n2 1\n2 0"] | null | PASSED | 2,400 | standard input | 3 seconds | The first line contains a single integer n (2 ≤ n ≤ 400) — the number of nodes in the tree. Then follow n lines, two integers per line: xi, yi (|xi|, |yi| ≤ 103) — coordinates of the nodes. It is guaranteed that all points are distinct. | ["3.650281539872885", "-1"] | /* practice with Dukkha */
#include <float.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#define N 400
#define N_ (1 + N + N + 1)
#define M_ (N + N * (N - 1) / 2 + N)
#define INF DBL_MAX
int next[1 + M_ * 2], hh[1 + M_ * 2];
int ii[M_], jj[M_]; double cost[M_], cost_[M_]; int cc[M_ * 2];
int ao[N_]; dou... | |
Alex decided to go on a touristic trip over the country.For simplicity let's assume that the country has $$$n$$$ cities and $$$m$$$ bidirectional roads connecting them. Alex lives in city $$$s$$$ and initially located in it. To compare different cities Alex assigned each city a score $$$w_i$$$ which is as high as inter... | Output single integer which is the maximum possible sum of scores of visited cities. | C | 824c7f11e6c2997c98741d314cdd1970 | 10751e353deacb02885a7c7a17094807 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"dp",
"greedy",
"graphs",
"dsu",
"dfs and similar",
"trees"
] | 1568822700 | ["5 7\n2 2 8 6 9\n1 2\n1 3\n2 4\n3 2\n4 5\n2 5\n1 5\n2", "10 12\n1 7 1 9 3 3 6 30 1 10\n1 2\n1 3\n3 5\n5 7\n2 3\n5 4\n6 9\n4 6\n3 7\n6 8\n9 4\n9 10\n6"] | null | PASSED | 2,200 | standard input | 2 seconds | First line of input contains two integers $$$n$$$ and $$$m$$$, ($$$1 \le n \le 2 \cdot 10^5$$$, $$$0 \le m \le 2 \cdot 10^5$$$) which are numbers of cities and roads in the country. Second line contains $$$n$$$ integers $$$w_1, w_2, \ldots, w_n$$$ ($$$0 \le w_i \le 10^9$$$) which are scores of all cities. The following... | ["27", "61"] | #include <stdio.h>
typedef unsigned int uint;
typedef unsigned long long ull;
struct uu {
uint first, second;
};
ull w[200000];
uint hd[200000] = {0}, deg[200000] = {0};
struct uu adj[400001];
uint cnt = 0;
static inline void addEdge(uint u, uint v) {
adj[++cnt].first = v; adj[cnt].second = hd[u];
hd[u] = cnt;
... | |
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$... | Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists. | C | cda949a8fb1f158f3c06109a2d33f084 | 421ca998080f2007274dfb473500aa7e | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1555425300 | ["3 6 5 4", "40 40 40 60", "201 101 101 200"] | null | PASSED | 800 | standard input | 1 second | The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$. | ["2 1 3", "20 20 20", "1 100 100"] | #include<stdio.h>
int main()
{
int x1,x2,x3,x4,a,b,c,d;
scanf("%d%d%d%d",&x1,&x2,&x3,&x4);
if(x1>x2 && x1>x3 && x1>x4)
{
a = x1 - x2;
b = x1 - x3;
c = x1 - x4;
printf("%d %d %d\n",c,b,a);
}
else if(x2>x1 && x2>x3 && x2>x4)
{
a = x2 - x1;
b = x2... | |
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$... | Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists. | C | cda949a8fb1f158f3c06109a2d33f084 | 27ff44db4ccefb8a77991e8ae8d02c42 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1555425300 | ["3 6 5 4", "40 40 40 60", "201 101 101 200"] | null | PASSED | 800 | standard input | 1 second | The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$. | ["2 1 3", "20 20 20", "1 100 100"] | #include<stdio.h>
#include<math.h>
int main()
{long long int n,n1,n2,n3,n4;
scanf("%lld\t%lld\t%lld\t%lld\n", &n1,&n2,&n3,&n4)!=EOF;
n=((n1+n2+n3+n4)/3);
if((n-n1)!=0){printf("%lld\t", n-n1);}
if((n-n2)!=0){printf("%lld\t", n-n2);}
if((n-n3)!=0){printf("%lld\t", n-n3);}
if((n-n4)!=0){printf("%lld", n-n4);}return 0;} | |
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$... | Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists. | C | cda949a8fb1f158f3c06109a2d33f084 | 03089d3011b33c719e3f738f4d7364f5 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1555425300 | ["3 6 5 4", "40 40 40 60", "201 101 101 200"] | null | PASSED | 800 | standard input | 1 second | The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$. | ["2 1 3", "20 20 20", "1 100 100"] | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{long long int n,n1,n2,n3,n4,s1,s2,s3,s4;
scanf("%lld\t%lld\t%lld\t%lld\n", &n1,&n2,&n3,&n4)!=EOF;
n=((n1+n2+n3+n4)/3);
s1=abs(n-n1);s2=abs(n-n2);s3=abs(n-n3);s4=(n-n4);
if(s1!=0){printf("%lld\t", s1);}
if(s2!=0){printf("%lld\t", s2);}
if(s3!=0){printf("%... | |
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$... | Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists. | C | cda949a8fb1f158f3c06109a2d33f084 | 46acda3d5ddc6bddd0c99ed91be3bc8c | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1555425300 | ["3 6 5 4", "40 40 40 60", "201 101 101 200"] | null | PASSED | 800 | standard input | 1 second | The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$. | ["2 1 3", "20 20 20", "1 100 100"] | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{long long int n,n1,n2,n3,n4;
scanf("%lld\t%lld\t%lld\t%lld\n", &n1,&n2,&n3,&n4)!=EOF;
n=((n1+n2+n3+n4)/3);
if((n-n1)!=0){printf("%lld\t", n-n1);}
if((n-n2)!=0){printf("%lld\t", n-n2);}
if((n-n3)!=0){printf("%lld\t", n-n3);}
if((n-n4)!=0){printf("%lld", n... | |
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$... | Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists. | C | cda949a8fb1f158f3c06109a2d33f084 | 6136e6eb3d84d4e1056dfaf79a55f6a8 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1555425300 | ["3 6 5 4", "40 40 40 60", "201 101 101 200"] | null | PASSED | 800 | standard input | 1 second | The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$. | ["2 1 3", "20 20 20", "1 100 100"] | #include<stdio.h>
int main()
{
int i,j,temp,a[4];
scanf("%d %d %d %d",&a[0],&a[1],&a[2],&a[3]);
for(i=0;i<4;i++){
for(j=i+1;j<4;j++){
if(a[i]>a[j]){
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
printf("%d\t",a[3]-a[2]... | |
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$... | Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists. | C | cda949a8fb1f158f3c06109a2d33f084 | 0b3dd6f64699893359956ce1adefa6b0 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1555425300 | ["3 6 5 4", "40 40 40 60", "201 101 101 200"] | null | PASSED | 800 | standard input | 1 second | The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$. | ["2 1 3", "20 20 20", "1 100 100"] | #include<stdio.h>
int main()
{
long long int x1,x2,x3,x4,i,c,d;
scanf("%lld %lld %lld %lld",&x1,&x2,&x3,&x4);
c=(x1>x2)?(x1>x3)?x1:x3:(x2>x3)?x2:x3;
d=(c>x4)?c:x4;
if(d!=x1) printf("%lld ",d-x1);
if(d!=x2) printf("%lld ",d-x2);
if(d!=x3) printf("%lld ",d-x3);
if(d... | |
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$... | Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists. | C | cda949a8fb1f158f3c06109a2d33f084 | c911737fd7b560c70688f5ea4c0f46c8 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1555425300 | ["3 6 5 4", "40 40 40 60", "201 101 101 200"] | null | PASSED | 800 | standard input | 1 second | The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$. | ["2 1 3", "20 20 20", "1 100 100"] | #include<stdio.h>
int main()
{
long long int i,j,a[4],b=0,c=0,d=0,temp;
for(i=0;i<4;i++)
scanf("%lld",&a[i]);
for(i=0;i<4;i++){
for(j=0;j<3;j++) //only change
if(a[j+1]>a[j]){
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}
b=a[0]-... | |
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$... | Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists. | C | cda949a8fb1f158f3c06109a2d33f084 | d080f031388a98e38c377592ce5b193c | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1555425300 | ["3 6 5 4", "40 40 40 60", "201 101 101 200"] | null | PASSED | 800 | standard input | 1 second | The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$. | ["2 1 3", "20 20 20", "1 100 100"] | #include<stdio.h>
int main()
{
long long int a,b,c,d,i,j,k,l,x,y,z;
scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
if(a>b && a>c && a>d)
{
i=a,j=b,k=c,l=d;
}
else if(b>a && b>c && b>d)
{
i=b,j=a,k=c,l=d;
}
else if(c>a && c>b && c>d)
{
i=c,j=a,k=b,l=d;
}
else if(d>a && d>b && d>c)
{
i=d,j=... | |
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$... | Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists. | C | cda949a8fb1f158f3c06109a2d33f084 | 7a38f1ac0fae0508d3b96f93770d8737 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1555425300 | ["3 6 5 4", "40 40 40 60", "201 101 101 200"] | null | PASSED | 800 | standard input | 1 second | The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$. | ["2 1 3", "20 20 20", "1 100 100"] | #include <stdio.h>
int main()
{
int a[5],max=0,x,i,j,y,z;
for(i=0;i<4;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<4;i++)
{
for(j=0;j<3;j++)
{
if(a[j]>a[j+1])
{
max=a[j];
a[j]=a[j+1];
... | |
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$... | Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists. | C | cda949a8fb1f158f3c06109a2d33f084 | 1f88598dda83e897bd82e14d8097d6d3 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1555425300 | ["3 6 5 4", "40 40 40 60", "201 101 101 200"] | null | PASSED | 800 | standard input | 1 second | The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$. | ["2 1 3", "20 20 20", "1 100 100"] | #include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
int main()
{
long x[4] = {3, 6, 5, 4};
int i, count;
for(i = 0; i < 4; i++)
scanf(" %ld", &x[i]);
long maxi = x[0];
for(i = 0; i < 4; i++)
if(x[i] >= maxi)
maxi = x[i];
long s = maxi;
for(i = 0; i < 4; i++)
{
x[i] = ... | |
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$... | Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists. | C | cda949a8fb1f158f3c06109a2d33f084 | d973d4a8a7db7c01ed5fd3165968c8a0 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1555425300 | ["3 6 5 4", "40 40 40 60", "201 101 101 200"] | null | PASSED | 800 | standard input | 1 second | The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$. | ["2 1 3", "20 20 20", "1 100 100"] | #include<stdio.h>
#include<stdint.h>
int main()
{
uint32_t sum, i;
uint32_t Arr[100];
for (i = 0; i < 4; i ++)
{
scanf("%d", &Arr[i]);
sum = sum + Arr[i];
}
sum = sum / 3;
for (i = 0; i < 4; i ++)
{
Arr[i + 5] = sum - Arr[i];
if (Arr[i + 5] > 0)
{
printf("%d ", Arr[i + 5]);
}
}
return 0;
} | |
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$... | Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists. | C | cda949a8fb1f158f3c06109a2d33f084 | 72d7008a7796cf1aa7aa42acc5ed25c4 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1555425300 | ["3 6 5 4", "40 40 40 60", "201 101 101 200"] | null | PASSED | 800 | standard input | 1 second | The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$. | ["2 1 3", "20 20 20", "1 100 100"] | #include<stdio.h>
int main()
{
unsigned int sum, i;
unsigned int Arr[100];
for (i = 0; i < 4; i ++)
{
scanf("%d", &Arr[i]);
sum = sum + Arr[i];
}
sum = sum / 3;
for (i = 0; i < 4; i ++)
{
Arr[i + 5] = sum - Arr[i];
if (Arr[i + 5] > 0)
{
printf("%d ", Arr[i + 5]);
}
}
return 0;
} | |
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$... | Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists. | C | cda949a8fb1f158f3c06109a2d33f084 | d42b675a3502ab6853a659fc22702767 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1555425300 | ["3 6 5 4", "40 40 40 60", "201 101 101 200"] | null | PASSED | 800 | standard input | 1 second | The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$. | ["2 1 3", "20 20 20", "1 100 100"] | #include<stdio.h>
int main()
{
int x1,x2,x3,x4,A[4],max,i,a,b,c;
scanf("%d %d %d %d",&x1,&x2,&x3,&x4);
A[0]=x1;
A[1]=x2;
A[2]=x3;
A[3]=x4;
max=A[0];
for(i=1; i<4; i++) {
if(A[i]>max) {
max=A[i];
}
}
if(max==A[0]) {
a=max-A[1];
b=m... | |
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$... | Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists. | C | cda949a8fb1f158f3c06109a2d33f084 | dce9e342bfd8eeacdd67e51bdec83a46 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1555425300 | ["3 6 5 4", "40 40 40 60", "201 101 101 200"] | null | PASSED | 800 | standard input | 1 second | The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$. | ["2 1 3", "20 20 20", "1 100 100"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int q[4];
int n=1,k=0;
for(int i=0;i<4;++i)
{
scanf("%d",&q[i]);
if (n<q[i])
{
n=q[i];
k=i;
}
}
for (int i;i<4;++i)
{
if(i-k!=0)
printf("%d ",n-q[i]);
}
//... | |
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$... | Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists. | C | cda949a8fb1f158f3c06109a2d33f084 | cea04faa971de1996ec839c8d69ced45 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1555425300 | ["3 6 5 4", "40 40 40 60", "201 101 101 200"] | null | PASSED | 800 | standard input | 1 second | The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$. | ["2 1 3", "20 20 20", "1 100 100"] | #include<stdio.h>
int main()
{
int x[4], i, j, temp;
for(i = 0; i < 4; i++)
{
scanf("%d", &x[i]);
}
for(i = 0; i < 3; i++)
{
for(j = 0; j < 3; j++)
{
if(x[j] < x[j + 1])
{
temp = x[j];
x[j] = x[j + 1];
... | |
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$... | Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists. | C | cda949a8fb1f158f3c06109a2d33f084 | 4e5155f9ee01c67ae932cdcb75596978 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1555425300 | ["3 6 5 4", "40 40 40 60", "201 101 101 200"] | null | PASSED | 800 | standard input | 1 second | The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$. | ["2 1 3", "20 20 20", "1 100 100"] | #include<stdio.h>
int main()
{
long long int w,x,y,z,s,m,n,o,p,a,t,b,c;
scanf("%lld %lld %lld %lld", &w,&x,&y,&z);
o=w>x?w:x;
p=o>y?o:y;
s=p>z?p:z;
if(s == w){
w = x;
x = y;
y = z;
}
else if(s == x){
w = w;
x = y;
y = z;
}
else if(... | |
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$... | Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists. | C | cda949a8fb1f158f3c06109a2d33f084 | 76e62db4024213593fae58e86eaebe68 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1555425300 | ["3 6 5 4", "40 40 40 60", "201 101 101 200"] | null | PASSED | 800 | standard input | 1 second | The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$. | ["2 1 3", "20 20 20", "1 100 100"] | #include <stdio.h>
int main()
{
int a,b,c,d,l,m,n;
scanf("%d %d %d %d",&a,&b,&c,&d);
if(a>=b&&a>=c&&a>=d)
{
l=a-b;
m=a-c;
n=a-d;
printf("%d %d %d",l,m,n);
}
else if(b>=a&&b>=c&&b>=d)
{
l=b-a;
m=b-c;
n=b-d;
printf("%d %d %d",l,m... | |
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$... | Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists. | C | cda949a8fb1f158f3c06109a2d33f084 | 9d213f0d5222002df3da925b798bce6f | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1555425300 | ["3 6 5 4", "40 40 40 60", "201 101 101 200"] | null | PASSED | 800 | standard input | 1 second | The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$. | ["2 1 3", "20 20 20", "1 100 100"] | #include <stdio.h>
int main()
{
long long int X[5] = {0}, ABC, j, i;
scanf("%lld%lld%lld%lld", &X[1], &X[2], &X[3], &X[4]);
ABC = X[1];
j = 1;
for(i=2;i<=4;i++)
if(X[i] > ABC)
{
ABC = X[i];
j = i;
}
for(i=1;i<=4;i++)
{
if(i != j)
... | |
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$... | Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists. | C | cda949a8fb1f158f3c06109a2d33f084 | d8be6df05f5af9c30271f7e1c3f9c0ee | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1555425300 | ["3 6 5 4", "40 40 40 60", "201 101 101 200"] | null | PASSED | 800 | standard input | 1 second | The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$. | ["2 1 3", "20 20 20", "1 100 100"] | #include <stdio.h>
#include <math.h>
int main()
{
unsigned long int a[4],sum;
int i;
sum=0;
for(i=0;i<4;i=i+1)
{
scanf("%lu",&a[i]);
sum=sum+a[i];
}
sum=(sum)/3;
for(i=0;i<4;i=i+1)
{
unsigned long int diff;
diff=sum-a[i];
if(diff!=0)
... | |
Polycarp has guessed three positive integers $$$a$$$, $$$b$$$ and $$$c$$$. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: $$$a+b$$$, $$... | Print such positive integers $$$a$$$, $$$b$$$ and $$$c$$$ that four numbers written on a board are values $$$a+b$$$, $$$a+c$$$, $$$b+c$$$ and $$$a+b+c$$$ written in some order. Print $$$a$$$, $$$b$$$ and $$$c$$$ in any order. If there are several answers, you can print any. It is guaranteed that the answer exists. | C | cda949a8fb1f158f3c06109a2d33f084 | 9dc90d5cb83756079338b99a800e02db | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"math"
] | 1555425300 | ["3 6 5 4", "40 40 40 60", "201 101 101 200"] | null | PASSED | 800 | standard input | 1 second | The only line of the input contains four positive integers $$$x_1, x_2, x_3, x_4$$$ ($$$2 \le x_i \le 10^9$$$) — numbers written on a board in random order. It is guaranteed that the answer exists for the given number $$$x_1, x_2, x_3, x_4$$$. | ["2 1 3", "20 20 20", "1 100 100"] | #include <stdio.h>
int main()
{
long long q,w,e,r,t;
scanf("%lld %lld %lld %lld",&q,&w,&e,&r);
t=(q+w+e+r)/3;
if(t-q==0)
{
printf("%lld %lld %lld",q-w,q-e,q-r);
}
if(t-w==0)
{
printf("%lld %lld %lld",w-e,w-r,w-q);
}
if(t-e==0)
{
printf("%lld %lld %lld"... | |
You play a computer game. Your character stands on some level of a multilevel ice cave. In order to move on forward, you need to descend one level lower and the only way to do this is to fall through the ice.The level of the cave where you are is a rectangular square grid of n rows and m columns. Each cell consists eit... | If you can reach the destination, print 'YES', otherwise print 'NO'. | C | afac59c927522fb223f59c36184229e2 | 526262fb00f3eb094589173c3fbb3017 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"dfs and similar"
] | 1430411400 | ["4 6\nX...XX\n...XX.\n.X..X.\n......\n1 6\n2 2", "5 4\n.X..\n...X\nX.X.\n....\n.XX.\n5 3\n1 1", "4 7\n..X.XX.\n.XX..X.\nX...X..\nX......\n2 2\n1 6"] | NoteIn the first sample test one possible path is:After the first visit of cell (2, 2) the ice on it cracks and when you step there for the second time, your character falls through the ice as intended. | PASSED | 2,000 | standard input | 2 seconds | The first line contains two integers, n and m (1 ≤ n, m ≤ 500) — the number of rows and columns in the cave description. Each of the next n lines describes the initial state of the level of the cave, each line consists of m characters "." (that is, intact ice) and "X" (cracked ice). The next line contains two integers,... | ["YES", "NO", "YES"] | #include <stdio.h>
int R,C;
char a[502][502];
int rr[4]={1,0,-1,0},cc[4]={0,1,0,-1};
int go(int r,int c) {
if (r==R&&c==C&&a[r][c]=='X') return 1;
if (a[r][c]!='.') return 0;
a[r][c]='X';
int i;
for (i=0;i<4;i++)
if (go(r+rr[i],c+cc[i])) return 1;
return 0;
}
int main() {
int n,m;
scanf("%d %d\n",&n,&m);
... | |
You play a computer game. Your character stands on some level of a multilevel ice cave. In order to move on forward, you need to descend one level lower and the only way to do this is to fall through the ice.The level of the cave where you are is a rectangular square grid of n rows and m columns. Each cell consists eit... | If you can reach the destination, print 'YES', otherwise print 'NO'. | C | afac59c927522fb223f59c36184229e2 | 3407c4ca67aa29ab54227d3330939514 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"dfs and similar"
] | 1430411400 | ["4 6\nX...XX\n...XX.\n.X..X.\n......\n1 6\n2 2", "5 4\n.X..\n...X\nX.X.\n....\n.XX.\n5 3\n1 1", "4 7\n..X.XX.\n.XX..X.\nX...X..\nX......\n2 2\n1 6"] | NoteIn the first sample test one possible path is:After the first visit of cell (2, 2) the ice on it cracks and when you step there for the second time, your character falls through the ice as intended. | PASSED | 2,000 | standard input | 2 seconds | The first line contains two integers, n and m (1 ≤ n, m ≤ 500) — the number of rows and columns in the cave description. Each of the next n lines describes the initial state of the level of the cave, each line consists of m characters "." (that is, intact ice) and "X" (cracked ice). The next line contains two integers,... | ["YES", "NO", "YES"] | #define _CRT_SECURE_NO_DEPRECATE
#include <stdio.h>
char map[1001][1001];
int vi[1001][1001];
int row, col;
int sx, sy, dx, dy;
void init()
{
int i,j,con=0;
for (i = 0; i < row; i++){
for (j = 0; j < col; j++){
vi[i][j] = 0;
}
}
}
struct cell{
int x;
int y;
int depth;
};
typedef struct cell cell;
cel... | |
You play a computer game. Your character stands on some level of a multilevel ice cave. In order to move on forward, you need to descend one level lower and the only way to do this is to fall through the ice.The level of the cave where you are is a rectangular square grid of n rows and m columns. Each cell consists eit... | If you can reach the destination, print 'YES', otherwise print 'NO'. | C | afac59c927522fb223f59c36184229e2 | f8b774b756624b060d5187e929268662 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"dfs and similar"
] | 1430411400 | ["4 6\nX...XX\n...XX.\n.X..X.\n......\n1 6\n2 2", "5 4\n.X..\n...X\nX.X.\n....\n.XX.\n5 3\n1 1", "4 7\n..X.XX.\n.XX..X.\nX...X..\nX......\n2 2\n1 6"] | NoteIn the first sample test one possible path is:After the first visit of cell (2, 2) the ice on it cracks and when you step there for the second time, your character falls through the ice as intended. | PASSED | 2,000 | standard input | 2 seconds | The first line contains two integers, n and m (1 ≤ n, m ≤ 500) — the number of rows and columns in the cave description. Each of the next n lines describes the initial state of the level of the cave, each line consists of m characters "." (that is, intact ice) and "X" (cracked ice). The next line contains two integers,... | ["YES", "NO", "YES"] | #include <stdio.h>
char A[550][550];
int m,n,ax,ay,ex,ey,flag;
void readin()
{
int i,j;
scanf("%d %d",&n,&m);
for(i=1;i<=n;i++)
for(j=1;j<=m;j++)
scanf(" %c",&A[i][j]);
scanf("%d %d",&ax,&ay);
scanf("%d %d",&ex,&ey);
}
void f(int x,int y)
{
if(flag==1)
return;
if(x==ex && y==ey && A[x][y]=='X')
{
print... | |
You play a computer game. Your character stands on some level of a multilevel ice cave. In order to move on forward, you need to descend one level lower and the only way to do this is to fall through the ice.The level of the cave where you are is a rectangular square grid of n rows and m columns. Each cell consists eit... | If you can reach the destination, print 'YES', otherwise print 'NO'. | C | afac59c927522fb223f59c36184229e2 | 039f2dc7854d034f1ea69f2c76ad9539 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"dfs and similar"
] | 1430411400 | ["4 6\nX...XX\n...XX.\n.X..X.\n......\n1 6\n2 2", "5 4\n.X..\n...X\nX.X.\n....\n.XX.\n5 3\n1 1", "4 7\n..X.XX.\n.XX..X.\nX...X..\nX......\n2 2\n1 6"] | NoteIn the first sample test one possible path is:After the first visit of cell (2, 2) the ice on it cracks and when you step there for the second time, your character falls through the ice as intended. | PASSED | 2,000 | standard input | 2 seconds | The first line contains two integers, n and m (1 ≤ n, m ≤ 500) — the number of rows and columns in the cave description. Each of the next n lines describes the initial state of the level of the cave, each line consists of m characters "." (that is, intact ice) and "X" (cracked ice). The next line contains two integers,... | ["YES", "NO", "YES"] | #include<stdio.h>
#include<malloc.h>
char a[501][501];
int **b;
int n,m,x,y;
int flag=1;
void find(int **p,int i,int j)
{
//printf("%d %d\n",i,j);
if(i==x&&j==y)
{flag=0;
return;
}
int **q;
q=p;
if(j+1<=m&&(p[i][j+1]==1||(i==x&&j+1==y)))
{
q[i][j+1]=0;
find(q,i,j+1);
}
//printf("hi1\n");
q=p;
if(j-1>0&&(p[i][j-1]==... | |
You play a computer game. Your character stands on some level of a multilevel ice cave. In order to move on forward, you need to descend one level lower and the only way to do this is to fall through the ice.The level of the cave where you are is a rectangular square grid of n rows and m columns. Each cell consists eit... | If you can reach the destination, print 'YES', otherwise print 'NO'. | C | afac59c927522fb223f59c36184229e2 | 4e8e7ba1d046af91f9f4986f184ffde0 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"dfs and similar"
] | 1430411400 | ["4 6\nX...XX\n...XX.\n.X..X.\n......\n1 6\n2 2", "5 4\n.X..\n...X\nX.X.\n....\n.XX.\n5 3\n1 1", "4 7\n..X.XX.\n.XX..X.\nX...X..\nX......\n2 2\n1 6"] | NoteIn the first sample test one possible path is:After the first visit of cell (2, 2) the ice on it cracks and when you step there for the second time, your character falls through the ice as intended. | PASSED | 2,000 | standard input | 2 seconds | The first line contains two integers, n and m (1 ≤ n, m ≤ 500) — the number of rows and columns in the cave description. Each of the next n lines describes the initial state of the level of the cave, each line consists of m characters "." (that is, intact ice) and "X" (cracked ice). The next line contains two integers,... | ["YES", "NO", "YES"] | #include <stdio.h>
long long int x,y,i,j,bx,by,cx,cy,flag;
char A[505][505];
void f(int a,int b)
{
if (flag==1)
return;
if(a>x || b>y || a<1 || b<1)
return ;
if(a==cx && b==cy && A[a][b]=='X')
{
printf("YES");
flag=1;
return;
}
if(A[a][b]=='X')
return;
A[a][b]='X';
f(a+1,b);
f(a-1,b);
f(a,b+1);
f... | |
You play a computer game. Your character stands on some level of a multilevel ice cave. In order to move on forward, you need to descend one level lower and the only way to do this is to fall through the ice.The level of the cave where you are is a rectangular square grid of n rows and m columns. Each cell consists eit... | If you can reach the destination, print 'YES', otherwise print 'NO'. | C | afac59c927522fb223f59c36184229e2 | 207185ac1e4585094b1aac2d687faf83 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"dfs and similar"
] | 1430411400 | ["4 6\nX...XX\n...XX.\n.X..X.\n......\n1 6\n2 2", "5 4\n.X..\n...X\nX.X.\n....\n.XX.\n5 3\n1 1", "4 7\n..X.XX.\n.XX..X.\nX...X..\nX......\n2 2\n1 6"] | NoteIn the first sample test one possible path is:After the first visit of cell (2, 2) the ice on it cracks and when you step there for the second time, your character falls through the ice as intended. | PASSED | 2,000 | standard input | 2 seconds | The first line contains two integers, n and m (1 ≤ n, m ≤ 500) — the number of rows and columns in the cave description. Each of the next n lines describes the initial state of the level of the cave, each line consists of m characters "." (that is, intact ice) and "X" (cracked ice). The next line contains two integers,... | ["YES", "NO", "YES"] | #include <stdio.h>
int x1,x2,i,j,a1,a2,y10,y2,flag=0,k;
char A[1000][1000];
void fileread()
{
scanf("%d %d",&x1,&x2);
for (i = 1; i <=x1 ; i++)
{
for (j = 1; j <=x2 ; j++)
{
scanf(" %c",&A[i][j]);
}
}
scanf("%d %d",&a1,&a2);
scanf("%d %d",&y10,&y2);
A[... | |
You play a computer game. Your character stands on some level of a multilevel ice cave. In order to move on forward, you need to descend one level lower and the only way to do this is to fall through the ice.The level of the cave where you are is a rectangular square grid of n rows and m columns. Each cell consists eit... | If you can reach the destination, print 'YES', otherwise print 'NO'. | C | afac59c927522fb223f59c36184229e2 | 83c5aa6dd3c08097e17be46de7d6e323 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"dfs and similar"
] | 1430411400 | ["4 6\nX...XX\n...XX.\n.X..X.\n......\n1 6\n2 2", "5 4\n.X..\n...X\nX.X.\n....\n.XX.\n5 3\n1 1", "4 7\n..X.XX.\n.XX..X.\nX...X..\nX......\n2 2\n1 6"] | NoteIn the first sample test one possible path is:After the first visit of cell (2, 2) the ice on it cracks and when you step there for the second time, your character falls through the ice as intended. | PASSED | 2,000 | standard input | 2 seconds | The first line contains two integers, n and m (1 ≤ n, m ≤ 500) — the number of rows and columns in the cave description. Each of the next n lines describes the initial state of the level of the cave, each line consists of m characters "." (that is, intact ice) and "X" (cracked ice). The next line contains two integers,... | ["YES", "NO", "YES"] | #include <stdio.h>
#include <string.h>
int N, M;
char Map[500][501];
char Visit[500][501];
int Queue[250000][2];
int step[4][2] = {{ -1, 0}, {1, 0}, {0, -1}, {0, 1}};
int BFS(int x, int y, int tx, int ty)
{
int Head, Tail, i;
Head = 0;
Tail = 1;
Queue[Head][0] = x;
Queue[Head][1] = y;
memset(&... | |
You play a computer game. Your character stands on some level of a multilevel ice cave. In order to move on forward, you need to descend one level lower and the only way to do this is to fall through the ice.The level of the cave where you are is a rectangular square grid of n rows and m columns. Each cell consists eit... | If you can reach the destination, print 'YES', otherwise print 'NO'. | C | afac59c927522fb223f59c36184229e2 | 7cd8d51e583bebb791b628563e6a5399 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"dfs and similar"
] | 1430411400 | ["4 6\nX...XX\n...XX.\n.X..X.\n......\n1 6\n2 2", "5 4\n.X..\n...X\nX.X.\n....\n.XX.\n5 3\n1 1", "4 7\n..X.XX.\n.XX..X.\nX...X..\nX......\n2 2\n1 6"] | NoteIn the first sample test one possible path is:After the first visit of cell (2, 2) the ice on it cracks and when you step there for the second time, your character falls through the ice as intended. | PASSED | 2,000 | standard input | 2 seconds | The first line contains two integers, n and m (1 ≤ n, m ≤ 500) — the number of rows and columns in the cave description. Each of the next n lines describes the initial state of the level of the cave, each line consists of m characters "." (that is, intact ice) and "X" (cracked ice). The next line contains two integers,... | ["YES", "NO", "YES"] | #include<stdio.h>
int fx,fy,ans=0,check=0;
int n,m;
int flag[505][505]={0};
void dfs(int x,int y,int g)
{
int i,j;
/*printf("****\n");
printf("%d %d\n",x,y);
for(i=1;i<=n;i++)
{
printf("\n");
for(j=1;j<=m;j++)
printf("%d ",flag[i][j]);
}
printf("\n*****\n");*/
if(fx==x && fy==y && g==0)
{
ans=1;
i... | |
You play a computer game. Your character stands on some level of a multilevel ice cave. In order to move on forward, you need to descend one level lower and the only way to do this is to fall through the ice.The level of the cave where you are is a rectangular square grid of n rows and m columns. Each cell consists eit... | If you can reach the destination, print 'YES', otherwise print 'NO'. | C | afac59c927522fb223f59c36184229e2 | a1f86b9dfd03c55b6688ceabd609a2f8 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"dfs and similar"
] | 1430411400 | ["4 6\nX...XX\n...XX.\n.X..X.\n......\n1 6\n2 2", "5 4\n.X..\n...X\nX.X.\n....\n.XX.\n5 3\n1 1", "4 7\n..X.XX.\n.XX..X.\nX...X..\nX......\n2 2\n1 6"] | NoteIn the first sample test one possible path is:After the first visit of cell (2, 2) the ice on it cracks and when you step there for the second time, your character falls through the ice as intended. | PASSED | 2,000 | standard input | 2 seconds | The first line contains two integers, n and m (1 ≤ n, m ≤ 500) — the number of rows and columns in the cave description. Each of the next n lines describes the initial state of the level of the cave, each line consists of m characters "." (that is, intact ice) and "X" (cracked ice). The next line contains two integers,... | ["YES", "NO", "YES"] | #include<stdio.h>
int state=0,vi[501][501],r,c,r2,c2;
void func(int n,int m)
{
// printf("%d %d\n",n,m);
if(n+1<r && state==0)
{
if(n+1==r2 && m==c2 && vi[n+1][m]==1)
state=1;
if(vi[n+1][m]==0)
{
vi[n+1][m]=1;
func(n+1,m);
}
}
if(m+1<c && state==0)
{
if(n==r2 && m+1==c2 && vi[n][m+1]==1)
sta... | |
You play a computer game. Your character stands on some level of a multilevel ice cave. In order to move on forward, you need to descend one level lower and the only way to do this is to fall through the ice.The level of the cave where you are is a rectangular square grid of n rows and m columns. Each cell consists eit... | If you can reach the destination, print 'YES', otherwise print 'NO'. | C | afac59c927522fb223f59c36184229e2 | bf8be8f83a5bd98f0294849424457200 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"dfs and similar"
] | 1430411400 | ["4 6\nX...XX\n...XX.\n.X..X.\n......\n1 6\n2 2", "5 4\n.X..\n...X\nX.X.\n....\n.XX.\n5 3\n1 1", "4 7\n..X.XX.\n.XX..X.\nX...X..\nX......\n2 2\n1 6"] | NoteIn the first sample test one possible path is:After the first visit of cell (2, 2) the ice on it cracks and when you step there for the second time, your character falls through the ice as intended. | PASSED | 2,000 | standard input | 2 seconds | The first line contains two integers, n and m (1 ≤ n, m ≤ 500) — the number of rows and columns in the cave description. Each of the next n lines describes the initial state of the level of the cave, each line consists of m characters "." (that is, intact ice) and "X" (cracked ice). The next line contains two integers,... | ["YES", "NO", "YES"] | #include<stdio.h>
char s[502][502];
int r,c,x,y,a[]={1,0,-1,0},b[]={0,1,0,-1};
int meth(int r,int c)
{
if(r==x && c==y && s[r][c]=='X')
return 1;
if(s[r][c]!='.')
return 0;
s[r][c]='X';
int i;
for(i=0;i<4;++i)
if(meth(r+a[i],c+b[i]))
return 1;
return 0;
}
int ... | |
You play a computer game. Your character stands on some level of a multilevel ice cave. In order to move on forward, you need to descend one level lower and the only way to do this is to fall through the ice.The level of the cave where you are is a rectangular square grid of n rows and m columns. Each cell consists eit... | If you can reach the destination, print 'YES', otherwise print 'NO'. | C | afac59c927522fb223f59c36184229e2 | a6b5e4bf90408d7339bcf78178af9902 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"dfs and similar"
] | 1430411400 | ["4 6\nX...XX\n...XX.\n.X..X.\n......\n1 6\n2 2", "5 4\n.X..\n...X\nX.X.\n....\n.XX.\n5 3\n1 1", "4 7\n..X.XX.\n.XX..X.\nX...X..\nX......\n2 2\n1 6"] | NoteIn the first sample test one possible path is:After the first visit of cell (2, 2) the ice on it cracks and when you step there for the second time, your character falls through the ice as intended. | PASSED | 2,000 | standard input | 2 seconds | The first line contains two integers, n and m (1 ≤ n, m ≤ 500) — the number of rows and columns in the cave description. Each of the next n lines describes the initial state of the level of the cave, each line consists of m characters "." (that is, intact ice) and "X" (cracked ice). The next line contains two integers,... | ["YES", "NO", "YES"] | #include<stdio.h>
#include<stdlib.h>
int i,j,k,s,n,m,hash[1000][1000],iX,iY,eX,eY;
char c;
void dfs(int x, int y) {
if(hash[x][y] >= 3 && x == eX && y == eY) { puts("YES"); exit(0); }
if(hash[x][y] >= 3 || x < 0 || x >= n || y < 0 || y >= m) return ;
hash[x][y]++;
dfs(x,y+1);
dfs(x,y-1);
dfs(x+1,y);
dfs(x-1,y)... | |
You play a computer game. Your character stands on some level of a multilevel ice cave. In order to move on forward, you need to descend one level lower and the only way to do this is to fall through the ice.The level of the cave where you are is a rectangular square grid of n rows and m columns. Each cell consists eit... | If you can reach the destination, print 'YES', otherwise print 'NO'. | C | afac59c927522fb223f59c36184229e2 | 827d37faf12f65d6caba24b191993f3e | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"dfs and similar"
] | 1430411400 | ["4 6\nX...XX\n...XX.\n.X..X.\n......\n1 6\n2 2", "5 4\n.X..\n...X\nX.X.\n....\n.XX.\n5 3\n1 1", "4 7\n..X.XX.\n.XX..X.\nX...X..\nX......\n2 2\n1 6"] | NoteIn the first sample test one possible path is:After the first visit of cell (2, 2) the ice on it cracks and when you step there for the second time, your character falls through the ice as intended. | PASSED | 2,000 | standard input | 2 seconds | The first line contains two integers, n and m (1 ≤ n, m ≤ 500) — the number of rows and columns in the cave description. Each of the next n lines describes the initial state of the level of the cave, each line consists of m characters "." (that is, intact ice) and "X" (cracked ice). The next line contains two integers,... | ["YES", "NO", "YES"] | #include<stdlib.h>
#include<string.h>
#include<stdio.h>
#include<ctype.h>
#include<time.h>
#include<math.h>
#define Max(a,b) (((a) > (b)) ? (a) : (b))
#define Min(a,b) (((a) < (b)) ? (a) : (b))
#define FOR(i,a,b) for(i = a; i <= b; i++)
#define ROF(i,a,b) for(i = a; i >= b; i--)
#define SWAP(a,b) {t = a; ... | |
You play a computer game. Your character stands on some level of a multilevel ice cave. In order to move on forward, you need to descend one level lower and the only way to do this is to fall through the ice.The level of the cave where you are is a rectangular square grid of n rows and m columns. Each cell consists eit... | If you can reach the destination, print 'YES', otherwise print 'NO'. | C | afac59c927522fb223f59c36184229e2 | b06013d6ed5e6d75439c334b963a1767 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"dfs and similar"
] | 1430411400 | ["4 6\nX...XX\n...XX.\n.X..X.\n......\n1 6\n2 2", "5 4\n.X..\n...X\nX.X.\n....\n.XX.\n5 3\n1 1", "4 7\n..X.XX.\n.XX..X.\nX...X..\nX......\n2 2\n1 6"] | NoteIn the first sample test one possible path is:After the first visit of cell (2, 2) the ice on it cracks and when you step there for the second time, your character falls through the ice as intended. | PASSED | 2,000 | standard input | 2 seconds | The first line contains two integers, n and m (1 ≤ n, m ≤ 500) — the number of rows and columns in the cave description. Each of the next n lines describes the initial state of the level of the cave, each line consists of m characters "." (that is, intact ice) and "X" (cracked ice). The next line contains two integers,... | ["YES", "NO", "YES"] | #include<stdio.h>
char maze[501][501];
int visited[501][501]={0};
int destrow,destcol;
int main()
{
int n,m,push[250000][2];
scanf("%d%d",&n,&m);
int i,j;
for(i=0;i<n;i++)
scanf("%s",maze[i]);
int row,column;
scanf("%d%d%d%d",&row,&column,&destrow,&destcol);
destrow--,destcol--,row--,column--;
int count=0;
... | |
You play a computer game. Your character stands on some level of a multilevel ice cave. In order to move on forward, you need to descend one level lower and the only way to do this is to fall through the ice.The level of the cave where you are is a rectangular square grid of n rows and m columns. Each cell consists eit... | If you can reach the destination, print 'YES', otherwise print 'NO'. | C | afac59c927522fb223f59c36184229e2 | 2222c738af008f8f092d5f0da023a5d3 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"dfs and similar"
] | 1430411400 | ["4 6\nX...XX\n...XX.\n.X..X.\n......\n1 6\n2 2", "5 4\n.X..\n...X\nX.X.\n....\n.XX.\n5 3\n1 1", "4 7\n..X.XX.\n.XX..X.\nX...X..\nX......\n2 2\n1 6"] | NoteIn the first sample test one possible path is:After the first visit of cell (2, 2) the ice on it cracks and when you step there for the second time, your character falls through the ice as intended. | PASSED | 2,000 | standard input | 2 seconds | The first line contains two integers, n and m (1 ≤ n, m ≤ 500) — the number of rows and columns in the cave description. Each of the next n lines describes the initial state of the level of the cave, each line consists of m characters "." (that is, intact ice) and "X" (cracked ice). The next line contains two integers,... | ["YES", "NO", "YES"] | #include<stdio.h>
#include<stdlib.h>
#define intact 0
#define waiting 1
#define cracked 3
#define visited 2
struct list{
int row;
int col;
struct list *next;
};
typedef struct list node;
void pushQ(node **head, int r, int c)
{
node *curr, *tmp;
tmp = (node *)malloc(sizeof(node... | |
You play a computer game. Your character stands on some level of a multilevel ice cave. In order to move on forward, you need to descend one level lower and the only way to do this is to fall through the ice.The level of the cave where you are is a rectangular square grid of n rows and m columns. Each cell consists eit... | If you can reach the destination, print 'YES', otherwise print 'NO'. | C | afac59c927522fb223f59c36184229e2 | 7984d14ccf05b9e67cdf1018b4201264 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"dfs and similar"
] | 1430411400 | ["4 6\nX...XX\n...XX.\n.X..X.\n......\n1 6\n2 2", "5 4\n.X..\n...X\nX.X.\n....\n.XX.\n5 3\n1 1", "4 7\n..X.XX.\n.XX..X.\nX...X..\nX......\n2 2\n1 6"] | NoteIn the first sample test one possible path is:After the first visit of cell (2, 2) the ice on it cracks and when you step there for the second time, your character falls through the ice as intended. | PASSED | 2,000 | standard input | 2 seconds | The first line contains two integers, n and m (1 ≤ n, m ≤ 500) — the number of rows and columns in the cave description. Each of the next n lines describes the initial state of the level of the cave, each line consists of m characters "." (that is, intact ice) and "X" (cracked ice). The next line contains two integers,... | ["YES", "NO", "YES"] | #include<stdio.h>
int state=0,vi[501][501],r,c,r2,c2;
void func(int n,int m)
{
// printf("%d %d\n",n,m);
if(n+1<r && state==0)
{
if(n+1==r2 && m==c2 && vi[n+1][m]==1)
state=1;
if(vi[n+1][m]==0)
{
vi[n+1][m]=1;
func(n+1,m);
}
}
if(m+1<c && state==0)
{
if(n==r2 && m+1==c2 && vi[n][m+1]==1)
sta... | |
You play a computer game. Your character stands on some level of a multilevel ice cave. In order to move on forward, you need to descend one level lower and the only way to do this is to fall through the ice.The level of the cave where you are is a rectangular square grid of n rows and m columns. Each cell consists eit... | If you can reach the destination, print 'YES', otherwise print 'NO'. | C | afac59c927522fb223f59c36184229e2 | 635bf9e998c0b43b14ded7fbbc626877 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"dfs and similar"
] | 1430411400 | ["4 6\nX...XX\n...XX.\n.X..X.\n......\n1 6\n2 2", "5 4\n.X..\n...X\nX.X.\n....\n.XX.\n5 3\n1 1", "4 7\n..X.XX.\n.XX..X.\nX...X..\nX......\n2 2\n1 6"] | NoteIn the first sample test one possible path is:After the first visit of cell (2, 2) the ice on it cracks and when you step there for the second time, your character falls through the ice as intended. | PASSED | 2,000 | standard input | 2 seconds | The first line contains two integers, n and m (1 ≤ n, m ≤ 500) — the number of rows and columns in the cave description. Each of the next n lines describes the initial state of the level of the cave, each line consists of m characters "." (that is, intact ice) and "X" (cracked ice). The next line contains two integers,... | ["YES", "NO", "YES"] | #include<stdio.h>
#include<stdlib.h>
int visit[600][600],visit2[600][600],r,c,x2,y2,xt,yt,flag=0,count=0;
int confirm(int x,int y)
{
if((x<0)||(x>r-1)||(y<0)||(y>c-1))
return 1;
else
return 0;
}
int check(int x,int y)
{
if((visit[x-1][y]==1)&&(x+1==x2)&&(y+1==y2))
return 1;... | |
You play a computer game. Your character stands on some level of a multilevel ice cave. In order to move on forward, you need to descend one level lower and the only way to do this is to fall through the ice.The level of the cave where you are is a rectangular square grid of n rows and m columns. Each cell consists eit... | If you can reach the destination, print 'YES', otherwise print 'NO'. | C | afac59c927522fb223f59c36184229e2 | bcc9495dbb435ec1bcdebaaf20af5fd7 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"dfs and similar"
] | 1430411400 | ["4 6\nX...XX\n...XX.\n.X..X.\n......\n1 6\n2 2", "5 4\n.X..\n...X\nX.X.\n....\n.XX.\n5 3\n1 1", "4 7\n..X.XX.\n.XX..X.\nX...X..\nX......\n2 2\n1 6"] | NoteIn the first sample test one possible path is:After the first visit of cell (2, 2) the ice on it cracks and when you step there for the second time, your character falls through the ice as intended. | PASSED | 2,000 | standard input | 2 seconds | The first line contains two integers, n and m (1 ≤ n, m ≤ 500) — the number of rows and columns in the cave description. Each of the next n lines describes the initial state of the level of the cave, each line consists of m characters "." (that is, intact ice) and "X" (cracked ice). The next line contains two integers,... | ["YES", "NO", "YES"] | #include<stdio.h>
#include<stdlib.h>
char ar[1000][1003];
int n, m, r1, c1, r2, c2, i, j, k=0, count=0, hold;
void func(int x, int y)
{
//printf("x:%d y:%d\n", x, y);
if(x<1 || y<1 || x>n || y>m){
return ;
}
if(x==r2 && y==c2) hold=1;
if(hold==1){
return ;
}
else if(ar[x][y]... | |
You play a computer game. Your character stands on some level of a multilevel ice cave. In order to move on forward, you need to descend one level lower and the only way to do this is to fall through the ice.The level of the cave where you are is a rectangular square grid of n rows and m columns. Each cell consists eit... | If you can reach the destination, print 'YES', otherwise print 'NO'. | C | afac59c927522fb223f59c36184229e2 | 6c210f139264c7b70d2773df4991dda9 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"dfs and similar"
] | 1430411400 | ["4 6\nX...XX\n...XX.\n.X..X.\n......\n1 6\n2 2", "5 4\n.X..\n...X\nX.X.\n....\n.XX.\n5 3\n1 1", "4 7\n..X.XX.\n.XX..X.\nX...X..\nX......\n2 2\n1 6"] | NoteIn the first sample test one possible path is:After the first visit of cell (2, 2) the ice on it cracks and when you step there for the second time, your character falls through the ice as intended. | PASSED | 2,000 | standard input | 2 seconds | The first line contains two integers, n and m (1 ≤ n, m ≤ 500) — the number of rows and columns in the cave description. Each of the next n lines describes the initial state of the level of the cave, each line consists of m characters "." (that is, intact ice) and "X" (cracked ice). The next line contains two integers,... | ["YES", "NO", "YES"] | #include <stdio.h>
#include <stdlib.h>
char s[502][502];
int n,m,ir,ic,fr,fc;
int vis[500][500];
int dx[4]={1,-1,0,0},dy[4]={0,0,1,-1};
int dfs(int r,int c)
{ //printf("at %d,%d\n",r+1,c+1);
if(vis[r][c]&&r==fr&&c==fc)
return 1;
if(vis[r][c])
return 0;
vis[r][c]=1;
int i,x,y;
for(i... | |
You play a computer game. Your character stands on some level of a multilevel ice cave. In order to move on forward, you need to descend one level lower and the only way to do this is to fall through the ice.The level of the cave where you are is a rectangular square grid of n rows and m columns. Each cell consists eit... | If you can reach the destination, print 'YES', otherwise print 'NO'. | C | afac59c927522fb223f59c36184229e2 | 243f8d4d8af7ffa0ef3aefbe5459571b | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"dfs and similar"
] | 1430411400 | ["4 6\nX...XX\n...XX.\n.X..X.\n......\n1 6\n2 2", "5 4\n.X..\n...X\nX.X.\n....\n.XX.\n5 3\n1 1", "4 7\n..X.XX.\n.XX..X.\nX...X..\nX......\n2 2\n1 6"] | NoteIn the first sample test one possible path is:After the first visit of cell (2, 2) the ice on it cracks and when you step there for the second time, your character falls through the ice as intended. | PASSED | 2,000 | standard input | 2 seconds | The first line contains two integers, n and m (1 ≤ n, m ≤ 500) — the number of rows and columns in the cave description. Each of the next n lines describes the initial state of the level of the cave, each line consists of m characters "." (that is, intact ice) and "X" (cracked ice). The next line contains two integers,... | ["YES", "NO", "YES"] | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
int map[505][505],flag;
void run(int x1,int y1,int x2,int y2)
{
if(map[x1][y1]==0)
{
if(x1==x2&&y1==y2)flag=1;
return;
}
map[x1][y1]--;
run(x1+1,y1,x2,y2);
run(x1-1,y1,x2,y2);
run(x1,y1+1,x2,y2);
run(x1,y1-1,x2,y2);... | |
You play a computer game. Your character stands on some level of a multilevel ice cave. In order to move on forward, you need to descend one level lower and the only way to do this is to fall through the ice.The level of the cave where you are is a rectangular square grid of n rows and m columns. Each cell consists eit... | If you can reach the destination, print 'YES', otherwise print 'NO'. | C | afac59c927522fb223f59c36184229e2 | 1c8d69d8b8c62b29669ce641b7379d44 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"dfs and similar"
] | 1430411400 | ["4 6\nX...XX\n...XX.\n.X..X.\n......\n1 6\n2 2", "5 4\n.X..\n...X\nX.X.\n....\n.XX.\n5 3\n1 1", "4 7\n..X.XX.\n.XX..X.\nX...X..\nX......\n2 2\n1 6"] | NoteIn the first sample test one possible path is:After the first visit of cell (2, 2) the ice on it cracks and when you step there for the second time, your character falls through the ice as intended. | PASSED | 2,000 | standard input | 2 seconds | The first line contains two integers, n and m (1 ≤ n, m ≤ 500) — the number of rows and columns in the cave description. Each of the next n lines describes the initial state of the level of the cave, each line consists of m characters "." (that is, intact ice) and "X" (cracked ice). The next line contains two integers,... | ["YES", "NO", "YES"] | #include<stdio.h>
typedef struct
{
int x,y;
}Node;
char s[520][520];
int move[4][2]={{0,1},{1,0},{0,-1},{-1,0}};
Node b;
int check(Node b,int i)
{
b.x+=move[i][0];
b.y+=move[i][1];
if(s[b.x][b.y]=='.') return 1;
return 0;
}
int ck(Node a,int i)
{
a.x+=move[i][0];
a.y+=move[i][1];
if(a.x==b.x&&a.y==b.y) ... | |
You play a computer game. Your character stands on some level of a multilevel ice cave. In order to move on forward, you need to descend one level lower and the only way to do this is to fall through the ice.The level of the cave where you are is a rectangular square grid of n rows and m columns. Each cell consists eit... | If you can reach the destination, print 'YES', otherwise print 'NO'. | C | afac59c927522fb223f59c36184229e2 | f1aff0976adcc7d1aab94d657b5274ff | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"dfs and similar"
] | 1430411400 | ["4 6\nX...XX\n...XX.\n.X..X.\n......\n1 6\n2 2", "5 4\n.X..\n...X\nX.X.\n....\n.XX.\n5 3\n1 1", "4 7\n..X.XX.\n.XX..X.\nX...X..\nX......\n2 2\n1 6"] | NoteIn the first sample test one possible path is:After the first visit of cell (2, 2) the ice on it cracks and when you step there for the second time, your character falls through the ice as intended. | PASSED | 2,000 | standard input | 2 seconds | The first line contains two integers, n and m (1 ≤ n, m ≤ 500) — the number of rows and columns in the cave description. Each of the next n lines describes the initial state of the level of the cave, each line consists of m characters "." (that is, intact ice) and "X" (cracked ice). The next line contains two integers,... | ["YES", "NO", "YES"] | #include <stdio.h>
char map[1000][1000],used[1000][1000];
int found=0,dots=0,totalrow,totalcol,x,y;
void search(int i,int j)
{
//printf("i:%d j:%d\n",i,j);
if(i<0 || j<0 || i>=totalrow || j>=totalcol || used[i][j]==1)
return;
used[i][j]=1;
if(map[i][j]=='B')
{
found=1;
x=i;
... | |
Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers).The key in football is to divide into teams fairly before the ga... | On the first line print an integer x — the number of boys playing for the first team. On the second line print x integers — the individual numbers of boys playing for the first team. On the third line print an integer y — the number of boys playing for the second team, on the fourth line print y integers — the individu... | C | 0937a7e2f912fc094cc4275fd47cd457 | ce628b43574d217c666a1282044da00f | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy",
"math"
] | 1328886000 | ["3\n1 2 1", "5\n2 3 3 1 1"] | NoteLet's consider the first sample test. There we send the first and the second boy to the first team and the third boy to the second team. Let's check all three conditions of a fair division. The first limitation is fulfilled (all boys play), the second limitation on the sizes of groups (|2 - 1| = 1 ≤ 1) is fulfilled... | PASSED | 1,500 | standard input | 1 second | The first line contains the only integer n (2 ≤ n ≤ 105) which represents the number of guys in the yard. The next line contains n positive space-separated integers, ai (1 ≤ ai ≤ 104), the i-th number represents the i-th boy's playing skills. | ["2\n1 2 \n1\n3", "3\n4 1 3 \n2\n5 2"] | #include <stdio.h>
int a[100000], p[100000];
void sort(int l, int r) {
if (l >= r)
return;
int i = l, j = r, pp = p[l + rand() % (r-l)];
while (i <= j)
if (a[p[i]] < a[pp])
i++;
else if (a[pp] < a[p[j]])
j--;
else {
int t = p[i]; p[i] = p[j]; p[j] = t;
i++; j--;
}
sort(i, r); sort(l, j);
}... | |
Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers).The key in football is to divide into teams fairly before the ga... | On the first line print an integer x — the number of boys playing for the first team. On the second line print x integers — the individual numbers of boys playing for the first team. On the third line print an integer y — the number of boys playing for the second team, on the fourth line print y integers — the individu... | C | 0937a7e2f912fc094cc4275fd47cd457 | c047a82e9f2498ecef453fb7696a91c6 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy",
"math"
] | 1328886000 | ["3\n1 2 1", "5\n2 3 3 1 1"] | NoteLet's consider the first sample test. There we send the first and the second boy to the first team and the third boy to the second team. Let's check all three conditions of a fair division. The first limitation is fulfilled (all boys play), the second limitation on the sizes of groups (|2 - 1| = 1 ≤ 1) is fulfilled... | PASSED | 1,500 | standard input | 1 second | The first line contains the only integer n (2 ≤ n ≤ 105) which represents the number of guys in the yard. The next line contains n positive space-separated integers, ai (1 ≤ ai ≤ 104), the i-th number represents the i-th boy's playing skills. | ["2\n1 2 \n1\n3", "3\n4 1 3 \n2\n5 2"] | #include<stdio.h>
#include<math.h>
int main()
{
long int n,i,max=0;
scanf("%ld",&n);
long int a[n],b[n],c[n],d=0,e=0,sum1=0,sum2=0;
for(i=0;i<n;i++)
{scanf("%d",&a[i]);
if(a[i]>max)
max=a[i];}
for(i=0;i<n;i+=2)
{if(i<n-1)
{if(abs(sum1+a[i]-sum2-a[i+1])<=max)
{b[d++]=i+1;
c[e++]=i+2;
sum1+=a[i];
sum2+=a[i+1];}
else
{c[e... | |
Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers).The key in football is to divide into teams fairly before the ga... | On the first line print an integer x — the number of boys playing for the first team. On the second line print x integers — the individual numbers of boys playing for the first team. On the third line print an integer y — the number of boys playing for the second team, on the fourth line print y integers — the individu... | C | 0937a7e2f912fc094cc4275fd47cd457 | cbf04f0303f3c3cc2a35c4048ea90c7f | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy",
"math"
] | 1328886000 | ["3\n1 2 1", "5\n2 3 3 1 1"] | NoteLet's consider the first sample test. There we send the first and the second boy to the first team and the third boy to the second team. Let's check all three conditions of a fair division. The first limitation is fulfilled (all boys play), the second limitation on the sizes of groups (|2 - 1| = 1 ≤ 1) is fulfilled... | PASSED | 1,500 | standard input | 1 second | The first line contains the only integer n (2 ≤ n ≤ 105) which represents the number of guys in the yard. The next line contains n positive space-separated integers, ai (1 ≤ ai ≤ 104), the i-th number represents the i-th boy's playing skills. | ["2\n1 2 \n1\n3", "3\n4 1 3 \n2\n5 2"] | #include<stdio.h>
long int index[100010];
void merge(int arr[], int l, int m, int r)
{
int i, j, k;
int n1 = m - l + 1;
int n2 = r - m;
/* create temp arrays */
int L[n1], R[n2],L1[n1],R1[n2];
/* Copy data to temp arrays L[] and R[] */
for (i = 0; i < n1; i++)
{
L[i] = arr[l +... | |
Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers).The key in football is to divide into teams fairly before the ga... | On the first line print an integer x — the number of boys playing for the first team. On the second line print x integers — the individual numbers of boys playing for the first team. On the third line print an integer y — the number of boys playing for the second team, on the fourth line print y integers — the individu... | C | 0937a7e2f912fc094cc4275fd47cd457 | d453d9ff84da95ff8d7e00b1f5365c99 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy",
"math"
] | 1328886000 | ["3\n1 2 1", "5\n2 3 3 1 1"] | NoteLet's consider the first sample test. There we send the first and the second boy to the first team and the third boy to the second team. Let's check all three conditions of a fair division. The first limitation is fulfilled (all boys play), the second limitation on the sizes of groups (|2 - 1| = 1 ≤ 1) is fulfilled... | PASSED | 1,500 | standard input | 1 second | The first line contains the only integer n (2 ≤ n ≤ 105) which represents the number of guys in the yard. The next line contains n positive space-separated integers, ai (1 ≤ ai ≤ 104), the i-th number represents the i-th boy's playing skills. | ["2\n1 2 \n1\n3", "3\n4 1 3 \n2\n5 2"] | #include <stdio.h>
#include <stdlib.h>
typedef struct player{
int num;
int skills;
}Player;
int cmp(const void *a,const void *b)
{
if( ((Player*)a)->skills > ((Player*)b)->skills ) return 1;
else if( ((Player*)a)->skills == ((Player*)b)->skills ) return 0;
else return -1;
}
int main()
{
int n... | |
Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers).The key in football is to divide into teams fairly before the ga... | On the first line print an integer x — the number of boys playing for the first team. On the second line print x integers — the individual numbers of boys playing for the first team. On the third line print an integer y — the number of boys playing for the second team, on the fourth line print y integers — the individu... | C | 0937a7e2f912fc094cc4275fd47cd457 | 3adeea73b7883e4c3b1966dd5924af56 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy",
"math"
] | 1328886000 | ["3\n1 2 1", "5\n2 3 3 1 1"] | NoteLet's consider the first sample test. There we send the first and the second boy to the first team and the third boy to the second team. Let's check all three conditions of a fair division. The first limitation is fulfilled (all boys play), the second limitation on the sizes of groups (|2 - 1| = 1 ≤ 1) is fulfilled... | PASSED | 1,500 | standard input | 1 second | The first line contains the only integer n (2 ≤ n ≤ 105) which represents the number of guys in the yard. The next line contains n positive space-separated integers, ai (1 ≤ ai ≤ 104), the i-th number represents the i-th boy's playing skills. | ["2\n1 2 \n1\n3", "3\n4 1 3 \n2\n5 2"] | #include<stdio.h>
#include<string.h>
#include<math.h>
#include<limits.h>
struct solve{
int x;
int y;
}arr[200001];
int maxz(int a,int b){
return a>b?a:b;
}
int min(int a,int b){
return a<b?a:b;
}
int compare(int *a,int *b){
return *b-*a;
}
int main(){
int max=0;
int a,b,c,d;
scanf("%d",&a);
int i;
f... | |
Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers).The key in football is to divide into teams fairly before the ga... | On the first line print an integer x — the number of boys playing for the first team. On the second line print x integers — the individual numbers of boys playing for the first team. On the third line print an integer y — the number of boys playing for the second team, on the fourth line print y integers — the individu... | C | 0937a7e2f912fc094cc4275fd47cd457 | 58f6d75042ebc00bd1be001cec6b7e04 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy",
"math"
] | 1328886000 | ["3\n1 2 1", "5\n2 3 3 1 1"] | NoteLet's consider the first sample test. There we send the first and the second boy to the first team and the third boy to the second team. Let's check all three conditions of a fair division. The first limitation is fulfilled (all boys play), the second limitation on the sizes of groups (|2 - 1| = 1 ≤ 1) is fulfilled... | PASSED | 1,500 | standard input | 1 second | The first line contains the only integer n (2 ≤ n ≤ 105) which represents the number of guys in the yard. The next line contains n positive space-separated integers, ai (1 ≤ ai ≤ 104), the i-th number represents the i-th boy's playing skills. | ["2\n1 2 \n1\n3", "3\n4 1 3 \n2\n5 2"] | /*
* Name : Dhyey Bhansali (Shinchan6599)
* SEAS,AU (ICT,2nd Year)
* Stalking my code? Don't. You won't understand code of a genius.
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
#include<string.h>
typedef struct myStruct {
long long int id;
long long int value;
} player;
long long int compare... | |
Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers).The key in football is to divide into teams fairly before the ga... | On the first line print an integer x — the number of boys playing for the first team. On the second line print x integers — the individual numbers of boys playing for the first team. On the third line print an integer y — the number of boys playing for the second team, on the fourth line print y integers — the individu... | C | 0937a7e2f912fc094cc4275fd47cd457 | ab0a841f97978f4d9617194838b1d805 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy",
"math"
] | 1328886000 | ["3\n1 2 1", "5\n2 3 3 1 1"] | NoteLet's consider the first sample test. There we send the first and the second boy to the first team and the third boy to the second team. Let's check all three conditions of a fair division. The first limitation is fulfilled (all boys play), the second limitation on the sizes of groups (|2 - 1| = 1 ≤ 1) is fulfilled... | PASSED | 1,500 | standard input | 1 second | The first line contains the only integer n (2 ≤ n ≤ 105) which represents the number of guys in the yard. The next line contains n positive space-separated integers, ai (1 ≤ ai ≤ 104), the i-th number represents the i-th boy's playing skills. | ["2\n1 2 \n1\n3", "3\n4 1 3 \n2\n5 2"] | #include <stdio.h>
struct play{
int skill;
int position;
};
typedef struct play player;
typedef int (*compfn)(const void*, const void*);
int compare(struct play *, struct play *);
int main(){
int n, x=0, y=0;
int i, j;
scanf("%d", &n);
player players[n];
for(i=0; i<n; i++){
sca... | |
Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers).The key in football is to divide into teams fairly before the ga... | On the first line print an integer x — the number of boys playing for the first team. On the second line print x integers — the individual numbers of boys playing for the first team. On the third line print an integer y — the number of boys playing for the second team, on the fourth line print y integers — the individu... | C | 0937a7e2f912fc094cc4275fd47cd457 | 7468a0d470ca5fa8951d619fd498d6bc | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy",
"math"
] | 1328886000 | ["3\n1 2 1", "5\n2 3 3 1 1"] | NoteLet's consider the first sample test. There we send the first and the second boy to the first team and the third boy to the second team. Let's check all three conditions of a fair division. The first limitation is fulfilled (all boys play), the second limitation on the sizes of groups (|2 - 1| = 1 ≤ 1) is fulfilled... | PASSED | 1,500 | standard input | 1 second | The first line contains the only integer n (2 ≤ n ≤ 105) which represents the number of guys in the yard. The next line contains n positive space-separated integers, ai (1 ≤ ai ≤ 104), the i-th number represents the i-th boy's playing skills. | ["2\n1 2 \n1\n3", "3\n4 1 3 \n2\n5 2"] | #include <stdio.h>
#include <stdlib.h>
typedef struct {int num; int ab;} boy;
boy arr[110000], k;
int n,t,j,i;
int cmp(const void* el1, const void* el2){ boy a=(*(boy*)el1); boy b=(*(boy*)el2);
return (a.ab==b.ab)?0:((a.ab>b.ab)?1:-1);
}
int main(){
scanf("%d", &n);
for(i=0; i<n; i++){
scanf("%d", &arr[i].ab);
a... | |
Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers).The key in football is to divide into teams fairly before the ga... | On the first line print an integer x — the number of boys playing for the first team. On the second line print x integers — the individual numbers of boys playing for the first team. On the third line print an integer y — the number of boys playing for the second team, on the fourth line print y integers — the individu... | C | 0937a7e2f912fc094cc4275fd47cd457 | 1dd448b0c86ace393a5078811fb5e5ce | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy",
"math"
] | 1328886000 | ["3\n1 2 1", "5\n2 3 3 1 1"] | NoteLet's consider the first sample test. There we send the first and the second boy to the first team and the third boy to the second team. Let's check all three conditions of a fair division. The first limitation is fulfilled (all boys play), the second limitation on the sizes of groups (|2 - 1| = 1 ≤ 1) is fulfilled... | PASSED | 1,500 | standard input | 1 second | The first line contains the only integer n (2 ≤ n ≤ 105) which represents the number of guys in the yard. The next line contains n positive space-separated integers, ai (1 ≤ ai ≤ 104), the i-th number represents the i-th boy's playing skills. | ["2\n1 2 \n1\n3", "3\n4 1 3 \n2\n5 2"] | #include<stdio.h>
#include<stdlib.h>
typedef struct boy{
int a;
int num;
}boy;
int compare(const void * a,const void * b){
return(*(int*)a-*(int*)b);
}
int main(){
int i,n,x,y;
int a[100001];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
a[i]=a[i]*100000+i;
}
qsort(a,n,sizeof(int),compare);
f... | |
Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers).The key in football is to divide into teams fairly before the ga... | On the first line print an integer x — the number of boys playing for the first team. On the second line print x integers — the individual numbers of boys playing for the first team. On the third line print an integer y — the number of boys playing for the second team, on the fourth line print y integers — the individu... | C | 0937a7e2f912fc094cc4275fd47cd457 | 26bb715477602d7ead8f3bd97f68ef3a | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy",
"math"
] | 1328886000 | ["3\n1 2 1", "5\n2 3 3 1 1"] | NoteLet's consider the first sample test. There we send the first and the second boy to the first team and the third boy to the second team. Let's check all three conditions of a fair division. The first limitation is fulfilled (all boys play), the second limitation on the sizes of groups (|2 - 1| = 1 ≤ 1) is fulfilled... | PASSED | 1,500 | standard input | 1 second | The first line contains the only integer n (2 ≤ n ≤ 105) which represents the number of guys in the yard. The next line contains n positive space-separated integers, ai (1 ≤ ai ≤ 104), the i-th number represents the i-th boy's playing skills. | ["2\n1 2 \n1\n3", "3\n4 1 3 \n2\n5 2"] | #include <stdio.h>
#include <stdlib.h>
void intercambiar ( int*, int*);
void quicksort(int[], int[], int, int);
int main()
{
int n, i, x=0, y=0;
scanf("%d",&n);
int jug[n],num[n],equip1[n/2+1],equip2[n/2+1];
for(i=0; i<n; i++)
{
scanf("%d",&jug[i]);
num[i]= i+1;
}
quicksort... | |
Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers).The key in football is to divide into teams fairly before the ga... | On the first line print an integer x — the number of boys playing for the first team. On the second line print x integers — the individual numbers of boys playing for the first team. On the third line print an integer y — the number of boys playing for the second team, on the fourth line print y integers — the individu... | C | 0937a7e2f912fc094cc4275fd47cd457 | cd8dd0e4ea7fc777df0e9bac4d824f58 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy",
"math"
] | 1328886000 | ["3\n1 2 1", "5\n2 3 3 1 1"] | NoteLet's consider the first sample test. There we send the first and the second boy to the first team and the third boy to the second team. Let's check all three conditions of a fair division. The first limitation is fulfilled (all boys play), the second limitation on the sizes of groups (|2 - 1| = 1 ≤ 1) is fulfilled... | PASSED | 1,500 | standard input | 1 second | The first line contains the only integer n (2 ≤ n ≤ 105) which represents the number of guys in the yard. The next line contains n positive space-separated integers, ai (1 ≤ ai ≤ 104), the i-th number represents the i-th boy's playing skills. | ["2\n1 2 \n1\n3", "3\n4 1 3 \n2\n5 2"] | #include<stdio.h>
#include<stdlib.h>
typedef struct player{
int skill;
int order;
} player_t;
player_t a[100001];
int n;
int compare(const void * a, const void * b){
return ((player_t*)a)->skill-((player_t*)b)->skill;
}
int main(){
int i;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&(a[i].skill));
a[i].or... | |
Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers).The key in football is to divide into teams fairly before the ga... | On the first line print an integer x — the number of boys playing for the first team. On the second line print x integers — the individual numbers of boys playing for the first team. On the third line print an integer y — the number of boys playing for the second team, on the fourth line print y integers — the individu... | C | 0937a7e2f912fc094cc4275fd47cd457 | 4f59b79916297ef42b0a38ca327483ef | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"sortings",
"greedy",
"math"
] | 1328886000 | ["3\n1 2 1", "5\n2 3 3 1 1"] | NoteLet's consider the first sample test. There we send the first and the second boy to the first team and the third boy to the second team. Let's check all three conditions of a fair division. The first limitation is fulfilled (all boys play), the second limitation on the sizes of groups (|2 - 1| = 1 ≤ 1) is fulfilled... | PASSED | 1,500 | standard input | 1 second | The first line contains the only integer n (2 ≤ n ≤ 105) which represents the number of guys in the yard. The next line contains n positive space-separated integers, ai (1 ≤ ai ≤ 104), the i-th number represents the i-th boy's playing skills. | ["2\n1 2 \n1\n3", "3\n4 1 3 \n2\n5 2"] | #include <stdio.h>
struct pares
{
int prim;
int seg;
};
typedef struct pares PAR;
void quicksort(PAR a[], int primero, int ultimo);
int team1Total = 0;
int team2Total = 0;
int main()
{
int n, i;
scanf("%d",&n);
PAR arr[n];
int team1[n];
int team2[n];
for (i=0; i<n; i++)
{
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.