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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
One day Polycarpus stopped by a supermarket on his way home. It turns out that the supermarket is having a special offer for stools. The offer is as follows: if a customer's shopping cart contains at least one stool, the customer gets a 50% discount on the cheapest item in the cart (that is, it becomes two times cheape... | In the first line print a single real number with exactly one decimal place — the minimum total price of the items, including the discounts. In the following k lines print the descriptions of the items in the carts. In the i-th line print the description of the i-th cart as "t b1 b2 ... bt" (without the quotes), where... | C | 06c7834aa4d06d6fcebfa410054f1b8c | a5bc2c7a72a779854864a61740d13356 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"sortings",
"greedy"
] | 1331478300 | ["3 2\n2 1\n3 2\n3 1", "4 3\n4 1\n1 2\n2 2\n3 2"] | NoteIn the first sample case the first cart should contain the 1st and 2nd items, and the second cart should contain the 3rd item. This way each cart has a stool and each cart has a 50% discount for the cheapest item. The total price of all items will be: 2·0.5 + (3 + 3·0.5) = 1 + 4.5 = 5.5. | PASSED | 1,700 | standard input | 3 seconds | The first input line contains two integers n and k (1 ≤ k ≤ n ≤ 103) — the number of items in the supermarket and the number of carts, correspondingly. Next n lines describe the items as "ci ti" (without the quotes), where ci (1 ≤ ci ≤ 109) is an integer denoting the price of the i-th item, ti (1 ≤ ti ≤ 2) is an intege... | ["5.5\n2 1 2\n1 3", "8.0\n1 1\n2 4 2\n1 3"] | #include<stdio.h>
#include<stdlib.h>
typedef struct Item{
int t,c,i;
}Item;
int cmp(Item* p1, Item *p2){
if(p1->t == p2->t) return -(p1->c - p2->c);
return (p1->t - p2->t);
}
int main(){
int flag=0,i,m,n,k,kf,min,x=0;
double pt=0.0;
scanf("%d %d",&n,&k);
Item a[n];
for(i=0;i<n;i++){
... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | 74f99d59d4967df67616d3d8e23d6290 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include <stdio.h>
#define OPTIONS 5
void read(int *arr, int length, int width) {
char ch;
for (int i=0; i<length; i++) {
for (int j=0; j<width; j++) {
scanf("%c",&ch);
*((arr+i*width)+j)=(ch-'A');
}
scanf("\n");
}
}
void write(int *arr, int length, int width)... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | f2b198d3750a132ad3798ed7888bc634 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include<stdio.h>
#include<string.h>
int main(){
int n, m;
int points[1100];
char ans[1100][1100];
char correct[1100];
int score =0;
int A[1100];
int B[1100];
int C[1100];
int D[1100];
int E[1100];
scanf("%d %d",&n,&m);
for(int i=0;i<n;i++){
scanf("%s",&ans[i]);
}
for(int j=0;j<m;j++){
scanf("%d",&p... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | 677fa0e1f7417564032c14c99c2e65be | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include<stdio.h>
int main(){
int n,m;
scanf("%d%d",&n,&m);
char stch[n][m];
for(int i=0;i<n;i++){
for(int j=0;j<m;j++)
scanf(" %c",&stch[i][j]);
}
int ms[m];
for(int i=0;i<m;i++)
scanf("%d",&ms[i]);
int c[5];
char tr[m][n];
for(int i=0;i<m;i++){
... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | 790f76329ebd5af36e136e130bbf9bf0 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include<stdio.h>
#include<stdlib.h>
#define size 1001
main()
{
long int n,m,i,j,res=0;
scanf("%ld %ld",&n,&m);
char s[size][size];
long int a[size];
long int cnt[5]={0};
for(i=0;i<n;++i)
{
scanf("%s",&s[i]);
}
for(i=0;i<m;++i)
{
scanf("%ld",&a[i]);
}
for(i=0;i<m;++i)
{
long int max=0;
for(long int r=0;r<5... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | 45e5b12974e3e69948f69707cf7426cf | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include<stdio.h>
#include<string.h>
int main()
{
int n,m,i,j,p,q,r,s,t;
scanf("%d%d",&n,&m);
int a[m];
char s1[n+1][m+1];
long long int sum=0;
for(i=0; i<n; i++)
scanf("%s",&s1[i]);
for(i=0; i<m; i++)
scanf("%d",&a[i]);
for(i=0; i<m; i++)
{
p=q=r=s=t=0;
... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | 47c8a0f982e4f2ba8f3b173957ab7bc4 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include<stdio.h>
#include<string.h>
int main()
{
int q,i,j,pos,marks,res=0,max,count,st;
scanf("%d%d",&st,&q);
char s[q];
int a[q][5];
for(i=0;i<q;i++)
{
for(j=0;j<=4;j++)
a[i][j]=0;
}
for(i=0;i<st;i++)
{
scanf("%s... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | 1b573e3bba42a3dd082947347b535522 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include<stdio.h>
#include<string.h>
int main()
{
int q,i,j,pos,marks,res=0,max,count,st;
scanf("%d%d",&st,&q);
char s[q];
int a[q][5];
for(i=0;i<q;i++)
{
for(j=0;j<=4;j++)
a[i][j]=0;
}
for(i=0;i<st;i++)
{
scanf("%s",s);
count=0;
for(j=0;j<q;j++)
{
int asci=(int)s[j];
pos=a... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | 0d2107760aab3642ce2db9b385a88321 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include<stdio.h>
#include<string.h>
int main()
{
int n,m,i,j,a,b,c,d,e,sum=0;
n--;
scanf("%d", &n);
scanf("%d", &m);
char str[n][m];
int ara[m];
for(i=0; i<n; i++)
{
scanf("%s\n", &str[i]);
}
for(i=0; i<m; i++)
{
scanf("%d", &ara[i]);
... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | e89aff27ec056c9fe9a1cf84353e90a1 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include<stdio.h>
#include<string.h>
int main()
{
int n,m,i,j,a,b,c,d,e,sum=0;
scanf("%d", &n);
scanf("%d", &m);
char str[n][m];
int ara[m];
for(i=0; i<n; i++)
{
scanf("%s\n", &str[i]);
}
for(i=0; i<m; i++)
{
scanf("%d", &ara[i]);
}
... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | 0f272ee0ab892fb07c92c394926cac16 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
int comp(const void * a,const void * b)
{
return (*(int*)a - *(int*)b);
}
int main()
{
int t,n,m,i,j,k,l,arr[1009][6]={},max[1009]={},sum,p,q;
char c[1009][1009];
scanf("%d %d",&n,&m);
for(i=0;i<n;i++)
scanf("%s",&c[i])... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | f565b82107855a8ad65ba79e2eb256b7 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include<stdio.h>
#include<stdlib.h>
int comp(const void*x,const void*y)
{
return(*(int*)x-*(int*)y);
}
int main()
{
int n,m,b,i,j,sum=0,x;
char s[1005][1005]={};
scanf("%d %d",&n,&m);
for(i=0;i<n;i++)
{
scanf("%s",s[i]);
}
for(i=0;i<m;i++)
{
int count[5]={0};
... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | 63d0f62f8b93b0ee762305d903aa55d5 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include <stdio.h>
int main ()
{
int n, m;
scanf("%d%d", &n, &m);
char input[n][m + 1];
int max[m];
int cnt[5];
for (int i = 0; i < n; i++)
{
scanf("%s", input[i]);
}
for (int j = 0; j < m; j++)
{
for (int i = 0; i < 5; i++)
cnt[i] = 0;
for (int k = 0; k < n; k++)
{
for ... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | dbbbe9b87354cad2fb9d071c111e8928 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include<stdio.h>
int main()
{
int n,m,tot_mrk=0;
scanf("%d %d",&n,&m);
char s[n][m+1];
for(int i=0;i<n;i++)
{
scanf(" %[^\n]",s[i]);
}
int mrk[m];
for(int i=0;i<m;i++)
{
scanf("%d",&mrk[i]);
}
for(int j=0;j<m;j++)
{
int mx=0;
int num[5]={0... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | d8bb08dc03e385e16a6c7c20400a01ac | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include <stdio.h>
int main()
{
int max,n,m,a[1001],b[5]={0,},c=0;
char s[1001][1001];
scanf("%d %d",&n,&m);
for(int i=0; i<n; i++){
scanf(" %s",s[i]);
}
for(int i=0; i<m; i++){
scanf("%d",&a[i]);
}
for(int i=0; i<m; i++){
for(int j=0; j<n; j++){
b[(s[j][i]-'A')]++;
}
max=0;
for(int j=0; j<5; j+... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | cb552356ce66660d773611ac37434a12 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
int n,m;
int i,j,d;
char a[1500][1500];
int b[1500][10]={0};
int point[1500];
scanf("%d%d",&n,&m);
for(i=0;i<n;i++)
{
scanf("%s",a[i]);
for(j=0;j<m;j++)
{
d=a[i][j]-'A';
b... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | 6fb2dc202aab8b241b3d3192d8480511 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include<stdio.h>
int main()
{
int n,m,i,k,j,sum=0,a[1000],b[5]={0},max=0;
scanf("%d%d",&n,&m);
char c[1000][1000],d[1000];
for(i=0;i<n;i++)
{
scanf("%s",c[i]);
}
for(i=0;i<m;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
if(c[j][i]=='A')
{
... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | cebf8b2f008d94dc660bbe29e5a08f6b | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include<stdio.h>
int main()
{
int n,m,i,j,x=0,sum=0,k,max=0;
char ch;
scanf("%d%d%c",&n,&m,&ch);
char ara[n][m+1];
int ara2[m];
for(i=0;i<n;i++){
gets(&ara[i][0]);
}
for(i=0;i<m;i++){
scanf("%d",&ara2[i]);
}
for(i=0;i<m;i++){
for(j=0;j<n;j++){
... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | a568e057f1100b949c66eff9b8cc328b | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include<stdio.h>
int main(){
int n,m,sum=0;
scanf("%d %d",&n,&m);
int val[m];
char arr[n][m];
for(int i=0;i<n;i++){
scanf("%s",arr[i]);
}
for(int j=0;j<m;j++)
scanf("%d",&val[j]);
for(int i=0;i<m;i++)
{
int alph[26],max =0;
for(int j=0;j<26;j++)
... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | c270feb9d705fcae99661a1ead5ad31c | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include<stdio.h>
int main()
{
long long int n,m,i,j=0;
long long int sum=0;
scanf("%lld %lld",&n,&m);
char s[n][m+1];
long long int a[m];
for(i=0;i<n;i=i+1)
{
scanf("%s",&s[i]);
}
for(i=0;i<m;i=i+1)
{
scanf("%lld",&a[i]);
}
while(j<m)
{
long l... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | 5f921c4aa854b42a16508ef67156c126 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include<stdio.h>
int main(){
int n,m,total=0;
scanf("%d %d",&n,&m);
getchar();
char a[n][m];
char s[m];
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
scanf("%c",&a[i][j]);
}
getchar();
}
int score[m];
for(int j=0;j<m;j++)
scanf("%d",score+j);
for(int j=0;j<m;j++){
int option[5] = {0};
... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | d15722e8c733a4736517a8b5d510d425 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include <stdio.h>
int main(){
int students, questions,maxScore = 0,tmp = 0;
scanf("%d %d",&students, &questions);
int calculate[5][questions];
char answer[questions+1];
int qScore[questions]; ... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | dd4d848bb45ad7b2b89289dff4aabf2b | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include<stdio.h>
int max(int counter_a,int counter_b,int counter_c,int counter_d,int counter_e)
{
int max=0;
if(max<counter_a)
max=counter_a;
if(max<counter_b)
max=counter_b;
if(max<counter_c)
max=counter_c;
if(max<counter_d)
max=counter_d;
if(max<counter_e)
... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | 614ec1af2648ad3582b18549e81796ae | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include <stdio.h>
#define MAX 1000
int max(int x, int y) {
return (x > y) ? x : y;
}
int main() {
int n, m;
scanf("%d %d", &n, &m);
char ans[MAX];
int pts[MAX];
int result = 0;
int a[MAX] = {0};
int b[MAX] = {0};
int c[MAX] = {0};
int d[MAX] = {0};
int e[MAX] = {0};
... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | 0bd0bf2ba92a300e2791503f47eb954a | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define MIN(a,b) a<b?a:b
#define MAX(a,b) a>b?a:b
#define rep(i,a,b) for(i=a;i<b;i++)
#define rev(i,a,b) for(i=a;i>b;i--)
#define sf(a) scanf("%d",&(a))
#define pf(a) printf("%d",(a))
#define sfll(a) scanf("%lld",&(a))
#define pfll(a) printf("%lld... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | 34d7392a3b178cf143646d073dcaad5d | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
int main()
{
int n, m;
scanf("%d %d", &n, &m);
int i, j;
char s[1003];
int count[1003][5];
for (i = 0; i < 1003; i++)
{
for (j = 0; j < 5; j++)
{
count[i][j] = 0;
}
}
for (i = 0; i < n; i++)
{
scanf("%s", s);
for (j = 0... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | 9d3faf67a89c59ac562e2621c4186147 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include <stdio.h>
//==============================================================================
//==============================================================================
FILE *pfin;
#ifdef CODEBLOCKS
#define SELECT_INPUT pfin = fopen("in.txt", "r");
#else
#define SELECT_INPUT pfin = stdin;
#endif
//====... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | 7b6b39d5ac62ac15468fd812e4dc9885 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include <stdio.h>
int main(){
int n , m;
scanf("%d %d", &n , &m);
char answers[n][m];
getchar();
for(int i = 0;i<n;i++)
{
for(int j = 0;j<m;j++)
{
scanf("%c" , &answers[i][j]);
}
getchar();
}
// for(int i = 0;i < n;i++)
// {
// for(int j = 0;j<m;j++)
// {
// printf("a[%d][%d] is: %c\n" , i ,... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | 2b808ab903356bf8d6bf98856a2bd7f4 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include <stdio.h>
#define MAX 1005
int max(int *p, int len) {
int ret = 0;
for (int i = 0; i < len; i++) {
ret = p[i] > ret ? p[i] : ret;
}
return ret;
}
int main() {
int n, m, weight;
char row[MAX];
int counts[MAX][5] = {0};
long long score = 0;
scanf("%d %d\n", &n, &m... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | e2f0689ce630971f32ba1dab62a50188 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include<stdio.h>
int maxi(int a, int b, int c)
{
int r;
if(a>b)
{
if(a>c)
r=a;
else
r=c;
}
else
{
if(b>c)
r=b;
else
r=c;
}
return r;
}
int main()
{
int n, m, sum=0, i, j,r, aa, b, c, d, e;
scanf("%d%... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | 2bba63db8055a0d343fb5fe062d57e12 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include <stdio.h>
#include <stdlib.h>
int main(int argc, char const *argv[])
{
int n,m;
int total = 0;
scanf("%d %d",&n,&m);
char str[n][m+1];
int pts[m];
int arr_cnt[5];
for (int i = 0; i < n; ++i)
{
scanf("%s",str[i]);
}
for (int i = 0; i < m; ++i)
{
scanf("%d",&pts[i]);
}
for (int i = 0; i < m; ++... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | 1014d9a0e9c6994cf846ff377edc09e9 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include <stdio.h>
#include <stdlib.h>
int main(void){
int n,m;
int *a,*d;
int i,j;
char **s;
int answer=0;
scanf("%d %d",&n,&m);
s=(char**)calloc(n,sizeof(char*));
a=(int*)calloc(m,sizeof(int));
d=(int*)calloc(n,sizeof(int));
for(i=0;i<n;i++){
s[i]=(char*)calloc(m+1,sizeof(char));
scanf("%s",s[i]);
}
... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | 8f18232b48fc6125d1a848b7716cab90 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include<stdio.h>
void get_marks(char myanswer[],int len , long long int mat[][5])
{
int i;
for(i=0;i<len;i++)
{
mat[i][myanswer[i]-65]++;
}
}
int max_in_row(long long int mat[][5],int row)
{
int i,max=0;
for(i=0;i<5;i++)
{
if(mat[row][max]<mat[row][i])
max=i;
... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | 46e985046facd941ae88b1d260af9f5e | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include <stdio.h>
int main()
{
int n, m, i, j, a, b, c, d, e, max; scanf("%d%d",&n,&m);
char s[n][m+1], s1[m+1];
int p[m], ss, sum=0;
for(i=0;i<n;i++)
scanf("%s",s[i]);
for(i=0;i<m;i++)
scanf("%d",&p[i]);
for(j=0;j<m;j++)
{
a=0;b=0;c=0;d=0;e=0; max=0;
for(i=0;i<n... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | cf9f1c4d2f83ee94a7704cf0177fc9c3 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include<stdio.h>
long long maxx(long long a,long long b,long long c,long long d,long long e)
{
long long m,n;
if(a>b)
{
if(a>c)
m=a;
else
m=c;
}
else
{
if(b>c)
m=b;
else
m=c;
}
if(d>e)
n=d;
else
n=e;
if(n>m)
return n;
else
return m;
}
int main()
{
int n,m;
long long y,sum=0;
scanf("%d%d",&n,&m);
char a... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | 3cc77728a3eb1cc3741fafd77bb82b44 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include <stdio.h>
int main()
{
int n,m,i,j; unsigned int sum=0;
scanf("%d %d",&n,&m);
int maxscore[1000]={0};
int classify[5][1000]={0};
char answers[n][m];
for(i=0;i<n;i++) scanf("%s",answers[i]);
int scores[m];
for(i=0;i<m;i++) scanf("%d",&scores[i]);
for(i=0;i<n;i++) for(j=0;... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | b322179b64a1bc6988f18c775e000c3c | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include<stdio.h>
int main(){
int n,m;
scanf("%d%d",&n,&m);
int a[m];
char p[n][m];
int c[m][5];
for(int i = 0;i<n;i++){
int g;
scanf("%c",&g);
for(int j = 0;j<m;j++){
scanf("%c",&p[i][j]);
}
}
for(int i = 0;i<m;i++){
scanf("%d",&a[i]);
c[i][0]=0;
c[i][1]=0;
c[i][2]=0;
c[i]... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | 9b3bf80e723584aa2c6492280da6ccc4 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include<stdio.h>
int main(){
int n,m,score=0;
scanf("%d %d",&n,&m);
char ch[n][m];
int ar[m];
for (int i=0;i<n;i++)
scanf("%s",ch[i]);
for (int i=0;i<m;i++)
scanf("%d",&ar[i]);
for(int i=0;i<m;i++){
int temp=0;
for(char c='A';c<'F';c++){
//printf(... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | faab3f2643f18b63d409ac887dab1f63 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include <stdio.h>
#include <string.h>
char str[1010][1010];
int cnt[1010][5];
int main(){
int n, m, res = 0;
scanf("%d%d", &n, &m);
int a[m];
for(int i = 0; i < n; i++){
scanf("%s", str[i]);
}
for(int i = 0; i < m; i++) scanf("%d", &a[i]);
for(int i = 0; i < m; i++){
int ... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | 94de37beeb8fa5583d45a40c93b3bb13 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include<stdio.h>
int main(){
int l,k,i=0,j=0,n,m,ar[10000],h[1000],count=0;
char arr[1000][1000];
scanf("%d %d",&n,&m);
k=n;l=m;
while(k--){
scanf("%s",arr[i]);
i++;
}
i=0;
while(l--){
scanf("%d",&ar[i]);
i++;
}
for(i=0;i<m;i++){
for(j=0;j<n;j++){
char c=arr[j][i];
int x=c-65;
// printf... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | 64f5e002e86317bb14f733d7026faa69 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include <stdio.h>
int main()
{
int n, m, i, j, scr[1111]={0}, cnt[1111]={0}, ans=0;
char inp[1111][1111], c;
scanf("%d%d%*c", &n, &m);
for (i=0; i<n; i++)
{
for (j=0; j<m; j++) scanf("%c", &inp[i][j]);
scanf("%c", &c);
}
for (i=0; i<m; i++) scanf("%d", &scr[i]);
for (j=0; j<m; j++)
{
int a=0, b=0, c=0,... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | 905d3ec0659c8dc98bde7beb20892ea8 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include<stdio.h>
#include<string.h>
int main()
{
int q,i,j,pos,marks,res=0,max,count,st;
scanf("%d%d",&st,&q);
char s[q];
int a[q][5];
for(i=0;i<q;i++)
{
for(j=0;j<=4;j++)
a[i][j]=0;
}
for(i=0;i<st;i++)
{
scanf("%s",s);
count=0;
for(j=0;j<q;j++)
{
int asci=(int)s[j];
pos=asc... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | 54eaf6a1613b88ede898bafa426a097f | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include<stdio.h>
#include<conio.h>
#include<string.h>
#include<math.h>
int main()
{
int n,m,i,k,j,a=0,b=0,c=0,d=0,e=0,sum=0;
scanf("%d %d",&n,&m);
int A[m];
char S[n][m];
for(i=0; i<n; i++)
{
scanf("%s",&S[i]);
}
for(i=0; i<m; i++)
{
scanf("%d",&A[i]);
}
for(... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | 1c8d25a49c7f8c5da5a5b813654ccba4 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include <stdio.h>
int max(int m,char s[][m],int k,int n){
int A[5];
int i;
for(i=0;i<5;i++){
A[i]=0;
}
for(i=0;i<n;i++){
switch(s[i][k]){
case 'A' : A[0]++;
break;
case 'B' : A[1]++;
break;
case 'C' : A[2]++;
break;
case 'D' : A[3]++;
break;
case 'E' : A[4]++;
... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | 3fc6031cf442b39ff292007098d2654c | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include <stdio.h>
#include <string.h>
void add(char* s, int a, int num[a][5]);
int max_5(int* table);
int main()
{
int n, m, max_score = 0;
scanf("%d %d\n", &n, &m);
int optimal[1010][5] = {0};
for(int i=0; i<n; i++){
char answers[1010];
scanf("%s\n", answers);
add(answers, m, optimal);
}
int points[101... | |
A class of students wrote a multiple-choice test.There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers ... | Print a single integer — the maximum possible total score of the class. | C | 2022f53e5a88d5833e133dc3608a122c | fca47401f1d5273b01f728c3e20d9156 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"strings"
] | 1564936500 | ["2 4\nABCD\nABCE\n1 2 3 4", "3 3\nABC\nBCD\nCDE\n5 4 12"] | NoteIn the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be $$$16$$$.In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is $$$5 + 4 + 12 = 21$$$. | PASSED | 900 | standard input | 1 second | The first line contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of students in the class and the number of questions in the test. Each of the next $$$n$$$ lines contains string $$$s_i$$$ ($$$|s_i| = m$$$), describing an answer of the $$$i$$$-th student. The $$$j$$$-th character represents ... | ["16", "21"] | #include<stdio.h>
int main(void)
{
int i,j,n,m,max;
scanf("%d %d",&n,&m);
int array[m],total=0;
char string[n][m+2];
for(i=0;i<n;i++)
scanf("%s",string[i]);
for(i=0;i<m;i++)
scanf("%d",&array[i]);
for(i=0;i<m;i++)
{
int freq[26]={0};
for(j=0,max=0;j<n;j++)... | |
Mike wants to prepare for IMO but he doesn't know geometry, so his teacher gave him an interesting geometry problem. Let's define f([l, r]) = r - l + 1 to be the number of integer points in the segment [l, r] with l ≤ r (say that ). You are given two integers n and k and n closed intervals [li, ri] on OX axis and you h... | Print one integer number — the answer to Mike's problem modulo 1000000007 (109 + 7) in the only line. | C | 900c85e25d457eb8092624b1d42be2a2 | 94da845ba29fb807c2749365ce31a090 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"dp",
"geometry",
"combinatorics",
"implementation",
"data structures"
] | 1467822900 | ["3 2\n1 2\n1 3\n2 3", "3 3\n1 3\n1 3\n1 3", "3 1\n1 2\n2 3\n3 4"] | NoteIn the first example: ;;.So the answer is 2 + 1 + 2 = 5. | PASSED | 2,000 | standard input | 3 seconds | The first line contains two integers n and k (1 ≤ k ≤ n ≤ 200 000) — the number of segments and the number of segments in intersection groups respectively. Then n lines follow, the i-th line contains two integers li, ri ( - 109 ≤ li ≤ ri ≤ 109), describing i-th segment bounds. | ["5", "3", "6"] | /* practice with Dukkha */
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#define N 200000
#define MD 1000000007
void init_rand() {
struct timeval tv;
gettimeofday(&tv, NULL);
srand(tv.tv_sec ^ tv.tv_usec);
}
int rand_(int n) {
return (rand() * 76543LL + rand()) % n;
}
int com... | |
There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights in... | Print "YES" without the quotes if the following month will turn out to be lucky. Otherwise, print "NO". | C | d3a0402de1338a1a542a86ac5b484acc | 34184654fb16421248539e7699dd5232 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"dp",
"number theory",
"math"
] | 1301410800 | ["3\n1 1 1", "6\n1 0 1 1 1 0", "6\n1 0 0 1 0 1"] | null | PASSED | 1,600 | standard input | 0.5 second | The first line contains number n, which is the number of knights at the round table (3 ≤ n ≤ 105). The second line contains space-separated moods of all the n knights in the order of passing them around the table. "1" means that the knight is in a good mood an "0" means that he is in a bad mood. | ["YES", "YES", "NO"] | #include <stdio.h>
int knights[100500], n;
char check(int k) {
int start, j;
if(n / k < 3)
return 0;
for(start = 0; start < k; start++) {
char isHappy = 1;
for(j = start; isHappy && j < n; j += k) {
if(knights[j] == 0) {
isHappy = 0;
}
... | |
There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights in... | Print "YES" without the quotes if the following month will turn out to be lucky. Otherwise, print "NO". | C | d3a0402de1338a1a542a86ac5b484acc | 4cdcbc5ba9df034c0a0b54aaa6dc116f | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"dp",
"number theory",
"math"
] | 1301410800 | ["3\n1 1 1", "6\n1 0 1 1 1 0", "6\n1 0 0 1 0 1"] | null | PASSED | 1,600 | standard input | 0.5 second | The first line contains number n, which is the number of knights at the round table (3 ≤ n ≤ 105). The second line contains space-separated moods of all the n knights in the order of passing them around the table. "1" means that the knight is in a good mood an "0" means that he is in a bad mood. | ["YES", "YES", "NO"] | #include<stdio.h>
#include<math.h>
long int n,a[300009];
int check(long int i)
{long int j,cnt=0,k,univ=0;
for(j=0;j<i;j++)
{cnt=0;univ=0;
for(k=j;cnt<n/i;k+=i,cnt++)
{
if(k>n-1)
k-=n;
if(a[k]==0)
{univ=1;break;}
}
if(!univ)
return 1;
}
return 0;
}
int main()
{
long in... | |
There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights in... | Print "YES" without the quotes if the following month will turn out to be lucky. Otherwise, print "NO". | C | d3a0402de1338a1a542a86ac5b484acc | 4735020aabb3b8a855fc0e4dce28c2b2 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"dp",
"number theory",
"math"
] | 1301410800 | ["3\n1 1 1", "6\n1 0 1 1 1 0", "6\n1 0 0 1 0 1"] | null | PASSED | 1,600 | standard input | 0.5 second | The first line contains number n, which is the number of knights at the round table (3 ≤ n ≤ 105). The second line contains space-separated moods of all the n knights in the order of passing them around the table. "1" means that the knight is in a good mood an "0" means that he is in a bad mood. | ["YES", "YES", "NO"] | #include<stdio.h>
#include<stdlib.h>
int main(void){
int n,*knights,i,j,k,flg;
scanf("%d",&n);
knights=(int *)calloc(n,sizeof(int));
for(i=0;i<n;i++) scanf("%d",knights+i);
for(i=1;i<=n/3;i++){//polygon num
flg=0;
if(n%i!=0){
flg=1;
continue;
}
for(j=0;j<i;j++){//begin from?
... | |
There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights in... | Print "YES" without the quotes if the following month will turn out to be lucky. Otherwise, print "NO". | C | d3a0402de1338a1a542a86ac5b484acc | acd0bc48f4bcd05b48e597e20a53a3e8 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"dp",
"number theory",
"math"
] | 1301410800 | ["3\n1 1 1", "6\n1 0 1 1 1 0", "6\n1 0 0 1 0 1"] | null | PASSED | 1,600 | standard input | 0.5 second | The first line contains number n, which is the number of knights at the round table (3 ≤ n ≤ 105). The second line contains space-separated moods of all the n knights in the order of passing them around the table. "1" means that the knight is in a good mood an "0" means that he is in a bad mood. | ["YES", "YES", "NO"] | #include <stdio.h>
int main()
{
int n, i, j, k;
int a[100000];
scanf("%d", &n);
for (i = 0; i < n; i++) scanf("%d", &a[i]);
for (i = 3; i <= n; i++) {
if (n % i > 0) continue;
for (j = 0; j < n / i; j++) {
for (k = 0; j + n / i * k < n; k++) {
if (a[j + n / i * k] == 0)... | |
There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights in... | Print "YES" without the quotes if the following month will turn out to be lucky. Otherwise, print "NO". | C | d3a0402de1338a1a542a86ac5b484acc | 35590d85f881c9d28d33b0cbf43eb760 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"dp",
"number theory",
"math"
] | 1301410800 | ["3\n1 1 1", "6\n1 0 1 1 1 0", "6\n1 0 0 1 0 1"] | null | PASSED | 1,600 | standard input | 0.5 second | The first line contains number n, which is the number of knights at the round table (3 ≤ n ≤ 105). The second line contains space-separated moods of all the n knights in the order of passing them around the table. "1" means that the knight is in a good mood an "0" means that he is in a bad mood. | ["YES", "YES", "NO"] | #include <stdio.h>
#include <stdlib.h>
int n;
int *u;
int deep(int i, int l){
int nb=0;
int j;
int index;
index=(i+l)%n;
j=0;
while (u[(i+l)%n]==1 && nb<n/l){
i+=l;
nb+=1;
j+=1;
}
if (nb==n/l && (i+l)%n==index){
return 1;
}
else{
return 0;
... | |
There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights in... | Print "YES" without the quotes if the following month will turn out to be lucky. Otherwise, print "NO". | C | d3a0402de1338a1a542a86ac5b484acc | 325c89f7edf061f60bc6b853a2feaf6d | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"dp",
"number theory",
"math"
] | 1301410800 | ["3\n1 1 1", "6\n1 0 1 1 1 0", "6\n1 0 0 1 0 1"] | null | PASSED | 1,600 | standard input | 0.5 second | The first line contains number n, which is the number of knights at the round table (3 ≤ n ≤ 105). The second line contains space-separated moods of all the n knights in the order of passing them around the table. "1" means that the knight is in a good mood an "0" means that he is in a bad mood. | ["YES", "YES", "NO"] | #include<stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <ctype.h>
#define MIN(a,b) (a>b?b:a)
int const p=1000000007;
typedef long long ll;
int i,j,n,k,kol,N_nach;
int fl=0;
int flag=0;
ll s,result,min,binom_n;
int mas_del[200]={0},arr[1000000]={0};
ll func_binominal(ll n,ll k)
{
if (k == 0... | |
There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights in... | Print "YES" without the quotes if the following month will turn out to be lucky. Otherwise, print "NO". | C | d3a0402de1338a1a542a86ac5b484acc | f4e05337667baa97c55a3ffd07b1151a | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"dp",
"number theory",
"math"
] | 1301410800 | ["3\n1 1 1", "6\n1 0 1 1 1 0", "6\n1 0 0 1 0 1"] | null | PASSED | 1,600 | standard input | 0.5 second | The first line contains number n, which is the number of knights at the round table (3 ≤ n ≤ 105). The second line contains space-separated moods of all the n knights in the order of passing them around the table. "1" means that the knight is in a good mood an "0" means that he is in a bad mood. | ["YES", "YES", "NO"] | #include <stdio.h>
int b[100000];
void solve(int n)
{
int i, j, k;
for (i = 3; i <= n; i ++)
{
if (n % i == 0)
{
for (j = 0; j < n / i; j ++)
{
for (k = j; k < n; k += n / i)
{
if (b[k] == 0)
{
... | |
There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights in... | Print "YES" without the quotes if the following month will turn out to be lucky. Otherwise, print "NO". | C | d3a0402de1338a1a542a86ac5b484acc | 927a60d367f992fb363de1ceadab1e04 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"dp",
"number theory",
"math"
] | 1301410800 | ["3\n1 1 1", "6\n1 0 1 1 1 0", "6\n1 0 0 1 0 1"] | null | PASSED | 1,600 | standard input | 0.5 second | The first line contains number n, which is the number of knights at the round table (3 ≤ n ≤ 105). The second line contains space-separated moods of all the n knights in the order of passing them around the table. "1" means that the knight is in a good mood an "0" means that he is in a bad mood. | ["YES", "YES", "NO"] | #include <stdio.h>
int v[100000], p[100000];
int main(int argc, char *argv[])
{
int n, k, i, j, l;
scanf("%d", &n);
for(i = 0; i < n; i ++)
scanf("%d", &v[i]);
k = n / 3;
for(i = 1; i <= k; i ++)
if(n % i == 0)
{
l = n / i;
for(j = 0; j < i; j ++)
p[j] = 0;
for(j = 0; j < n; j ++)
p[j %... | |
There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights in... | Print "YES" without the quotes if the following month will turn out to be lucky. Otherwise, print "NO". | C | d3a0402de1338a1a542a86ac5b484acc | 193ba7a88175648e4c98ad08f556e7ab | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"dp",
"number theory",
"math"
] | 1301410800 | ["3\n1 1 1", "6\n1 0 1 1 1 0", "6\n1 0 0 1 0 1"] | null | PASSED | 1,600 | standard input | 0.5 second | The first line contains number n, which is the number of knights at the round table (3 ≤ n ≤ 105). The second line contains space-separated moods of all the n knights in the order of passing them around the table. "1" means that the knight is in a good mood an "0" means that he is in a bad mood. | ["YES", "YES", "NO"] | #include <stdio.h>
int s[100100];
int checker(int l,int d){
int i,k = l/d,answ,z;
for(z=0;z<k;z++){
answ = 1;
for(i=0;i<l;i+=k){ if (!s[i+z]) {answ = 0; break;} }
if (answ) return 1;
}
return 0;
}
/*
* 10
1 1 1 1 0 1 1 1 0 1
*/
int main(){
int n,z,i,d,m=1;
scanf("%... | |
There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights in... | Print "YES" without the quotes if the following month will turn out to be lucky. Otherwise, print "NO". | C | d3a0402de1338a1a542a86ac5b484acc | 3e9984862934888d421564a2f3af6ddc | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"dp",
"number theory",
"math"
] | 1301410800 | ["3\n1 1 1", "6\n1 0 1 1 1 0", "6\n1 0 0 1 0 1"] | null | PASSED | 1,600 | standard input | 0.5 second | The first line contains number n, which is the number of knights at the round table (3 ≤ n ≤ 105). The second line contains space-separated moods of all the n knights in the order of passing them around the table. "1" means that the knight is in a good mood an "0" means that he is in a bad mood. | ["YES", "YES", "NO"] | #include<stdio.h>
int n,a[100020],z;
int main()
{
scanf("%d",&n);
for(int i=0;i<n;i++)
scanf("%d",a+i);
for(int i=1;i<=n/3;i++)
if(n%i==0)
{
for(int j=0;j<i;j++)
{
z=1;
for(int k=j;k<n;k+=i)
z&=a[k];
... | |
Bertown has n junctions and m bidirectional roads. We know that one can get from any junction to any other one by the existing roads. As there were more and more cars in the city, traffic jams started to pose real problems. To deal with them the government decided to make the traffic one-directional on all the roads, t... | If there's no solution, print the single number 0. Otherwise, print m lines each containing two integers pi and qi — each road's orientation. That is the traffic flow will move along a one-directional road from junction pi to junction qi. You can print the roads in any order. If there are several solutions to that prob... | C | 10dfcd079aaa03070f84f4e5d8f414d7 | d1fbb304c843c4ccfb0cedb953328a97 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"dfs and similar",
"graphs"
] | 1317999600 | ["6 8\n1 2\n2 3\n1 3\n4 5\n4 6\n5 6\n2 4\n3 5", "6 7\n1 2\n2 3\n1 3\n4 5\n4 6\n5 6\n2 4"] | null | PASSED | 2,000 | standard input | 5 seconds | The first line contains two space-separated integers n and m (2 ≤ n ≤ 105, n - 1 ≤ m ≤ 3·105) which represent the number of junctions and the roads in the town correspondingly. Then follow m lines, each containing two numbers which describe the roads in the city. Each road is determined by two integers ai and bi (1 ≤ a... | ["1 2\n2 3\n3 1\n4 5\n5 6\n6 4\n4 2\n3 5", "0"] | /* practice with Dukkha */
#include <stdio.h>
#define N 100000
#define M 300000
int min(int a, int b) { return a < b ? a : b; }
int next[1 + M * 2], hh[1 + M * 2];
int link(int l, int h) {
static int l_ = 1;
next[l_] = l;
hh[l_] = h;
return l_++;
}
int ii[M], jj[M];
int ao[N], ta[N], tb[N];
int dfs(int p, in... | |
When Adam gets a rooted tree (connected non-directed graph without cycles), he immediately starts coloring it. More formally, he assigns a color to each edge of the tree so that it meets the following two conditions: There is no vertex that has more than two incident edges painted the same color. For any two vertexe... | Print n integers — the minimum costs of the tree painting after each addition. | C | dd47f47922a5457f89391beea749242b | 1e4ff50f9e10b8c85b814ebaacdfc4af | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"data structures",
"trees"
] | 1403191800 | ["11\n1 1 1 3 4 4 7 3 7 6 6"] | NoteThe figure below shows one of the possible variants to paint a tree from the sample at the last moment. The cost of the vertexes with numbers 11 and 12 equals 3. | PASSED | 2,600 | standard input | 2 seconds | The first line contains integer n (1 ≤ n ≤ 106) — the number of times a new vertex is added. The second line contains n numbers pi (1 ≤ pi ≤ i) — the numbers of the vertexes to which we add another vertex. | ["1 1 1 1 1 2 2 2 2 2 3"] | #include <stdio.h>
#include <string.h>
#define size 1000001
int max1[size], max2[size], ans[size], parent[size];
void swap(int* i, int*j)
{
int t = *i;
*i = *j;
*j = t;
}
int max(int x, int y)
{
return (x > y) ? x : y;
}
int main(int argc, const char *argv[])
{
int i, n, num = 1, node;
mem... | |
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mike's hands are on his ears (since he's the judge) and each bear standing in the ... | After each round, print the current score of the bears. | C | 337b6d2a11a25ef917809e6409f8edef | fd8dbd00a0e18f395b563c2925c731a0 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"dp",
"implementation",
"greedy",
"brute force"
] | 1432658100 | ["5 4 5\n0 1 1 0\n1 0 0 1\n0 1 1 0\n1 0 0 1\n0 0 0 0\n1 1\n1 4\n1 1\n4 2\n4 3"] | null | PASSED | 1,400 | standard input | 2 seconds | The first line of input contains three integers n, m and q (1 ≤ n, m ≤ 500 and 1 ≤ q ≤ 5000). The next n lines contain the grid description. There are m integers separated by spaces in each line. Each of these numbers is either 0 (for mouth) or 1 (for eyes). The next q lines contain the information about the rounds. Ea... | ["3\n4\n3\n3\n4"] | #include<stdio.h>
int findmax(int a[],int n)
{
int i,max=0;
for(i=1;i<=n;i++)
if(max<a[i])
max=a[i];
return max;
}
int main()
{
int i,j,k,arr[501][501],maximum[501];
int n,m,q,count,a,b;
scanf("%d%d%d",&n,&m,&q);
for(i=1;i<=n;i++){
for(j=1;j<=m;j++)
{scanf("%d",&arr[i][j]);
}
... | |
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mike's hands are on his ears (since he's the judge) and each bear standing in the ... | After each round, print the current score of the bears. | C | 337b6d2a11a25ef917809e6409f8edef | 1dc5324040ba231bcf5cd0f4d55c90b1 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"dp",
"implementation",
"greedy",
"brute force"
] | 1432658100 | ["5 4 5\n0 1 1 0\n1 0 0 1\n0 1 1 0\n1 0 0 1\n0 0 0 0\n1 1\n1 4\n1 1\n4 2\n4 3"] | null | PASSED | 1,400 | standard input | 2 seconds | The first line of input contains three integers n, m and q (1 ≤ n, m ≤ 500 and 1 ≤ q ≤ 5000). The next n lines contain the grid description. There are m integers separated by spaces in each line. Each of these numbers is either 0 (for mouth) or 1 (for eyes). The next q lines contain the information about the rounds. Ea... | ["3\n4\n3\n3\n4"] | #include <stdio.h>
#include <string.h>
#define max(a, b) (a > b) ? (a) : (b);
int R, C, Q;
int grid[502][502], sum[502];
void init();
int maxConsecutive(int r);
int maxConsecutiveRow(int row);
int main()
{
int i, r, c;
scanf("%d %d %d", &R, &C, &Q);
for(r = 1; r <= R; r++) {
for(c = 1; c <= C; c++) {
scanf(... | |
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mike's hands are on his ears (since he's the judge) and each bear standing in the ... | After each round, print the current score of the bears. | C | 337b6d2a11a25ef917809e6409f8edef | 014eaf33b182a5ac7530c5b5aa39a362 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"dp",
"implementation",
"greedy",
"brute force"
] | 1432658100 | ["5 4 5\n0 1 1 0\n1 0 0 1\n0 1 1 0\n1 0 0 1\n0 0 0 0\n1 1\n1 4\n1 1\n4 2\n4 3"] | null | PASSED | 1,400 | standard input | 2 seconds | The first line of input contains three integers n, m and q (1 ≤ n, m ≤ 500 and 1 ≤ q ≤ 5000). The next n lines contain the grid description. There are m integers separated by spaces in each line. Each of these numbers is either 0 (for mouth) or 1 (for eyes). The next q lines contain the information about the rounds. Ea... | ["3\n4\n3\n3\n4"] | #include<stdio.h>
#include<limits.h>
int maxrow;
int maximum(int * k,int n){
int i,max=k[0];
maxrow=1;
for(i=1;i<n;i++){
if(max<k[i]){
max=k[i];
maxrow=i+1;
}
}
return max;
}
int
main ()
{
int n, m, q;
scanf ("%d %d %d", &n, &m, &q);
int max = INT_MIN, i, j,... | |
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mike's hands are on his ears (since he's the judge) and each bear standing in the ... | After each round, print the current score of the bears. | C | 337b6d2a11a25ef917809e6409f8edef | 580407439debd637c2fb63d24e4f20a8 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"dp",
"implementation",
"greedy",
"brute force"
] | 1432658100 | ["5 4 5\n0 1 1 0\n1 0 0 1\n0 1 1 0\n1 0 0 1\n0 0 0 0\n1 1\n1 4\n1 1\n4 2\n4 3"] | null | PASSED | 1,400 | standard input | 2 seconds | The first line of input contains three integers n, m and q (1 ≤ n, m ≤ 500 and 1 ≤ q ≤ 5000). The next n lines contain the grid description. There are m integers separated by spaces in each line. Each of these numbers is either 0 (for mouth) or 1 (for eyes). The next q lines contain the information about the rounds. Ea... | ["3\n4\n3\n3\n4"] | #include<stdio.h>
int main()
{
int n, m, q;
int a[500][500];
int a_max[500];
int i, j, count, max, ov_max, x, y;
scanf("%d %d %d", &n, &m, &q);
for(i=0; i<n; i++)
{
max = 0;
count = 0;
for(j=0; j<m; j++)
{
scanf("%d", &a[i][j]);
... | |
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mike's hands are on his ears (since he's the judge) and each bear standing in the ... | After each round, print the current score of the bears. | C | 337b6d2a11a25ef917809e6409f8edef | 07cedcea7c728a928d4ba8a333e58606 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"dp",
"implementation",
"greedy",
"brute force"
] | 1432658100 | ["5 4 5\n0 1 1 0\n1 0 0 1\n0 1 1 0\n1 0 0 1\n0 0 0 0\n1 1\n1 4\n1 1\n4 2\n4 3"] | null | PASSED | 1,400 | standard input | 2 seconds | The first line of input contains three integers n, m and q (1 ≤ n, m ≤ 500 and 1 ≤ q ≤ 5000). The next n lines contain the grid description. There are m integers separated by spaces in each line. Each of these numbers is either 0 (for mouth) or 1 (for eyes). The next q lines contain the information about the rounds. Ea... | ["3\n4\n3\n3\n4"] | #include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <string.h>
/* CF305Div2 - B*/
int be[512][512];
int nb[512];
static void
do_bear(int r, int c, int k)
{
int i, j;
int sr, sc;
while (k--) {
int cnt = 0;
int max = 0;
scanf("%d%d", &sr, &sc);
be[sr][sc] ^= 1;
for (i = 1; i <= c; i++) {... | |
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mike's hands are on his ears (since he's the judge) and each bear standing in the ... | After each round, print the current score of the bears. | C | 337b6d2a11a25ef917809e6409f8edef | fca0a8315651405ae0b1c0bc90b165ff | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"dp",
"implementation",
"greedy",
"brute force"
] | 1432658100 | ["5 4 5\n0 1 1 0\n1 0 0 1\n0 1 1 0\n1 0 0 1\n0 0 0 0\n1 1\n1 4\n1 1\n4 2\n4 3"] | null | PASSED | 1,400 | standard input | 2 seconds | The first line of input contains three integers n, m and q (1 ≤ n, m ≤ 500 and 1 ≤ q ≤ 5000). The next n lines contain the grid description. There are m integers separated by spaces in each line. Each of these numbers is either 0 (for mouth) or 1 (for eyes). The next q lines contain the information about the rounds. Ea... | ["3\n4\n3\n3\n4"] | #include<stdio.h>
int main() {
int n, m, q, M[500][500], A[500], i, j, x, y, rmax, max ,Max;
scanf("%d %d %d", &n, &m, &q);
for(i = 0; i < n; i++) {
rmax = max = 0;
for(j = 0; j < m; j++) {
scanf("%d", &M[i][j]);
if(M[i][j]) {
max++;
} else {
max = 0;
}
if(max > rmax) {
rmax = max;
... | |
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mike's hands are on his ears (since he's the judge) and each bear standing in the ... | After each round, print the current score of the bears. | C | 337b6d2a11a25ef917809e6409f8edef | d487b0846c0fab55b995f4bb24279783 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"dp",
"implementation",
"greedy",
"brute force"
] | 1432658100 | ["5 4 5\n0 1 1 0\n1 0 0 1\n0 1 1 0\n1 0 0 1\n0 0 0 0\n1 1\n1 4\n1 1\n4 2\n4 3"] | null | PASSED | 1,400 | standard input | 2 seconds | The first line of input contains three integers n, m and q (1 ≤ n, m ≤ 500 and 1 ≤ q ≤ 5000). The next n lines contain the grid description. There are m integers separated by spaces in each line. Each of these numbers is either 0 (for mouth) or 1 (for eyes). The next q lines contain the information about the rounds. Ea... | ["3\n4\n3\n3\n4"] | #include<stdio.h>
int main()
{
int n,m,q,temp,len,len1,row,i,j,i1,j1,a,rows;
scanf("%d %d %d",&n,&m,&q);
int arr[n+2][m+3];
for(i=1; i<=n; i++)
{
for(j=1; j<=m; j++)
{
scanf("%d",&arr[i][j]);
}
}
for(a=0; a<q; a++)
{
scanf("%d %d",&i1,&j1)... | |
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mike's hands are on his ears (since he's the judge) and each bear standing in the ... | After each round, print the current score of the bears. | C | 337b6d2a11a25ef917809e6409f8edef | 343bb78d709ee0efcd670f9c75177bb7 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"dp",
"implementation",
"greedy",
"brute force"
] | 1432658100 | ["5 4 5\n0 1 1 0\n1 0 0 1\n0 1 1 0\n1 0 0 1\n0 0 0 0\n1 1\n1 4\n1 1\n4 2\n4 3"] | null | PASSED | 1,400 | standard input | 2 seconds | The first line of input contains three integers n, m and q (1 ≤ n, m ≤ 500 and 1 ≤ q ≤ 5000). The next n lines contain the grid description. There are m integers separated by spaces in each line. Each of these numbers is either 0 (for mouth) or 1 (for eyes). The next q lines contain the information about the rounds. Ea... | ["3\n4\n3\n3\n4"] | #include<stdio.h>
#include<math.h>
int aray[510][510];
int m;
int func(int n)
{
int i, j ,sum=0, hold=0, n0=0;
if(m<=2){
if(m==1 && aray[n][0]==0){
return 0;
}
else if(m==1 && aray[n][0]==1){
return 1;
}
else{
if(aray[n][0]==1 && aray[n... | |
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mike's hands are on his ears (since he's the judge) and each bear standing in the ... | After each round, print the current score of the bears. | C | 337b6d2a11a25ef917809e6409f8edef | 37e0494db0ae755c7cffc84b57382299 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"dp",
"implementation",
"greedy",
"brute force"
] | 1432658100 | ["5 4 5\n0 1 1 0\n1 0 0 1\n0 1 1 0\n1 0 0 1\n0 0 0 0\n1 1\n1 4\n1 1\n4 2\n4 3"] | null | PASSED | 1,400 | standard input | 2 seconds | The first line of input contains three integers n, m and q (1 ≤ n, m ≤ 500 and 1 ≤ q ≤ 5000). The next n lines contain the grid description. There are m integers separated by spaces in each line. Each of these numbers is either 0 (for mouth) or 1 (for eyes). The next q lines contain the information about the rounds. Ea... | ["3\n4\n3\n3\n4"] | #include <stdio.h>
int main (void) {
int atto[501][502];
int a, b, c;
int t1,t2;
int k1, k2;
int j1,j2,nit,pib;
scanf("%d %d %d", &a , &b, &c);
for(t1=1; t1<=a; t1++) {
for(t2=1; t2<=b; t2++) {
scanf("%d", &atto[t1][t2]);
}
}
for(t2=1; t2<=a; t2++) atto... | |
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mike's hands are on his ears (since he's the judge) and each bear standing in the ... | After each round, print the current score of the bears. | C | 337b6d2a11a25ef917809e6409f8edef | 60c811bf4b9ace46aa1defb6111fbc78 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"dp",
"implementation",
"greedy",
"brute force"
] | 1432658100 | ["5 4 5\n0 1 1 0\n1 0 0 1\n0 1 1 0\n1 0 0 1\n0 0 0 0\n1 1\n1 4\n1 1\n4 2\n4 3"] | null | PASSED | 1,400 | standard input | 2 seconds | The first line of input contains three integers n, m and q (1 ≤ n, m ≤ 500 and 1 ≤ q ≤ 5000). The next n lines contain the grid description. There are m integers separated by spaces in each line. Each of these numbers is either 0 (for mouth) or 1 (for eyes). The next q lines contain the information about the rounds. Ea... | ["3\n4\n3\n3\n4"] | #include<stdio.h>
int a[500][500]={0};
int n,m,q;
void printmax(void){
int i,j,k,max=0;
for(i=0;i<n;i++){
for(j=0,k=0;j<m;j++){
if(a[i][j]==1)
k+=a[i][j];
else
k=0;
if(k>=max)
max=k;
}
}
printf("%d\n",max);
return;
}
int main(void){
int i,j,k;
scanf("%d %d %d",&n,&m,&q);
for(i=0;i<n;i++){
for(... | |
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mike's hands are on his ears (since he's the judge) and each bear standing in the ... | After each round, print the current score of the bears. | C | 337b6d2a11a25ef917809e6409f8edef | 40709b6a8af0eab852d729438ec53800 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"dp",
"implementation",
"greedy",
"brute force"
] | 1432658100 | ["5 4 5\n0 1 1 0\n1 0 0 1\n0 1 1 0\n1 0 0 1\n0 0 0 0\n1 1\n1 4\n1 1\n4 2\n4 3"] | null | PASSED | 1,400 | standard input | 2 seconds | The first line of input contains three integers n, m and q (1 ≤ n, m ≤ 500 and 1 ≤ q ≤ 5000). The next n lines contain the grid description. There are m integers separated by spaces in each line. Each of these numbers is either 0 (for mouth) or 1 (for eyes). The next q lines contain the information about the rounds. Ea... | ["3\n4\n3\n3\n4"] | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
typedef long long ll;
int n,m,q;
bool a[500][500];
int ans[500];
int get(int r)
{
int i,j=0,k=0;
for(i=0;i<m;i++)
{
if(a[r][i])j++;
else
{
j=0;
}
if(j>k)k=j;
}
return k... | |
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mike's hands are on his ears (since he's the judge) and each bear standing in the ... | After each round, print the current score of the bears. | C | 337b6d2a11a25ef917809e6409f8edef | 7ecfb863793d62f8ec3b4b01e9970de6 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"dp",
"implementation",
"greedy",
"brute force"
] | 1432658100 | ["5 4 5\n0 1 1 0\n1 0 0 1\n0 1 1 0\n1 0 0 1\n0 0 0 0\n1 1\n1 4\n1 1\n4 2\n4 3"] | null | PASSED | 1,400 | standard input | 2 seconds | The first line of input contains three integers n, m and q (1 ≤ n, m ≤ 500 and 1 ≤ q ≤ 5000). The next n lines contain the grid description. There are m integers separated by spaces in each line. Each of these numbers is either 0 (for mouth) or 1 (for eyes). The next q lines contain the information about the rounds. Ea... | ["3\n4\n3\n3\n4"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int m, n, q, i, j, mmax = 0, x, y, ans;
scanf("%d %d %d", &n, &m, &q);
int arr[n][m], max[n];
for (i = 0; i < n; i++){
max[i] = 0; ans = 0;
for (j = 0; j < m; j++){
scanf("%d", &arr[i][j]);
if (arr[i][j]) ans++;... | |
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mike's hands are on his ears (since he's the judge) and each bear standing in the ... | After each round, print the current score of the bears. | C | 337b6d2a11a25ef917809e6409f8edef | bd14a191f6a876ef4dad9479cd9d1ba0 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"dp",
"implementation",
"greedy",
"brute force"
] | 1432658100 | ["5 4 5\n0 1 1 0\n1 0 0 1\n0 1 1 0\n1 0 0 1\n0 0 0 0\n1 1\n1 4\n1 1\n4 2\n4 3"] | null | PASSED | 1,400 | standard input | 2 seconds | The first line of input contains three integers n, m and q (1 ≤ n, m ≤ 500 and 1 ≤ q ≤ 5000). The next n lines contain the grid description. There are m integers separated by spaces in each line. Each of these numbers is either 0 (for mouth) or 1 (for eyes). The next q lines contain the information about the rounds. Ea... | ["3\n4\n3\n3\n4"] | #include<stdio.h>
int main()
{
int n,m,q,temp,len,len1,row,i,j,i1,j1,a,rows;
scanf("%d %d %d",&n,&m,&q);
int arr[n+2][m+3];
for(i=1; i<=n; i++)
{
for(j=1; j<=m; j++)
{
scanf("%d",&arr[i][j]);
}
}
for(a=0; a<q; a++)
{
scanf("%d %d",&i1,&j1)... | |
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mike's hands are on his ears (since he's the judge) and each bear standing in the ... | After each round, print the current score of the bears. | C | 337b6d2a11a25ef917809e6409f8edef | 35b1c89d8601853deceda75821ada590 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"dp",
"implementation",
"greedy",
"brute force"
] | 1432658100 | ["5 4 5\n0 1 1 0\n1 0 0 1\n0 1 1 0\n1 0 0 1\n0 0 0 0\n1 1\n1 4\n1 1\n4 2\n4 3"] | null | PASSED | 1,400 | standard input | 2 seconds | The first line of input contains three integers n, m and q (1 ≤ n, m ≤ 500 and 1 ≤ q ≤ 5000). The next n lines contain the grid description. There are m integers separated by spaces in each line. Each of these numbers is either 0 (for mouth) or 1 (for eyes). The next q lines contain the information about the rounds. Ea... | ["3\n4\n3\n3\n4"] | #include<stdio.h>
int a[500][502];
int check(x,m)
{
int count=0,max=0,i;
for(i=0;i<m;i++)
{
if(a[x][i]==1)
{
while(a[x][i]==1)
{
count++;
i++;
}
if(count>max)
max=count;
count=0;
}
}
return max;
}
int main()
{
int n,m,q,i,j,max,x,y,count,ans;
scanf("%d%d%d",&n,&m,&q);
int p[n];... | |
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mike's hands are on his ears (since he's the judge) and each bear standing in the ... | After each round, print the current score of the bears. | C | 337b6d2a11a25ef917809e6409f8edef | 2623d37b32ca5978622faa2e0a291bdf | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"dp",
"implementation",
"greedy",
"brute force"
] | 1432658100 | ["5 4 5\n0 1 1 0\n1 0 0 1\n0 1 1 0\n1 0 0 1\n0 0 0 0\n1 1\n1 4\n1 1\n4 2\n4 3"] | null | PASSED | 1,400 | standard input | 2 seconds | The first line of input contains three integers n, m and q (1 ≤ n, m ≤ 500 and 1 ≤ q ≤ 5000). The next n lines contain the grid description. There are m integers separated by spaces in each line. Each of these numbers is either 0 (for mouth) or 1 (for eyes). The next q lines contain the information about the rounds. Ea... | ["3\n4\n3\n3\n4"] | #include <stdio.h>
#include <string.h>
int main()
{
int a,b,c,d,e,f,i,j,k,p=0,q=0,r,count=0,max=0,count1=0,max1=0;
int x[502][502],y[502];
scanf("%d %d %d",&a,&b,&c);
for(i=0;i<502;i++)
{
y[i]=0;
}
for(i... | |
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mike's hands are on his ears (since he's the judge) and each bear standing in the ... | After each round, print the current score of the bears. | C | 337b6d2a11a25ef917809e6409f8edef | 50dab3f595459c43c79c69c9936cc414 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"dp",
"implementation",
"greedy",
"brute force"
] | 1432658100 | ["5 4 5\n0 1 1 0\n1 0 0 1\n0 1 1 0\n1 0 0 1\n0 0 0 0\n1 1\n1 4\n1 1\n4 2\n4 3"] | null | PASSED | 1,400 | standard input | 2 seconds | The first line of input contains three integers n, m and q (1 ≤ n, m ≤ 500 and 1 ≤ q ≤ 5000). The next n lines contain the grid description. There are m integers separated by spaces in each line. Each of these numbers is either 0 (for mouth) or 1 (for eyes). The next q lines contain the information about the rounds. Ea... | ["3\n4\n3\n3\n4"] | #include<stdio.h>
#include<string.h>
#define N 550
int max(int a,int b)
{
return a>b?a:b;
}
int main()
{
int n,m,q;
int i,y,t;
int maxn;
int map[N][N];
int ans[N];
//freopen("in.txt","r",stdin);
scanf("%d%d%d",&n,&m,&q);
memset(ans,0,sizeof(ans));
for(i=1;i<=n;i++)
{
... | |
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mike's hands are on his ears (since he's the judge) and each bear standing in the ... | After each round, print the current score of the bears. | C | 337b6d2a11a25ef917809e6409f8edef | 46ac3e8698c06f3db7b2cd5ceea4c11a | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"dp",
"implementation",
"greedy",
"brute force"
] | 1432658100 | ["5 4 5\n0 1 1 0\n1 0 0 1\n0 1 1 0\n1 0 0 1\n0 0 0 0\n1 1\n1 4\n1 1\n4 2\n4 3"] | null | PASSED | 1,400 | standard input | 2 seconds | The first line of input contains three integers n, m and q (1 ≤ n, m ≤ 500 and 1 ≤ q ≤ 5000). The next n lines contain the grid description. There are m integers separated by spaces in each line. Each of these numbers is either 0 (for mouth) or 1 (for eyes). The next q lines contain the information about the rounds. Ea... | ["3\n4\n3\n3\n4"] | #include<stdio.h>
int main()
{
int i,j,n,m,q,a[510][510],c1,c2,k;
long long int max=0,sum[510],tsum=0;
scanf("%d%d%d",&n,&m,&q);
for(i=1;i<=n;i++)
{
sum[i]=0;
tsum=0;
for(j=1;j<=m;j++)
{
... | |
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mike's hands are on his ears (since he's the judge) and each bear standing in the ... | After each round, print the current score of the bears. | C | 337b6d2a11a25ef917809e6409f8edef | 91a027005f19881963fbf3a021af1b76 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"dp",
"implementation",
"greedy",
"brute force"
] | 1432658100 | ["5 4 5\n0 1 1 0\n1 0 0 1\n0 1 1 0\n1 0 0 1\n0 0 0 0\n1 1\n1 4\n1 1\n4 2\n4 3"] | null | PASSED | 1,400 | standard input | 2 seconds | The first line of input contains three integers n, m and q (1 ≤ n, m ≤ 500 and 1 ≤ q ≤ 5000). The next n lines contain the grid description. There are m integers separated by spaces in each line. Each of these numbers is either 0 (for mouth) or 1 (for eyes). The next q lines contain the information about the rounds. Ea... | ["3\n4\n3\n3\n4"] | #include<stdio.h>
int main()
{
int a[500][500],m,n,i,j,q,max,k,l,p,r;
int b[500]={};
scanf("%d%d%d",&m,&n,&q);
p=n;
r=m;
for(i=0;i<m;i++)
for(j=0;j<n;j++)
scanf("%d",&a[i][j]);
for(i=0;i<m;i++)
{
l=0;
k=0;
for(j=0;j<n;j++)
{
... | |
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mike's hands are on his ears (since he's the judge) and each bear standing in the ... | After each round, print the current score of the bears. | C | 337b6d2a11a25ef917809e6409f8edef | 5698e830f2fd54922357a47e4fd48ae7 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"dp",
"implementation",
"greedy",
"brute force"
] | 1432658100 | ["5 4 5\n0 1 1 0\n1 0 0 1\n0 1 1 0\n1 0 0 1\n0 0 0 0\n1 1\n1 4\n1 1\n4 2\n4 3"] | null | PASSED | 1,400 | standard input | 2 seconds | The first line of input contains three integers n, m and q (1 ≤ n, m ≤ 500 and 1 ≤ q ≤ 5000). The next n lines contain the grid description. There are m integers separated by spaces in each line. Each of these numbers is either 0 (for mouth) or 1 (for eyes). The next q lines contain the information about the rounds. Ea... | ["3\n4\n3\n3\n4"] | #include <stdio.h>
int findmax(int *a,int n)
{
int i;
int max=0;
for (i=0;i<n;i++)
{
if (a[i]>max)
{
max = a[i];
}
}
return max;
}
int main()
{
int n,m,q;
scanf("%d %d %d",&n,&m,&q);
int grid[n][m];
int ans[n];
int i,j;
... | |
Three years have passes and nothing changed. It is still raining in London, and Mr. Black has to close all the doors in his home in order to not be flooded. Once, however, Mr. Black became so nervous that he opened one door, then another, then one more and so on until he opened all the doors in his house.There are exac... | Print the smallest integer $$$k$$$ such that after Mr. Black opened the first $$$k$$$ doors, he was able to exit the house. | C | 653455bb6762effbf7358d75660a7689 | d38094efa6e73e6c5c7f16dfb0ba3f9c | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1553965800 | ["5\n0 0 1 0 0", "4\n1 0 0 1"] | NoteIn the first example the first two doors are from the left exit, so when Mr. Black opened both of them only, there were two more closed door in the left exit and one closed door in the right exit. So Mr. Black wasn't able to exit at that moment.When he opened the third door, all doors from the right exit became ope... | PASSED | 800 | standard input | 1 second | The first line contains integer $$$n$$$ ($$$2 \le n \le 200\,000$$$) — the number of doors. The next line contains $$$n$$$ integers: the sequence in which Mr. Black opened the doors. The $$$i$$$-th of these integers is equal to $$$0$$$ in case the $$$i$$$-th opened door is located in the left exit, and it is equal to $... | ["3", "3"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int n;
scanf("%d",&n);
int arr[n];int ctr1=0,ctr2=0;
for(int i=0;i<n;i++)
scanf("%d",&arr[i]);int temp1=0,temp2=0;
for(int i=0;i<n;i++){
if(arr[i]==0)
ctr1++;
else
ctr2++;
}
for(int i=0;i<n;i++)
... | |
Three years have passes and nothing changed. It is still raining in London, and Mr. Black has to close all the doors in his home in order to not be flooded. Once, however, Mr. Black became so nervous that he opened one door, then another, then one more and so on until he opened all the doors in his house.There are exac... | Print the smallest integer $$$k$$$ such that after Mr. Black opened the first $$$k$$$ doors, he was able to exit the house. | C | 653455bb6762effbf7358d75660a7689 | 16143100bc2085afc932f6b867069a6a | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1553965800 | ["5\n0 0 1 0 0", "4\n1 0 0 1"] | NoteIn the first example the first two doors are from the left exit, so when Mr. Black opened both of them only, there were two more closed door in the left exit and one closed door in the right exit. So Mr. Black wasn't able to exit at that moment.When he opened the third door, all doors from the right exit became ope... | PASSED | 800 | standard input | 1 second | The first line contains integer $$$n$$$ ($$$2 \le n \le 200\,000$$$) — the number of doors. The next line contains $$$n$$$ integers: the sequence in which Mr. Black opened the doors. The $$$i$$$-th of these integers is equal to $$$0$$$ in case the $$$i$$$-th opened door is located in the left exit, and it is equal to $... | ["3", "3"] | #include<stdio.h>
int main()
{
int n;
scanf("%d", &n);
int a[n], x[2]={0}, y[2]={0}, c=0;
int i=0;
for(i=0;i<n;i++)
scanf("%d", &a[i]);
for(i=0;i<n;i++)
x[a[i]]++;
for(i=0;i<n;i++)
{
y[a[i]]++;
c++;
if(x[0]==y[0] || x[1]==y[1]) break;
}
printf("%d", c);
return 0;
} | |
Three years have passes and nothing changed. It is still raining in London, and Mr. Black has to close all the doors in his home in order to not be flooded. Once, however, Mr. Black became so nervous that he opened one door, then another, then one more and so on until he opened all the doors in his house.There are exac... | Print the smallest integer $$$k$$$ such that after Mr. Black opened the first $$$k$$$ doors, he was able to exit the house. | C | 653455bb6762effbf7358d75660a7689 | ba1085ab2b7f3a13f9aded16e4cf7791 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1553965800 | ["5\n0 0 1 0 0", "4\n1 0 0 1"] | NoteIn the first example the first two doors are from the left exit, so when Mr. Black opened both of them only, there were two more closed door in the left exit and one closed door in the right exit. So Mr. Black wasn't able to exit at that moment.When he opened the third door, all doors from the right exit became ope... | PASSED | 800 | standard input | 1 second | The first line contains integer $$$n$$$ ($$$2 \le n \le 200\,000$$$) — the number of doors. The next line contains $$$n$$$ integers: the sequence in which Mr. Black opened the doors. The $$$i$$$-th of these integers is equal to $$$0$$$ in case the $$$i$$$-th opened door is located in the left exit, and it is equal to $... | ["3", "3"] | #include<stdio.h>
int main()
{
int i,n,c=0,d=0,nzf[200001],l=0,r=0;
scanf("%d",&n);
for(i=0; i<n; i++)
{
scanf("%d",&nzf[i]);
if(nzf[i]==0)
c++;
else if(nzf[i]==1)
d++;
}
for(i=0; i<n; i++)
{
if(nzf[i]==0)
{
l++;
... | |
Three years have passes and nothing changed. It is still raining in London, and Mr. Black has to close all the doors in his home in order to not be flooded. Once, however, Mr. Black became so nervous that he opened one door, then another, then one more and so on until he opened all the doors in his house.There are exac... | Print the smallest integer $$$k$$$ such that after Mr. Black opened the first $$$k$$$ doors, he was able to exit the house. | C | 653455bb6762effbf7358d75660a7689 | 00ba609363f1adf9583d8c04f9d22c54 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1553965800 | ["5\n0 0 1 0 0", "4\n1 0 0 1"] | NoteIn the first example the first two doors are from the left exit, so when Mr. Black opened both of them only, there were two more closed door in the left exit and one closed door in the right exit. So Mr. Black wasn't able to exit at that moment.When he opened the third door, all doors from the right exit became ope... | PASSED | 800 | standard input | 1 second | The first line contains integer $$$n$$$ ($$$2 \le n \le 200\,000$$$) — the number of doors. The next line contains $$$n$$$ integers: the sequence in which Mr. Black opened the doors. The $$$i$$$-th of these integers is equal to $$$0$$$ in case the $$$i$$$-th opened door is located in the left exit, and it is equal to $... | ["3", "3"] | #include<stdio.h>
int a[200002];
int main()
{
int i,j,m,n,b=0,c=0;
scanf("%d",&m);
for(i=1;i<=m;i++){
scanf("%d",&a[i]);
if(a[i]==1){
c=i;
}else{
b=i;
}
}
if(b<=c){
printf("%d",b);
}else{
printf("%d",c);
}
return 0;
}
| |
Three years have passes and nothing changed. It is still raining in London, and Mr. Black has to close all the doors in his home in order to not be flooded. Once, however, Mr. Black became so nervous that he opened one door, then another, then one more and so on until he opened all the doors in his house.There are exac... | Print the smallest integer $$$k$$$ such that after Mr. Black opened the first $$$k$$$ doors, he was able to exit the house. | C | 653455bb6762effbf7358d75660a7689 | ab8a2953ee349d8694e3bd4ae41b4c00 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1553965800 | ["5\n0 0 1 0 0", "4\n1 0 0 1"] | NoteIn the first example the first two doors are from the left exit, so when Mr. Black opened both of them only, there were two more closed door in the left exit and one closed door in the right exit. So Mr. Black wasn't able to exit at that moment.When he opened the third door, all doors from the right exit became ope... | PASSED | 800 | standard input | 1 second | The first line contains integer $$$n$$$ ($$$2 \le n \le 200\,000$$$) — the number of doors. The next line contains $$$n$$$ integers: the sequence in which Mr. Black opened the doors. The $$$i$$$-th of these integers is equal to $$$0$$$ in case the $$$i$$$-th opened door is located in the left exit, and it is equal to $... | ["3", "3"] | #include<stdio.h>
int main()
{
int n,c=0,k=0,i;
scanf("%d",&n);
int a[n];
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
if(a[i]==0)
{
c=i+1;
}
else if(a[i]==1)
{
k=i+1;
}
... | |
Three years have passes and nothing changed. It is still raining in London, and Mr. Black has to close all the doors in his home in order to not be flooded. Once, however, Mr. Black became so nervous that he opened one door, then another, then one more and so on until he opened all the doors in his house.There are exac... | Print the smallest integer $$$k$$$ such that after Mr. Black opened the first $$$k$$$ doors, he was able to exit the house. | C | 653455bb6762effbf7358d75660a7689 | a047c49902474a11a745fc49162d8228 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1553965800 | ["5\n0 0 1 0 0", "4\n1 0 0 1"] | NoteIn the first example the first two doors are from the left exit, so when Mr. Black opened both of them only, there were two more closed door in the left exit and one closed door in the right exit. So Mr. Black wasn't able to exit at that moment.When he opened the third door, all doors from the right exit became ope... | PASSED | 800 | standard input | 1 second | The first line contains integer $$$n$$$ ($$$2 \le n \le 200\,000$$$) — the number of doors. The next line contains $$$n$$$ integers: the sequence in which Mr. Black opened the doors. The $$$i$$$-th of these integers is equal to $$$0$$$ in case the $$$i$$$-th opened door is located in the left exit, and it is equal to $... | ["3", "3"] | #include <stdio.h>
#include <stdlib.h>
#define min(a, b) (((a) < (b)) ? (a) : (b))
int main()
{
int a = 0, b = 0, la = 0, lb = 0, i = 0, n, x;
scanf("%d", &n);
for (; i < n; i++)
{
scanf("%d", &x);
if (x == 0) a++, la = i+1;
else b++, lb=i+1;
}
printf("%d\n", min(la, lb... | |
Three years have passes and nothing changed. It is still raining in London, and Mr. Black has to close all the doors in his home in order to not be flooded. Once, however, Mr. Black became so nervous that he opened one door, then another, then one more and so on until he opened all the doors in his house.There are exac... | Print the smallest integer $$$k$$$ such that after Mr. Black opened the first $$$k$$$ doors, he was able to exit the house. | C | 653455bb6762effbf7358d75660a7689 | 06b939ba3bf33930699548171e0a7124 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1553965800 | ["5\n0 0 1 0 0", "4\n1 0 0 1"] | NoteIn the first example the first two doors are from the left exit, so when Mr. Black opened both of them only, there were two more closed door in the left exit and one closed door in the right exit. So Mr. Black wasn't able to exit at that moment.When he opened the third door, all doors from the right exit became ope... | PASSED | 800 | standard input | 1 second | The first line contains integer $$$n$$$ ($$$2 \le n \le 200\,000$$$) — the number of doors. The next line contains $$$n$$$ integers: the sequence in which Mr. Black opened the doors. The $$$i$$$-th of these integers is equal to $$$0$$$ in case the $$$i$$$-th opened door is located in the left exit, and it is equal to $... | ["3", "3"] | #include <stdio.h>
int main(void)
{
int a[200010];
int n, i;
scanf("%d", &n);
for(i = 1; i <= n; i++)
{
scanf("%d", &a[i]);
}
for(i = n-1; i > 0; i--)
{
if(a[i] != a[i+1])
{
printf("%d\n", i);
break;
}
}
return 0;
} | |
Three years have passes and nothing changed. It is still raining in London, and Mr. Black has to close all the doors in his home in order to not be flooded. Once, however, Mr. Black became so nervous that he opened one door, then another, then one more and so on until he opened all the doors in his house.There are exac... | Print the smallest integer $$$k$$$ such that after Mr. Black opened the first $$$k$$$ doors, he was able to exit the house. | C | 653455bb6762effbf7358d75660a7689 | fe9939168352ed6b8003f23885c1c16a | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1553965800 | ["5\n0 0 1 0 0", "4\n1 0 0 1"] | NoteIn the first example the first two doors are from the left exit, so when Mr. Black opened both of them only, there were two more closed door in the left exit and one closed door in the right exit. So Mr. Black wasn't able to exit at that moment.When he opened the third door, all doors from the right exit became ope... | PASSED | 800 | standard input | 1 second | The first line contains integer $$$n$$$ ($$$2 \le n \le 200\,000$$$) — the number of doors. The next line contains $$$n$$$ integers: the sequence in which Mr. Black opened the doors. The $$$i$$$-th of these integers is equal to $$$0$$$ in case the $$$i$$$-th opened door is located in the left exit, and it is equal to $... | ["3", "3"] | #include <stdio.h>
int main()
{
int n, i, num0i, num1i, a;
scanf("%d", &n);
for (i = 1; i <= n; i++)
{
scanf("%d", &a);
if (a == 0) num0i = i;
else num1i = i;
}
if (num1i > num0i) num1i = num0i;
printf("%d\n", num1i);
return 0;
}
| |
Three years have passes and nothing changed. It is still raining in London, and Mr. Black has to close all the doors in his home in order to not be flooded. Once, however, Mr. Black became so nervous that he opened one door, then another, then one more and so on until he opened all the doors in his house.There are exac... | Print the smallest integer $$$k$$$ such that after Mr. Black opened the first $$$k$$$ doors, he was able to exit the house. | C | 653455bb6762effbf7358d75660a7689 | 9c982eab7826ae4aa6890f5ff253b4dc | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1553965800 | ["5\n0 0 1 0 0", "4\n1 0 0 1"] | NoteIn the first example the first two doors are from the left exit, so when Mr. Black opened both of them only, there were two more closed door in the left exit and one closed door in the right exit. So Mr. Black wasn't able to exit at that moment.When he opened the third door, all doors from the right exit became ope... | PASSED | 800 | standard input | 1 second | The first line contains integer $$$n$$$ ($$$2 \le n \le 200\,000$$$) — the number of doors. The next line contains $$$n$$$ integers: the sequence in which Mr. Black opened the doors. The $$$i$$$-th of these integers is equal to $$$0$$$ in case the $$$i$$$-th opened door is located in the left exit, and it is equal to $... | ["3", "3"] | #include<stdio.h>
int main()
{
int t,i,l=0,r=0,x;
scanf("%d",&t);
for(i=1;i<=t;i++)
{
int n;
scanf("%d",&n);
if(n==1)
{
l=i;
}
else
{
r=i;
}
}
x=(l<r)?l:r;
printf("%d\n",x);
return 0;
}
| |
Three years have passes and nothing changed. It is still raining in London, and Mr. Black has to close all the doors in his home in order to not be flooded. Once, however, Mr. Black became so nervous that he opened one door, then another, then one more and so on until he opened all the doors in his house.There are exac... | Print the smallest integer $$$k$$$ such that after Mr. Black opened the first $$$k$$$ doors, he was able to exit the house. | C | 653455bb6762effbf7358d75660a7689 | 644cbc5ca7d725662222258e137e1e39 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1553965800 | ["5\n0 0 1 0 0", "4\n1 0 0 1"] | NoteIn the first example the first two doors are from the left exit, so when Mr. Black opened both of them only, there were two more closed door in the left exit and one closed door in the right exit. So Mr. Black wasn't able to exit at that moment.When he opened the third door, all doors from the right exit became ope... | PASSED | 800 | standard input | 1 second | The first line contains integer $$$n$$$ ($$$2 \le n \le 200\,000$$$) — the number of doors. The next line contains $$$n$$$ integers: the sequence in which Mr. Black opened the doors. The $$$i$$$-th of these integers is equal to $$$0$$$ in case the $$$i$$$-th opened door is located in the left exit, and it is equal to $... | ["3", "3"] | #include <stdio.h>
int main(void)
{
long long int n,i,j,k,tcount1=0,tcount2=0,count1=0,count2=0;
scanf("%lld",&n);
int array[n+1];
for(i=0;i<n;i++)
{
scanf("%d",&array[i]);
if(array[i]==0)
count1++;
else
count2++;
}
for(i=0;i<n;i++)
{
if(array[i]==0)
tcount1++;
if(tcount1==cou... | |
Three years have passes and nothing changed. It is still raining in London, and Mr. Black has to close all the doors in his home in order to not be flooded. Once, however, Mr. Black became so nervous that he opened one door, then another, then one more and so on until he opened all the doors in his house.There are exac... | Print the smallest integer $$$k$$$ such that after Mr. Black opened the first $$$k$$$ doors, he was able to exit the house. | C | 653455bb6762effbf7358d75660a7689 | 2e376c1a0ef1d8b69d4516f764233b7e | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1553965800 | ["5\n0 0 1 0 0", "4\n1 0 0 1"] | NoteIn the first example the first two doors are from the left exit, so when Mr. Black opened both of them only, there were two more closed door in the left exit and one closed door in the right exit. So Mr. Black wasn't able to exit at that moment.When he opened the third door, all doors from the right exit became ope... | PASSED | 800 | standard input | 1 second | The first line contains integer $$$n$$$ ($$$2 \le n \le 200\,000$$$) — the number of doors. The next line contains $$$n$$$ integers: the sequence in which Mr. Black opened the doors. The $$$i$$$-th of these integers is equal to $$$0$$$ in case the $$$i$$$-th opened door is located in the left exit, and it is equal to $... | ["3", "3"] | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[])
{
int num,i,count1=0,count0=0,tmp,arr[200000],count1_2=0,count0_2=0;
scanf("%d",&num);
for(i=0;i<num;i++)
{
scanf("%d",&tmp);
arr[i]=tmp;
if(tmp==1)
count1++;
else
count0++;
}
for(i=0;i<num;i++)
{
if... | |
Three years have passes and nothing changed. It is still raining in London, and Mr. Black has to close all the doors in his home in order to not be flooded. Once, however, Mr. Black became so nervous that he opened one door, then another, then one more and so on until he opened all the doors in his house.There are exac... | Print the smallest integer $$$k$$$ such that after Mr. Black opened the first $$$k$$$ doors, he was able to exit the house. | C | 653455bb6762effbf7358d75660a7689 | d3984914b59d8796542211e6c33196c1 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1553965800 | ["5\n0 0 1 0 0", "4\n1 0 0 1"] | NoteIn the first example the first two doors are from the left exit, so when Mr. Black opened both of them only, there were two more closed door in the left exit and one closed door in the right exit. So Mr. Black wasn't able to exit at that moment.When he opened the third door, all doors from the right exit became ope... | PASSED | 800 | standard input | 1 second | The first line contains integer $$$n$$$ ($$$2 \le n \le 200\,000$$$) — the number of doors. The next line contains $$$n$$$ integers: the sequence in which Mr. Black opened the doors. The $$$i$$$-th of these integers is equal to $$$0$$$ in case the $$$i$$$-th opened door is located in the left exit, and it is equal to $... | ["3", "3"] | #include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
int a[n],i,j,x[2]={0},y[2]={0},c=0,c0=0,c1=0;
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<n;i++)
x[a[i]]++;
for(i=0;i<n;i++)
{
c++;
y[a[i]]++;
if(y[0]==x[0]||y[1]==x[1]) break;
}
prin... | |
Three years have passes and nothing changed. It is still raining in London, and Mr. Black has to close all the doors in his home in order to not be flooded. Once, however, Mr. Black became so nervous that he opened one door, then another, then one more and so on until he opened all the doors in his house.There are exac... | Print the smallest integer $$$k$$$ such that after Mr. Black opened the first $$$k$$$ doors, he was able to exit the house. | C | 653455bb6762effbf7358d75660a7689 | f1c14e0a6a2f845a125dded92b7fca33 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1553965800 | ["5\n0 0 1 0 0", "4\n1 0 0 1"] | NoteIn the first example the first two doors are from the left exit, so when Mr. Black opened both of them only, there were two more closed door in the left exit and one closed door in the right exit. So Mr. Black wasn't able to exit at that moment.When he opened the third door, all doors from the right exit became ope... | PASSED | 800 | standard input | 1 second | The first line contains integer $$$n$$$ ($$$2 \le n \le 200\,000$$$) — the number of doors. The next line contains $$$n$$$ integers: the sequence in which Mr. Black opened the doors. The $$$i$$$-th of these integers is equal to $$$0$$$ in case the $$$i$$$-th opened door is located in the left exit, and it is equal to $... | ["3", "3"] | #include <stdio.h>
int main(void) {
// your code goes here
int n,x,a=0,b=0,y=0,z=0,i;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&x);
if(x==0)
{
a++;
y=i;
}
else
{
z=i;
}
}
if(y<z)
printf("%d",y+1);
else
printf("%d",z+1);
return 0;
}
| |
Three years have passes and nothing changed. It is still raining in London, and Mr. Black has to close all the doors in his home in order to not be flooded. Once, however, Mr. Black became so nervous that he opened one door, then another, then one more and so on until he opened all the doors in his house.There are exac... | Print the smallest integer $$$k$$$ such that after Mr. Black opened the first $$$k$$$ doors, he was able to exit the house. | C | 653455bb6762effbf7358d75660a7689 | 012d4df0832dc1f1b96f837d7d2837ac | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1553965800 | ["5\n0 0 1 0 0", "4\n1 0 0 1"] | NoteIn the first example the first two doors are from the left exit, so when Mr. Black opened both of them only, there were two more closed door in the left exit and one closed door in the right exit. So Mr. Black wasn't able to exit at that moment.When he opened the third door, all doors from the right exit became ope... | PASSED | 800 | standard input | 1 second | The first line contains integer $$$n$$$ ($$$2 \le n \le 200\,000$$$) — the number of doors. The next line contains $$$n$$$ integers: the sequence in which Mr. Black opened the doors. The $$$i$$$-th of these integers is equal to $$$0$$$ in case the $$$i$$$-th opened door is located in the left exit, and it is equal to $... | ["3", "3"] | #include <stdio.h>
int main ()
{
int n;
int i,left=0,right=0;
int ara[200000];
scanf ("%d",&n);
for (i=0;i<n;i++)
{
scanf ("%d",&ara[i]);
if (ara[i]==0)
left++;
else
right++;
}
for (i=0;i<n;i++)
{
if (ara[i]==0)
{
... | |
Three years have passes and nothing changed. It is still raining in London, and Mr. Black has to close all the doors in his home in order to not be flooded. Once, however, Mr. Black became so nervous that he opened one door, then another, then one more and so on until he opened all the doors in his house.There are exac... | Print the smallest integer $$$k$$$ such that after Mr. Black opened the first $$$k$$$ doors, he was able to exit the house. | C | 653455bb6762effbf7358d75660a7689 | c25404f2606dad50ca9910f729de51e1 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1553965800 | ["5\n0 0 1 0 0", "4\n1 0 0 1"] | NoteIn the first example the first two doors are from the left exit, so when Mr. Black opened both of them only, there were two more closed door in the left exit and one closed door in the right exit. So Mr. Black wasn't able to exit at that moment.When he opened the third door, all doors from the right exit became ope... | PASSED | 800 | standard input | 1 second | The first line contains integer $$$n$$$ ($$$2 \le n \le 200\,000$$$) — the number of doors. The next line contains $$$n$$$ integers: the sequence in which Mr. Black opened the doors. The $$$i$$$-th of these integers is equal to $$$0$$$ in case the $$$i$$$-th opened door is located in the left exit, and it is equal to $... | ["3", "3"] | #include<stdio.h>
int main(void)
{
int i,j,n,left=0,right=0;
scanf("%d",&n);
int array[n],left1=0,right1=0;
for(i=0;i<n;i++)
{
scanf("%d",&array[i]);
if(array[i]==0)
left++;
else
right++;
}
for(i=0;i<n;i++)
{
if(array[i]==0)
... | |
Three years have passes and nothing changed. It is still raining in London, and Mr. Black has to close all the doors in his home in order to not be flooded. Once, however, Mr. Black became so nervous that he opened one door, then another, then one more and so on until he opened all the doors in his house.There are exac... | Print the smallest integer $$$k$$$ such that after Mr. Black opened the first $$$k$$$ doors, he was able to exit the house. | C | 653455bb6762effbf7358d75660a7689 | e59d5da2091b73c7a3d788a4be56fb27 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1553965800 | ["5\n0 0 1 0 0", "4\n1 0 0 1"] | NoteIn the first example the first two doors are from the left exit, so when Mr. Black opened both of them only, there were two more closed door in the left exit and one closed door in the right exit. So Mr. Black wasn't able to exit at that moment.When he opened the third door, all doors from the right exit became ope... | PASSED | 800 | standard input | 1 second | The first line contains integer $$$n$$$ ($$$2 \le n \le 200\,000$$$) — the number of doors. The next line contains $$$n$$$ integers: the sequence in which Mr. Black opened the doors. The $$$i$$$-th of these integers is equal to $$$0$$$ in case the $$$i$$$-th opened door is located in the left exit, and it is equal to $... | ["3", "3"] | #include <stdio.h>
int doors, eachdoor[200001];
int main ()
{
//freopen ("cf.in","r",stdin),freopen ("cf.out","w",stdout);
scanf ("%d",&doors);
for (int i=0;i<doors;i++)
{
scanf ("%d",&eachdoor[i]);
}
for (int i=doors-1;i>=0;i--)
{
if (eachdoor[doors-1]==0)
{
if (eachdoor[i]==1)
{
printf ("%d... | |
Three years have passes and nothing changed. It is still raining in London, and Mr. Black has to close all the doors in his home in order to not be flooded. Once, however, Mr. Black became so nervous that he opened one door, then another, then one more and so on until he opened all the doors in his house.There are exac... | Print the smallest integer $$$k$$$ such that after Mr. Black opened the first $$$k$$$ doors, he was able to exit the house. | C | 653455bb6762effbf7358d75660a7689 | 19832ebc822d43340e07b63d82fdd3d3 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1553965800 | ["5\n0 0 1 0 0", "4\n1 0 0 1"] | NoteIn the first example the first two doors are from the left exit, so when Mr. Black opened both of them only, there were two more closed door in the left exit and one closed door in the right exit. So Mr. Black wasn't able to exit at that moment.When he opened the third door, all doors from the right exit became ope... | PASSED | 800 | standard input | 1 second | The first line contains integer $$$n$$$ ($$$2 \le n \le 200\,000$$$) — the number of doors. The next line contains $$$n$$$ integers: the sequence in which Mr. Black opened the doors. The $$$i$$$-th of these integers is equal to $$$0$$$ in case the $$$i$$$-th opened door is located in the left exit, and it is equal to $... | ["3", "3"] | #include<stdio.h>
int check(int l,int m){
if(l==0 || m==0)
return 1;
else
return 0;
}
int main() {
int n,x,j;
scanf("%d",&n);
int a[n],c1=0,c2=0,s1=0;
for(int i=0;i<n;i++){
scanf("%d",&a[i]);
if(a[i]==0)
c1++;
else if(a[i]==1)
c2++;
}
for( j=0;j<n... | |
Once Bob got to a sale of old TV sets. There were n TV sets at that sale. TV set with index i costs ai bellars. Some TV sets have a negative price — their owners are ready to pay Bob if he buys their useless apparatus. Bob can «buy» any TV sets he wants. Though he's very strong, Bob can carry at most m TV sets, and he ... | Output the only number — the maximum sum of money that Bob can earn, given that he can carry at most m TV sets. | C | 9a56288d8bd4e4e7ef3329e102f745a5 | 7af2e9df33b6e20304d8f24f5383a662 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings",
"greedy"
] | 1286802000 | ["5 3\n-6 0 35 -2 4", "4 2\n7 0 0 -7"] | null | PASSED | 900 | standard input | 2 seconds | The first line contains two space-separated integers n and m (1 ≤ m ≤ n ≤ 100) — amount of TV sets at the sale, and amount of TV sets that Bob can carry. The following line contains n space-separated integers ai ( - 1000 ≤ ai ≤ 1000) — prices of the TV sets. | ["8", "7"] | #include<stdio.h>
#include<stdlib.h>
int com(void const *a,void const *b)
{
return *(int*)b-*(int *)a;
}
int main(void)
{
int n,m,i,c=0,s=0;
scanf("%d %d",&n,&m);
int a[n],b[n];
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
if(a[i]<0) b[c++]=-a[i];
}
qsort(b,c,4,com);
if(c<m)... | |
Once Bob got to a sale of old TV sets. There were n TV sets at that sale. TV set with index i costs ai bellars. Some TV sets have a negative price — their owners are ready to pay Bob if he buys their useless apparatus. Bob can «buy» any TV sets he wants. Though he's very strong, Bob can carry at most m TV sets, and he ... | Output the only number — the maximum sum of money that Bob can earn, given that he can carry at most m TV sets. | C | 9a56288d8bd4e4e7ef3329e102f745a5 | 0aa46b9eec537b92165e7367d11c8552 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings",
"greedy"
] | 1286802000 | ["5 3\n-6 0 35 -2 4", "4 2\n7 0 0 -7"] | null | PASSED | 900 | standard input | 2 seconds | The first line contains two space-separated integers n and m (1 ≤ m ≤ n ≤ 100) — amount of TV sets at the sale, and amount of TV sets that Bob can carry. The following line contains n space-separated integers ai ( - 1000 ≤ ai ≤ 1000) — prices of the TV sets. | ["8", "7"] | #include <stdio.h>
#include <stdlib.h>
int main(){
int TVatSale, TVBOB, i, j, swap, sum=0;
scanf ("%d %d", &TVatSale, &TVBOB);
int money[TVatSale];
for (i=0; i<(TVatSale) ; i++){
scanf("%d", &money[i]);
}
for (j=0; j<(TVatSale-1); j++){
for (i=0; i<(TVatSale-1); i++){
... | |
Once Bob got to a sale of old TV sets. There were n TV sets at that sale. TV set with index i costs ai bellars. Some TV sets have a negative price — their owners are ready to pay Bob if he buys their useless apparatus. Bob can «buy» any TV sets he wants. Though he's very strong, Bob can carry at most m TV sets, and he ... | Output the only number — the maximum sum of money that Bob can earn, given that he can carry at most m TV sets. | C | 9a56288d8bd4e4e7ef3329e102f745a5 | 43670fd2dfde3601bb0d7efc280d8009 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings",
"greedy"
] | 1286802000 | ["5 3\n-6 0 35 -2 4", "4 2\n7 0 0 -7"] | null | PASSED | 900 | standard input | 2 seconds | The first line contains two space-separated integers n and m (1 ≤ m ≤ n ≤ 100) — amount of TV sets at the sale, and amount of TV sets that Bob can carry. The following line contains n space-separated integers ai ( - 1000 ≤ ai ≤ 1000) — prices of the TV sets. | ["8", "7"] | #include<stdio.h>
int main()
{
int n,m;
scanf("%d %d",&n,&m);
int a[n];
for(int i=0;i<n;i++)
scanf("%d",&a[i]);
for(int i=0;i<n-1;i++)
{
for(int j=i+1;j<n;j++)
{
if(a[i]>a[j])
{
int temp=a[i];
a[i]=a[j];
... | |
Once Bob got to a sale of old TV sets. There were n TV sets at that sale. TV set with index i costs ai bellars. Some TV sets have a negative price — their owners are ready to pay Bob if he buys their useless apparatus. Bob can «buy» any TV sets he wants. Though he's very strong, Bob can carry at most m TV sets, and he ... | Output the only number — the maximum sum of money that Bob can earn, given that he can carry at most m TV sets. | C | 9a56288d8bd4e4e7ef3329e102f745a5 | f9fb603a75363ccf056477c06da4744a | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings",
"greedy"
] | 1286802000 | ["5 3\n-6 0 35 -2 4", "4 2\n7 0 0 -7"] | null | PASSED | 900 | standard input | 2 seconds | The first line contains two space-separated integers n and m (1 ≤ m ≤ n ≤ 100) — amount of TV sets at the sale, and amount of TV sets that Bob can carry. The following line contains n space-separated integers ai ( - 1000 ≤ ai ≤ 1000) — prices of the TV sets. | ["8", "7"] | #include "stdio.h"
#define MAX_SET_SIZE 100
#define BASE "%d"
typedef int Base;
void BubbleSort(Base *Array, Base Size)
{
Base tmp = 0;
for (Base i = 0; i < Size; i++)
{
for (Base j = 1; j < Size; j++)
{
if (Array[j] < Array[j - 1])
{
tmp = Ar... | |
Once Bob got to a sale of old TV sets. There were n TV sets at that sale. TV set with index i costs ai bellars. Some TV sets have a negative price — their owners are ready to pay Bob if he buys their useless apparatus. Bob can «buy» any TV sets he wants. Though he's very strong, Bob can carry at most m TV sets, and he ... | Output the only number — the maximum sum of money that Bob can earn, given that he can carry at most m TV sets. | C | 9a56288d8bd4e4e7ef3329e102f745a5 | 386d0a1e178bc2594ee30302b08b5188 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"sortings",
"greedy"
] | 1286802000 | ["5 3\n-6 0 35 -2 4", "4 2\n7 0 0 -7"] | null | PASSED | 900 | standard input | 2 seconds | The first line contains two space-separated integers n and m (1 ≤ m ≤ n ≤ 100) — amount of TV sets at the sale, and amount of TV sets that Bob can carry. The following line contains n space-separated integers ai ( - 1000 ≤ ai ≤ 1000) — prices of the TV sets. | ["8", "7"] | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
int n, m;
scanf("%d%d", &n, &m);
int i = 0, ara[n];
while(n--)
{
int temp;
scanf("%d", &temp);
if(temp < 0)
{
ara[i] = temp;
i++;
}
}
int sum = 0;
in... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.