prob_desc_description stringlengths 63 3.8k | prob_desc_output_spec stringlengths 17 1.47k β | lang_cluster stringclasses 2
values | src_uid stringlengths 32 32 | code_uid stringlengths 32 32 | lang stringclasses 7
values | prob_desc_output_to stringclasses 3
values | prob_desc_memory_limit stringclasses 19
values | file_name stringclasses 111
values | tags listlengths 0 11 | prob_desc_created_at stringlengths 10 10 | prob_desc_sample_inputs stringlengths 2 802 | prob_desc_notes stringlengths 4 3k β | exec_outcome stringclasses 1
value | difficulty int64 -1 3.5k β | prob_desc_input_from stringclasses 3
values | prob_desc_time_limit stringclasses 27
values | prob_desc_input_spec stringlengths 28 2.42k β | prob_desc_sample_outputs stringlengths 2 796 | source_code stringlengths 42 65.5k | hidden_unit_tests stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A group of n merry programmers celebrate Robert Floyd's birthday. Polucarpus has got an honourable task of pouring Ber-Cola to everybody. Pouring the same amount of Ber-Cola to everybody is really important. In other words, the drink's volume in each of the n mugs must be the same.Polycarpus has already began the proce... | Print a single number "-1" (without the quotes), if there is no solution. Otherwise, print n float numbers c1,βc2,β...,βcn, where ci is the volume of the drink to add in the i-th mug. Print the numbers with no less than 6 digits after the decimal point, print each ci on a single line. Polycarpus proved that if a soluti... | C | 65fea461d3caa5a932d1e2c13e99a59e | 2b7897b6a165afa73f4c2703ea0c30fc | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1333897500 | ["5 50\n1 2 3 4 5", "2 2\n1 100"] | null | PASSED | 1,100 | standard input | 2 seconds | The first line contains a pair of integers n, b (2ββ€βnββ€β100,β1ββ€βbββ€β100), where n is the total number of friends in the group and b is the current volume of drink in the bottle. The second line contains a sequence of integers a1,βa2,β...,βan (0ββ€βaiββ€β100), where ai is the current volume of drink in the i-th mug. | ["12.000000\n11.000000\n10.000000\n9.000000\n8.000000", "-1"] | #include <stdio.h>
#include <stdlib.h>
int n,b,i,a[101],max=0;
double k[101],l;
int main(int argc, char *argv[])
{
scanf("%d%d",&n,&b);
for(i=1;i<=n;i++)
{
scanf("%d",&a[i]);
if(a[i]>max)
max=a[i];
}
for(i=1;i<=n;i++)
{
k[i]=max-a[i];
b-=k[i];
if(b<0)
{
printf(... | |
A group of n merry programmers celebrate Robert Floyd's birthday. Polucarpus has got an honourable task of pouring Ber-Cola to everybody. Pouring the same amount of Ber-Cola to everybody is really important. In other words, the drink's volume in each of the n mugs must be the same.Polycarpus has already began the proce... | Print a single number "-1" (without the quotes), if there is no solution. Otherwise, print n float numbers c1,βc2,β...,βcn, where ci is the volume of the drink to add in the i-th mug. Print the numbers with no less than 6 digits after the decimal point, print each ci on a single line. Polycarpus proved that if a soluti... | C | 65fea461d3caa5a932d1e2c13e99a59e | 59a9ca607453d7369cca01b1221657e9 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"math"
] | 1333897500 | ["5 50\n1 2 3 4 5", "2 2\n1 100"] | null | PASSED | 1,100 | standard input | 2 seconds | The first line contains a pair of integers n, b (2ββ€βnββ€β100,β1ββ€βbββ€β100), where n is the total number of friends in the group and b is the current volume of drink in the bottle. The second line contains a sequence of integers a1,βa2,β...,βan (0ββ€βaiββ€β100), where ai is the current volume of drink in the i-th mug. | ["12.000000\n11.000000\n10.000000\n9.000000\n8.000000", "-1"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int n,b;
int a[108];
double result[108];
scanf("%d%d",&n,&b);
int i,sum;
for(i=0,sum=0; i<n; i++)
{
scanf("%d",&a[i]);
sum=sum+a[i];
}
double avg=(double)(sum+b)/(double)n;
int sus=1;
for(i=0; i<n; i++)
{
result[i]=avg-a[i];
if(result[i]<0)
{
... | |
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical β formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y... | Print one integer β the number of ways to choose four segments so they form a rectangle. | C | 09890f75bdcfff81f67eb915379b325e | 60413025716d59c02b58f918cb330b48 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"geometry",
"bitmasks",
"sortings",
"data structures",
"brute force"
] | 1563115500 | ["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"] | NoteThe following pictures represent sample cases: | PASSED | 2,200 | standard input | 2 seconds | The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) β the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in... | ["7", "0"] | #include <stdio.h>
#include <malloc.h>
int sesh = 10009;
typedef struct mk
{
int choto,boro;
struct mk *tarpor;
}ok;
ok* Amk(int _,int __){
ok *tmp = (ok*)malloc(sizeof(ok));
tmp->choto = (_<__)?_:__;
tmp->boro = (_>__)?_:__;
tmp->tarpor = NULL;
return tmp;
}
typedef struct mkroy
{
int value;
struct mkroy *t... | |
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical β formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y... | Print one integer β the number of ways to choose four segments so they form a rectangle. | C | 09890f75bdcfff81f67eb915379b325e | 23f53d59453606b03f91dfc67e258f72 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"geometry",
"bitmasks",
"sortings",
"data structures",
"brute force"
] | 1563115500 | ["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"] | NoteThe following pictures represent sample cases: | PASSED | 2,200 | standard input | 2 seconds | The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) β the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in... | ["7", "0"] | #include <stdio.h>
#include <malloc.h>
int sesh = 10009;
typedef struct mk
{
int choto,boro;
struct mk *tarpor;
}ok;
ok* Amk(int _,int __){
ok *tmp = (ok*)malloc(sizeof(ok));
tmp->choto = (_<__)?_:__;
tmp->boro = (_>__)?_:__;
tmp->tarpor = NULL;
return tmp;
}
typedef struct mkroy
{
int value;
struct mkroy *t... | |
You are given a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters.A substring of string $$$s$$$ is a continuous segment of letters from $$$s$$$. For example, "defor" is a substring of "codeforces" and "fors" is not. The length of the substring is the number of letters in it.Let's call some string of length ... | Print "NO" if there is no diverse substring in the string $$$s$$$. Otherwise the first line should contain "YES". The second line should contain any diverse substring of string $$$s$$$. | C | ce4443581d4ee12db6607695cd567070 | 0bf6f01f66f3471139b6ff5ae3cded9b | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1540478100 | ["10\ncodeforces", "5\naaaaa"] | NoteThe first example has lots of correct answers. Please, restrain yourself from asking if some specific answer is correct for some specific test or not, these questions always lead to "No comments" answer. | PASSED | 1,000 | standard input | 1 second | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$) β the length of string $$$s$$$. The second line is the string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. | ["YES\ncode", "NO"] | //codeforces_1073A
#include <stdio.h>
#include <stdlib.h>
int main(){
int n;scanf("%d",&n);
char s[n];scanf("%s",s);
for ( int k = 0; k < n-1; k++){
if ( s[k] != s[k+1] ){
printf("YES\n%c%c\n",s[k],s[k+1]);
return 0;
}
}
printf("NO\n");
return 0;
} | |
You are given a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters.A substring of string $$$s$$$ is a continuous segment of letters from $$$s$$$. For example, "defor" is a substring of "codeforces" and "fors" is not. The length of the substring is the number of letters in it.Let's call some string of length ... | Print "NO" if there is no diverse substring in the string $$$s$$$. Otherwise the first line should contain "YES". The second line should contain any diverse substring of string $$$s$$$. | C | ce4443581d4ee12db6607695cd567070 | 5596902b71c54b9f429b046a220598d6 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1540478100 | ["10\ncodeforces", "5\naaaaa"] | NoteThe first example has lots of correct answers. Please, restrain yourself from asking if some specific answer is correct for some specific test or not, these questions always lead to "No comments" answer. | PASSED | 1,000 | standard input | 1 second | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$) β the length of string $$$s$$$. The second line is the string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. | ["YES\ncode", "NO"] | #include <stdio.h>
#define ABC 26
void initialize(int *arr, int length) {
for (int i=0; i<length; i++) arr[i]=0;
}
void print(char *str, int start, int end) {
for (int i=start; i<end; i++) printf("%c",str[i]);
}
int check(int *arr, int length, int bound) {
for (int i=0; i<length; i++) {
if (arr[i]>b... | |
You are given a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters.A substring of string $$$s$$$ is a continuous segment of letters from $$$s$$$. For example, "defor" is a substring of "codeforces" and "fors" is not. The length of the substring is the number of letters in it.Let's call some string of length ... | Print "NO" if there is no diverse substring in the string $$$s$$$. Otherwise the first line should contain "YES". The second line should contain any diverse substring of string $$$s$$$. | C | ce4443581d4ee12db6607695cd567070 | 71e17d7c896258f3c1233f40087e47a6 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1540478100 | ["10\ncodeforces", "5\naaaaa"] | NoteThe first example has lots of correct answers. Please, restrain yourself from asking if some specific answer is correct for some specific test or not, these questions always lead to "No comments" answer. | PASSED | 1,000 | standard input | 1 second | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$) β the length of string $$$s$$$. The second line is the string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. | ["YES\ncode", "NO"] | #include<stdio.h>
#include<string.h>
int main()
{
int n, i, count=0;
char s[1005];
scanf("%d%s", &n, s);
for(i=0 ; i<n-1 ; i++)
{
if(s[i]!=s[i+1])
{
printf("YES\n%c%c", s[i], s[i+1]);
return 0;
}
}
printf("NO");
return 0;
}
| |
You are given a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters.A substring of string $$$s$$$ is a continuous segment of letters from $$$s$$$. For example, "defor" is a substring of "codeforces" and "fors" is not. The length of the substring is the number of letters in it.Let's call some string of length ... | Print "NO" if there is no diverse substring in the string $$$s$$$. Otherwise the first line should contain "YES". The second line should contain any diverse substring of string $$$s$$$. | C | ce4443581d4ee12db6607695cd567070 | 9d42104cf6edfb40a3fa98af7fd77395 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1540478100 | ["10\ncodeforces", "5\naaaaa"] | NoteThe first example has lots of correct answers. Please, restrain yourself from asking if some specific answer is correct for some specific test or not, these questions always lead to "No comments" answer. | PASSED | 1,000 | standard input | 1 second | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$) β the length of string $$$s$$$. The second line is the string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. | ["YES\ncode", "NO"] | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main()
{
char ntemp[6];
fgets(ntemp, 6, stdin);
float length = 0;
length = atof(ntemp);
double halflength = length / 2;
char substring[3];
char letter1, letter2;
float a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u... | |
You are given a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters.A substring of string $$$s$$$ is a continuous segment of letters from $$$s$$$. For example, "defor" is a substring of "codeforces" and "fors" is not. The length of the substring is the number of letters in it.Let's call some string of length ... | Print "NO" if there is no diverse substring in the string $$$s$$$. Otherwise the first line should contain "YES". The second line should contain any diverse substring of string $$$s$$$. | C | ce4443581d4ee12db6607695cd567070 | 84d37c2dff1045221d8f4fbb40f6721f | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1540478100 | ["10\ncodeforces", "5\naaaaa"] | NoteThe first example has lots of correct answers. Please, restrain yourself from asking if some specific answer is correct for some specific test or not, these questions always lead to "No comments" answer. | PASSED | 1,000 | standard input | 1 second | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$) β the length of string $$$s$$$. The second line is the string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. | ["YES\ncode", "NO"] | #include <stdio.h>
#include <string.h>
char a[1005];
char b[30];
int main ()
{
int n;
scanf("%d",&n);
int flag=1;
scanf("%s",a);
for (int i=1;i<strlen(a);i++)
if (a[i]==a[i-1])
flag=1;
else
{
flag=0;
break;
}
if (flag)
printf("NO\n");
else
{
printf("YES\n");
for (int i=1;i<strlen(a);i++... | |
You are given a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters.A substring of string $$$s$$$ is a continuous segment of letters from $$$s$$$. For example, "defor" is a substring of "codeforces" and "fors" is not. The length of the substring is the number of letters in it.Let's call some string of length ... | Print "NO" if there is no diverse substring in the string $$$s$$$. Otherwise the first line should contain "YES". The second line should contain any diverse substring of string $$$s$$$. | C | ce4443581d4ee12db6607695cd567070 | 6d73128cc0c185dbbe26126bfc7bd91a | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1540478100 | ["10\ncodeforces", "5\naaaaa"] | NoteThe first example has lots of correct answers. Please, restrain yourself from asking if some specific answer is correct for some specific test or not, these questions always lead to "No comments" answer. | PASSED | 1,000 | standard input | 1 second | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$) β the length of string $$$s$$$. The second line is the string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. | ["YES\ncode", "NO"] | //Alan SuΓ‘rez SantamarΓa A01328931
//Estructura de datos
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
char number[100];
fgets(number,100,stdin);
int num=atoi(number);
char entry[1002];
fgets(entry,1002,stdin);
char * num1= entry;
... | |
You are given a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters.A substring of string $$$s$$$ is a continuous segment of letters from $$$s$$$. For example, "defor" is a substring of "codeforces" and "fors" is not. The length of the substring is the number of letters in it.Let's call some string of length ... | Print "NO" if there is no diverse substring in the string $$$s$$$. Otherwise the first line should contain "YES". The second line should contain any diverse substring of string $$$s$$$. | C | ce4443581d4ee12db6607695cd567070 | 2c250a5a6604943801fa4a72825cc64b | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1540478100 | ["10\ncodeforces", "5\naaaaa"] | NoteThe first example has lots of correct answers. Please, restrain yourself from asking if some specific answer is correct for some specific test or not, these questions always lead to "No comments" answer. | PASSED | 1,000 | standard input | 1 second | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$) β the length of string $$$s$$$. The second line is the string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. | ["YES\ncode", "NO"] | #include <stdio.h>
int main(void) {
int a;
scanf("%d", &a);
char b[1001];
scanf("%s", b);
if (a > 1) {
for (int i = 0; i < a-1; i++) {
if (b[i] != b[i+1]) {
printf("YES\n");
printf("%c%c\n", b[i], b[i+1]);
return 0;
}
}
}
printf("NO\n");
return 0;
}
| |
You are given a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters.A substring of string $$$s$$$ is a continuous segment of letters from $$$s$$$. For example, "defor" is a substring of "codeforces" and "fors" is not. The length of the substring is the number of letters in it.Let's call some string of length ... | Print "NO" if there is no diverse substring in the string $$$s$$$. Otherwise the first line should contain "YES". The second line should contain any diverse substring of string $$$s$$$. | C | ce4443581d4ee12db6607695cd567070 | 61c395a99f103183b649ed92abebc554 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1540478100 | ["10\ncodeforces", "5\naaaaa"] | NoteThe first example has lots of correct answers. Please, restrain yourself from asking if some specific answer is correct for some specific test or not, these questions always lead to "No comments" answer. | PASSED | 1,000 | standard input | 1 second | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$) β the length of string $$$s$$$. The second line is the string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. | ["YES\ncode", "NO"] | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
int n,i,j,p;
char a[10000],b[3];
scanf("%d",&n);
scanf("%s",&a);
if(n>1){
for(i=0; i<n-1; i++){
if(a[i]!=a[i+1]){
printf("YES\n");
printf("%c%c",a[i],a[i+1]);
retu... | |
You are given a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters.A substring of string $$$s$$$ is a continuous segment of letters from $$$s$$$. For example, "defor" is a substring of "codeforces" and "fors" is not. The length of the substring is the number of letters in it.Let's call some string of length ... | Print "NO" if there is no diverse substring in the string $$$s$$$. Otherwise the first line should contain "YES". The second line should contain any diverse substring of string $$$s$$$. | C | ce4443581d4ee12db6607695cd567070 | 2b929e5c849f6ae56c466ed14b599dbb | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1540478100 | ["10\ncodeforces", "5\naaaaa"] | NoteThe first example has lots of correct answers. Please, restrain yourself from asking if some specific answer is correct for some specific test or not, these questions always lead to "No comments" answer. | PASSED | 1,000 | standard input | 1 second | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$) β the length of string $$$s$$$. The second line is the string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. | ["YES\ncode", "NO"] | #include<stdio.h>
int count =0;
int main ()
{
int n,flag=0;
scanf("%d",&n);
char s[n+1];
scanf("%s",s);
if(n==1)
printf("NO");
else
{
for(int i=0;i<n-1;i++)
{
if(s[i]!=s[i+1])
{
printf("YES\n");
printf("%c%c",s[i],s[i+1]);
flag=1;
break;
}
else
count++;
}
if(count >=(n/2) && flag==0)... | |
You are given a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters.A substring of string $$$s$$$ is a continuous segment of letters from $$$s$$$. For example, "defor" is a substring of "codeforces" and "fors" is not. The length of the substring is the number of letters in it.Let's call some string of length ... | Print "NO" if there is no diverse substring in the string $$$s$$$. Otherwise the first line should contain "YES". The second line should contain any diverse substring of string $$$s$$$. | C | ce4443581d4ee12db6607695cd567070 | 51d47182eec38045c52fe9fbccd37a1d | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1540478100 | ["10\ncodeforces", "5\naaaaa"] | NoteThe first example has lots of correct answers. Please, restrain yourself from asking if some specific answer is correct for some specific test or not, these questions always lead to "No comments" answer. | PASSED | 1,000 | standard input | 1 second | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$) β the length of string $$$s$$$. The second line is the string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. | ["YES\ncode", "NO"] | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main() {
int a,n,x;
scanf("%d",&a);
char p[a+1];
scanf("%s",p);
for(int c = 0;c<a;c++){
for(int c2 = c;c2<a;c2++){
x = 0;
for(int c3 = c;c3<=c2;c3++){
n = 0;
for(int c4 = c3;c4<=c2;c4++){
if(p[c3] == p[c4]){... | |
You are given a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters.A substring of string $$$s$$$ is a continuous segment of letters from $$$s$$$. For example, "defor" is a substring of "codeforces" and "fors" is not. The length of the substring is the number of letters in it.Let's call some string of length ... | Print "NO" if there is no diverse substring in the string $$$s$$$. Otherwise the first line should contain "YES". The second line should contain any diverse substring of string $$$s$$$. | C | ce4443581d4ee12db6607695cd567070 | 36ee6838c2392ae0ccb65f005c6c88f7 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1540478100 | ["10\ncodeforces", "5\naaaaa"] | NoteThe first example has lots of correct answers. Please, restrain yourself from asking if some specific answer is correct for some specific test or not, these questions always lead to "No comments" answer. | PASSED | 1,000 | standard input | 1 second | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$) β the length of string $$$s$$$. The second line is the string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. | ["YES\ncode", "NO"] | #include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
char x[n];
scanf("%s",x);
for(int i=1;i<n;i++)
{
if(x[i-1]!=x[i])
{
printf("YES\n%c%c",x[i-1],x[i]);
return 0;
}
}
printf("NO");
return 0;
}
| |
You are given a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters.A substring of string $$$s$$$ is a continuous segment of letters from $$$s$$$. For example, "defor" is a substring of "codeforces" and "fors" is not. The length of the substring is the number of letters in it.Let's call some string of length ... | Print "NO" if there is no diverse substring in the string $$$s$$$. Otherwise the first line should contain "YES". The second line should contain any diverse substring of string $$$s$$$. | C | ce4443581d4ee12db6607695cd567070 | fc76558985a7c003fa109fe798451461 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1540478100 | ["10\ncodeforces", "5\naaaaa"] | NoteThe first example has lots of correct answers. Please, restrain yourself from asking if some specific answer is correct for some specific test or not, these questions always lead to "No comments" answer. | PASSED | 1,000 | standard input | 1 second | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$) β the length of string $$$s$$$. The second line is the string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. | ["YES\ncode", "NO"] | #include<stdio.h>
int main(){
int a[128]={0},n,w=1;scanf("%d",&n);
char s[n+1],g;
scanf("%c",&g);
scanf("%s",s);
for(int i=0;i<n;i++)a[(int)(s[i])]++;
for(int i=0;i<128;i++){
if(a[i]>n-1)w=0;}
if(w){printf("YES\n");
for(int i=0;i<n-1;i++){
if(s[i]!=s[i+1]){
printf("%c%c\n",s[i],s[i+1]);
break;}}}
... | |
You are given a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters.A substring of string $$$s$$$ is a continuous segment of letters from $$$s$$$. For example, "defor" is a substring of "codeforces" and "fors" is not. The length of the substring is the number of letters in it.Let's call some string of length ... | Print "NO" if there is no diverse substring in the string $$$s$$$. Otherwise the first line should contain "YES". The second line should contain any diverse substring of string $$$s$$$. | C | ce4443581d4ee12db6607695cd567070 | bfebedae3ab046a9e075a848250c1d67 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1540478100 | ["10\ncodeforces", "5\naaaaa"] | NoteThe first example has lots of correct answers. Please, restrain yourself from asking if some specific answer is correct for some specific test or not, these questions always lead to "No comments" answer. | PASSED | 1,000 | standard input | 1 second | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$) β the length of string $$$s$$$. The second line is the string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. | ["YES\ncode", "NO"] | #include<stdio.h>
int main ()
{
int n,m=0,p;
scanf("%d",&n);
char s[n+1];
scanf("%s",s);
for(p=0;p<n-1;p++)
{
if(s[p]!=s[p+1])
{
m=1;
printf("YES\n");
printf("%c%c\n",s[p],s[p+1]);
break;}
}
if(m==0)
printf("NO\n");
}
| |
You are given a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters.A substring of string $$$s$$$ is a continuous segment of letters from $$$s$$$. For example, "defor" is a substring of "codeforces" and "fors" is not. The length of the substring is the number of letters in it.Let's call some string of length ... | Print "NO" if there is no diverse substring in the string $$$s$$$. Otherwise the first line should contain "YES". The second line should contain any diverse substring of string $$$s$$$. | C | ce4443581d4ee12db6607695cd567070 | 6d3430a88a7f67d1315bb44fd1d27c60 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1540478100 | ["10\ncodeforces", "5\naaaaa"] | NoteThe first example has lots of correct answers. Please, restrain yourself from asking if some specific answer is correct for some specific test or not, these questions always lead to "No comments" answer. | PASSED | 1,000 | standard input | 1 second | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$) β the length of string $$$s$$$. The second line is the string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. | ["YES\ncode", "NO"] | #include <stdio.h>
#include <string.h>
int main()
{
int n,i,j,m,p;
char a[1000];
char b[26]="abcdefghijklmnopqrstuvwxyz";
scanf("%d",&n);
scanf("%s",&a);
if(n==1){
printf("NO");
}
else{
for(p=0; p<n; p++){
if(a[p]!=a[p+1]){
printf("YES\n");
... | |
You are given a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters.A substring of string $$$s$$$ is a continuous segment of letters from $$$s$$$. For example, "defor" is a substring of "codeforces" and "fors" is not. The length of the substring is the number of letters in it.Let's call some string of length ... | Print "NO" if there is no diverse substring in the string $$$s$$$. Otherwise the first line should contain "YES". The second line should contain any diverse substring of string $$$s$$$. | C | ce4443581d4ee12db6607695cd567070 | fcce8d8de6a04733c63eedc8afb2d9ac | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1540478100 | ["10\ncodeforces", "5\naaaaa"] | NoteThe first example has lots of correct answers. Please, restrain yourself from asking if some specific answer is correct for some specific test or not, these questions always lead to "No comments" answer. | PASSED | 1,000 | standard input | 1 second | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$) β the length of string $$$s$$$. The second line is the string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. | ["YES\ncode", "NO"] | #include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
char a[1050];
scanf("%s",a);
int c=0;
for(int i=1;i<n;i++)
{
if(a[i]!=a[i-1])
{
c=1;
printf("YES\n%c%c\n",a[i-1],a[i]);
break;
}
}
if(c==0) printf("NO\n");
return 0;
}
| |
You are given a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters.A substring of string $$$s$$$ is a continuous segment of letters from $$$s$$$. For example, "defor" is a substring of "codeforces" and "fors" is not. The length of the substring is the number of letters in it.Let's call some string of length ... | Print "NO" if there is no diverse substring in the string $$$s$$$. Otherwise the first line should contain "YES". The second line should contain any diverse substring of string $$$s$$$. | C | ce4443581d4ee12db6607695cd567070 | 06bedc18bedccf231f20bae71578f0b1 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1540478100 | ["10\ncodeforces", "5\naaaaa"] | NoteThe first example has lots of correct answers. Please, restrain yourself from asking if some specific answer is correct for some specific test or not, these questions always lead to "No comments" answer. | PASSED | 1,000 | standard input | 1 second | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$) β the length of string $$$s$$$. The second line is the string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. | ["YES\ncode", "NO"] | #include<stdio.h>
int main(void) {
int n,i,flag=0;
scanf("%d",&n);
char string[n];
scanf("%s",string);
for(i=1;i<n;i++) {
if(string[i]!=string[i-1]) {
flag=1;
break;
}
}
if(flag) {
printf("YES\n%c%c\n",string[i-1],string[i]);
}
else
printf("NO\n");
return 0;
}
| |
You are given a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters.A substring of string $$$s$$$ is a continuous segment of letters from $$$s$$$. For example, "defor" is a substring of "codeforces" and "fors" is not. The length of the substring is the number of letters in it.Let's call some string of length ... | Print "NO" if there is no diverse substring in the string $$$s$$$. Otherwise the first line should contain "YES". The second line should contain any diverse substring of string $$$s$$$. | C | ce4443581d4ee12db6607695cd567070 | a14d0437085b88ee44c8060228c4b0f7 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1540478100 | ["10\ncodeforces", "5\naaaaa"] | NoteThe first example has lots of correct answers. Please, restrain yourself from asking if some specific answer is correct for some specific test or not, these questions always lead to "No comments" answer. | PASSED | 1,000 | standard input | 1 second | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$) β the length of string $$$s$$$. The second line is the string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. | ["YES\ncode", "NO"] | #include<stdio.h>
int main()
{
int n,c=0;
scanf("%d",&n);
char s[n+1],t[3];
scanf("%s",s);
for(int i=0;i<n;i++)
{
s[n]='#';
if(s[i]!=s[i+1] && i<n-1)
{
c=0;t[0]=s[i];t[1]=s[i+1];
t[2]='\0';
printf("YES\n");
printf("%s\n",t);
return 0;
}
}
printf("NO\n");
return 0;
}
| |
You are given a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters.A substring of string $$$s$$$ is a continuous segment of letters from $$$s$$$. For example, "defor" is a substring of "codeforces" and "fors" is not. The length of the substring is the number of letters in it.Let's call some string of length ... | Print "NO" if there is no diverse substring in the string $$$s$$$. Otherwise the first line should contain "YES". The second line should contain any diverse substring of string $$$s$$$. | C | ce4443581d4ee12db6607695cd567070 | afdce05d30ad696d20547fa02f24ed89 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1540478100 | ["10\ncodeforces", "5\naaaaa"] | NoteThe first example has lots of correct answers. Please, restrain yourself from asking if some specific answer is correct for some specific test or not, these questions always lead to "No comments" answer. | PASSED | 1,000 | standard input | 1 second | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$) β the length of string $$$s$$$. The second line is the string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. | ["YES\ncode", "NO"] | #include<stdio.h>
int main()
{
int n,i=0,j=0;
scanf("%d",&n);
char s[n+1];
scanf("%s",&s);
while(s[j]!=0)
{
j=j+1;
}
while(i<j-1)
{
if(s[i]!=s[i+1])
{
printf("YES\n");
printf("%c%c",s[i],s[i+1]);
exit(0);
}
i... | |
You are given a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters.A substring of string $$$s$$$ is a continuous segment of letters from $$$s$$$. For example, "defor" is a substring of "codeforces" and "fors" is not. The length of the substring is the number of letters in it.Let's call some string of length ... | Print "NO" if there is no diverse substring in the string $$$s$$$. Otherwise the first line should contain "YES". The second line should contain any diverse substring of string $$$s$$$. | C | ce4443581d4ee12db6607695cd567070 | 1bc553167ebff691cdd00f99226f0157 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1540478100 | ["10\ncodeforces", "5\naaaaa"] | NoteThe first example has lots of correct answers. Please, restrain yourself from asking if some specific answer is correct for some specific test or not, these questions always lead to "No comments" answer. | PASSED | 1,000 | standard input | 1 second | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$) β the length of string $$$s$$$. The second line is the string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. | ["YES\ncode", "NO"] | #include<stdio.h>
#include<string.h>
#define ll long long int
int main(){
int n,t1=0;
char c[1000],ans[2];
scanf("%d%s",&n,&c);
for(ll i=0;i<n-1;i++){
if(c[i]!=c[i+1]){
ans[0]=c[i];
ans[1]=c[i+1];
t1++;
break;
}
}
if(t1!=0)
printf("YES\n%c%c\n",ans[0],ans[1]);
else
printf("NO\n");
return 0;
... | |
You are given a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters.A substring of string $$$s$$$ is a continuous segment of letters from $$$s$$$. For example, "defor" is a substring of "codeforces" and "fors" is not. The length of the substring is the number of letters in it.Let's call some string of length ... | Print "NO" if there is no diverse substring in the string $$$s$$$. Otherwise the first line should contain "YES". The second line should contain any diverse substring of string $$$s$$$. | C | ce4443581d4ee12db6607695cd567070 | 94fd1af1558515c058382c01bea6b2d4 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1540478100 | ["10\ncodeforces", "5\naaaaa"] | NoteThe first example has lots of correct answers. Please, restrain yourself from asking if some specific answer is correct for some specific test or not, these questions always lead to "No comments" answer. | PASSED | 1,000 | standard input | 1 second | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$) β the length of string $$$s$$$. The second line is the string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. | ["YES\ncode", "NO"] | #include<stdio.h>
int main()
{
int n,i;
char a[1001];
scanf("%d%s",&n,a);
for(i=0; i<n-1; i++)
if(a[i]!=a[i+1])
{
printf("YES\n%c%c\n",a[i],a[i+1]);
return 0;
}
printf("NO\n");
return 0;
}
| |
You are given a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters.A substring of string $$$s$$$ is a continuous segment of letters from $$$s$$$. For example, "defor" is a substring of "codeforces" and "fors" is not. The length of the substring is the number of letters in it.Let's call some string of length ... | Print "NO" if there is no diverse substring in the string $$$s$$$. Otherwise the first line should contain "YES". The second line should contain any diverse substring of string $$$s$$$. | C | ce4443581d4ee12db6607695cd567070 | 5fa85deda1906f28241723062c847c42 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1540478100 | ["10\ncodeforces", "5\naaaaa"] | NoteThe first example has lots of correct answers. Please, restrain yourself from asking if some specific answer is correct for some specific test or not, these questions always lead to "No comments" answer. | PASSED | 1,000 | standard input | 1 second | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$) β the length of string $$$s$$$. The second line is the string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. | ["YES\ncode", "NO"] | //nice implementation problem related to strings;
#include<stdio.h>
int main()
{
int n,i,j,iteri=0,count=0;
scanf("%d",&n);
int a[257]={0};
char s[n+1];
scanf("%s",s);
// if(s[n]=='\0')
// printf("Yo!\n");
for(i=0;i<n;)
{
iteri++;
// printf("Yo!\n");
for(j=i;j<n;j++)
{
a[s[j]]++;
// printf("a[s[%d]]... | |
You are given a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters.A substring of string $$$s$$$ is a continuous segment of letters from $$$s$$$. For example, "defor" is a substring of "codeforces" and "fors" is not. The length of the substring is the number of letters in it.Let's call some string of length ... | Print "NO" if there is no diverse substring in the string $$$s$$$. Otherwise the first line should contain "YES". The second line should contain any diverse substring of string $$$s$$$. | C | ce4443581d4ee12db6607695cd567070 | f85771f1a21a00d54d958f323157aa7b | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1540478100 | ["10\ncodeforces", "5\naaaaa"] | NoteThe first example has lots of correct answers. Please, restrain yourself from asking if some specific answer is correct for some specific test or not, these questions always lead to "No comments" answer. | PASSED | 1,000 | standard input | 1 second | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$) β the length of string $$$s$$$. The second line is the string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. | ["YES\ncode", "NO"] | #include <stdio.h>
int main(void)
{
int n;
scanf("%d", &n);
char str[1007];
scanf("%s", str);
int count=0;
// for(int i=0;i<n;i++){
// if (str[i]==str[i+1])
// count++;
// }
// if (count==n)
// { printf("NO\n");
// return 0;
//}
for (int i=0;i<n-1;i++){
... | |
You are given a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters.A substring of string $$$s$$$ is a continuous segment of letters from $$$s$$$. For example, "defor" is a substring of "codeforces" and "fors" is not. The length of the substring is the number of letters in it.Let's call some string of length ... | Print "NO" if there is no diverse substring in the string $$$s$$$. Otherwise the first line should contain "YES". The second line should contain any diverse substring of string $$$s$$$. | C | ce4443581d4ee12db6607695cd567070 | 66c47f6e7c0d5eddeea9425a470c8ac3 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1540478100 | ["10\ncodeforces", "5\naaaaa"] | NoteThe first example has lots of correct answers. Please, restrain yourself from asking if some specific answer is correct for some specific test or not, these questions always lead to "No comments" answer. | PASSED | 1,000 | standard input | 1 second | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$) β the length of string $$$s$$$. The second line is the string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. | ["YES\ncode", "NO"] | #include<stdio.h>
int main(){
int n,i;
char s[1002];
scanf("%d\n",&n);
gets(s);
for(i = 1; i < n; i++){
if(s[i - 1] != s[i]){
printf("YES\n");
printf("%c%c",s[i - 1],s[i]);
return 0;
}
}
printf("NO");
return 0;
}
| |
You are given a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters.A substring of string $$$s$$$ is a continuous segment of letters from $$$s$$$. For example, "defor" is a substring of "codeforces" and "fors" is not. The length of the substring is the number of letters in it.Let's call some string of length ... | Print "NO" if there is no diverse substring in the string $$$s$$$. Otherwise the first line should contain "YES". The second line should contain any diverse substring of string $$$s$$$. | C | ce4443581d4ee12db6607695cd567070 | 39fba1e8b65936884e527078e83fed4f | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1540478100 | ["10\ncodeforces", "5\naaaaa"] | NoteThe first example has lots of correct answers. Please, restrain yourself from asking if some specific answer is correct for some specific test or not, these questions always lead to "No comments" answer. | PASSED | 1,000 | standard input | 1 second | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$) β the length of string $$$s$$$. The second line is the string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. | ["YES\ncode", "NO"] |
#include<stdio.h>
int arr[200][1001];
int main()
{
int n;
char str[1001];
scanf("%d",&n);
scanf("%s",str);
for(int i=0;i<n;i++)
{
arr[str[i]][i]=1;
}
for(int i=1;str[i]!='\0';i++)
{
for(int k=0;k<26;k++)
arr[k+'a'][i]+=arr[k+'a'][i-1];
}
for(int... | |
You are given a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters.A substring of string $$$s$$$ is a continuous segment of letters from $$$s$$$. For example, "defor" is a substring of "codeforces" and "fors" is not. The length of the substring is the number of letters in it.Let's call some string of length ... | Print "NO" if there is no diverse substring in the string $$$s$$$. Otherwise the first line should contain "YES". The second line should contain any diverse substring of string $$$s$$$. | C | ce4443581d4ee12db6607695cd567070 | 5fd2df25e81883ff59635164d24bd8cf | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1540478100 | ["10\ncodeforces", "5\naaaaa"] | NoteThe first example has lots of correct answers. Please, restrain yourself from asking if some specific answer is correct for some specific test or not, these questions always lead to "No comments" answer. | PASSED | 1,000 | standard input | 1 second | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$) β the length of string $$$s$$$. The second line is the string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. | ["YES\ncode", "NO"] | #include <stdio.h>
int main()
{
int n, find = -1;
char data[1005];
scanf("%d", &n);
scanf("%s", data);
for (int i = 0; i < n - 1; ++i)
if (data[i] != data[i + 1])
{
printf("YES\n%c%c", data[i], data[i + 1]);
find = 1;
break;
}
if (find < 0)
printf("NO");
return 0;
} | |
You are given a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters.A substring of string $$$s$$$ is a continuous segment of letters from $$$s$$$. For example, "defor" is a substring of "codeforces" and "fors" is not. The length of the substring is the number of letters in it.Let's call some string of length ... | Print "NO" if there is no diverse substring in the string $$$s$$$. Otherwise the first line should contain "YES". The second line should contain any diverse substring of string $$$s$$$. | C | ce4443581d4ee12db6607695cd567070 | 788b76319727fbc605cd3d890c76e5ee | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1540478100 | ["10\ncodeforces", "5\naaaaa"] | NoteThe first example has lots of correct answers. Please, restrain yourself from asking if some specific answer is correct for some specific test or not, these questions always lead to "No comments" answer. | PASSED | 1,000 | standard input | 1 second | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$) β the length of string $$$s$$$. The second line is the string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. | ["YES\ncode", "NO"] | #include <stdio.h>
int main(void){
char a[1000];
int m = 0;
scanf("%d", &m);
scanf("%s", a);
int i = 0;
for(i = 1;i < m; i++)
{
if(a[i-1] != a[i])
{
printf("YES\n%c%c", a[i-1], a[i]);
goto bbb;
}
}
if(i == m) printf("NO");
bbb: return 0;
} | |
You are given a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters.A substring of string $$$s$$$ is a continuous segment of letters from $$$s$$$. For example, "defor" is a substring of "codeforces" and "fors" is not. The length of the substring is the number of letters in it.Let's call some string of length ... | Print "NO" if there is no diverse substring in the string $$$s$$$. Otherwise the first line should contain "YES". The second line should contain any diverse substring of string $$$s$$$. | C | ce4443581d4ee12db6607695cd567070 | 43bcb0e02d0790bc49d67aeec7bb8c55 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1540478100 | ["10\ncodeforces", "5\naaaaa"] | NoteThe first example has lots of correct answers. Please, restrain yourself from asking if some specific answer is correct for some specific test or not, these questions always lead to "No comments" answer. | PASSED | 1,000 | standard input | 1 second | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$) β the length of string $$$s$$$. The second line is the string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. | ["YES\ncode", "NO"] | #include<stdio.h>
#include<string.h>
int main()
{
int n,i,a[26]={0},b[26]={0},c=0;
char s[10005];
scanf("%d",&n);
scanf("%s",s);
for(i=0;i<strlen(s);i++)
a[s[i]-'a']++;
for(i=0;i<26;i++){
if(a[i]>0)
c++;
if(c>1){
printf("YES\n");
break;
}
}
if(c==1){
printf("NO\n");
return 0;
}
... | |
You are given a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters.A substring of string $$$s$$$ is a continuous segment of letters from $$$s$$$. For example, "defor" is a substring of "codeforces" and "fors" is not. The length of the substring is the number of letters in it.Let's call some string of length ... | Print "NO" if there is no diverse substring in the string $$$s$$$. Otherwise the first line should contain "YES". The second line should contain any diverse substring of string $$$s$$$. | C | ce4443581d4ee12db6607695cd567070 | c2ed067b411ef9e0804b42d1816a8161 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1540478100 | ["10\ncodeforces", "5\naaaaa"] | NoteThe first example has lots of correct answers. Please, restrain yourself from asking if some specific answer is correct for some specific test or not, these questions always lead to "No comments" answer. | PASSED | 1,000 | standard input | 1 second | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$) β the length of string $$$s$$$. The second line is the string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. | ["YES\ncode", "NO"] | #include<stdio.h>
#include<string.h>
int main()
{
int n;
scanf("%d", &n);
char input[n];
scanf("%s", input);
int check[26], i, j, max=1, prev=0;
prev=input[0]-97;
for(i=1; i<n; i++)
{
if(prev==input[i]-97)
{
max++;
}
else
{
... | |
You are given a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters.A substring of string $$$s$$$ is a continuous segment of letters from $$$s$$$. For example, "defor" is a substring of "codeforces" and "fors" is not. The length of the substring is the number of letters in it.Let's call some string of length ... | Print "NO" if there is no diverse substring in the string $$$s$$$. Otherwise the first line should contain "YES". The second line should contain any diverse substring of string $$$s$$$. | C | ce4443581d4ee12db6607695cd567070 | 85e5c9e72bd4cdeeb4a6b1cc0404f93d | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1540478100 | ["10\ncodeforces", "5\naaaaa"] | NoteThe first example has lots of correct answers. Please, restrain yourself from asking if some specific answer is correct for some specific test or not, these questions always lead to "No comments" answer. | PASSED | 1,000 | standard input | 1 second | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$) β the length of string $$$s$$$. The second line is the string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. | ["YES\ncode", "NO"] | #include <stdio.h>
int count=1;
int NotAvailable(char* str, int begin, int k)
{
for (int i=k-1; i>=begin; i--)
{
if(str[i]==str[k]&&++count>(k-begin+1)/2)
{
count=1;
return 0;
}
}
count=1;
return 1;
}
int main (void)
{
int n;
char str[1005];
scanf("%d", &n);
scanf("%s", str);
int begin=0, end... | |
You are given a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters.A substring of string $$$s$$$ is a continuous segment of letters from $$$s$$$. For example, "defor" is a substring of "codeforces" and "fors" is not. The length of the substring is the number of letters in it.Let's call some string of length ... | Print "NO" if there is no diverse substring in the string $$$s$$$. Otherwise the first line should contain "YES". The second line should contain any diverse substring of string $$$s$$$. | C | ce4443581d4ee12db6607695cd567070 | daa665a837df96d2de50cf0b36706c10 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1540478100 | ["10\ncodeforces", "5\naaaaa"] | NoteThe first example has lots of correct answers. Please, restrain yourself from asking if some specific answer is correct for some specific test or not, these questions always lead to "No comments" answer. | PASSED | 1,000 | standard input | 1 second | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$) β the length of string $$$s$$$. The second line is the string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. | ["YES\ncode", "NO"] | #include<stdio.h>
int main()
{
int n,f=0,p=0;
scanf("%d",&n);
char ch[n+1];
scanf("%s",ch);
ch[n]='\0';
for(int i=0;i<n-1;i++)
{
if(ch[i]!=ch[i+1])
{
p=i;
f=1;
break;
}
}
if(f==1)
{
printf("%s\n%c%c","YES",ch[p],ch[p+1]);
}
else
printf("%s... | |
You are given a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters.A substring of string $$$s$$$ is a continuous segment of letters from $$$s$$$. For example, "defor" is a substring of "codeforces" and "fors" is not. The length of the substring is the number of letters in it.Let's call some string of length ... | Print "NO" if there is no diverse substring in the string $$$s$$$. Otherwise the first line should contain "YES". The second line should contain any diverse substring of string $$$s$$$. | C | ce4443581d4ee12db6607695cd567070 | 6505f532dc40fe08718631d9d4bb0acc | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation",
"strings"
] | 1540478100 | ["10\ncodeforces", "5\naaaaa"] | NoteThe first example has lots of correct answers. Please, restrain yourself from asking if some specific answer is correct for some specific test or not, these questions always lead to "No comments" answer. | PASSED | 1,000 | standard input | 1 second | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$) β the length of string $$$s$$$. The second line is the string $$$s$$$, consisting of exactly $$$n$$$ lowercase Latin letters. | ["YES\ncode", "NO"] | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void){
int n;
int i;
int t = 0;
int k;
scanf("%d", &n);
char s[n];
scanf("%s", s);
for(i = 0; i < n - 1; i++){
if(s[i] != s[i + 1]){
t = 1;
k = i;
break;
}
}
if(t == 0){
printf("NO\n");
}else... | |
Little John aspires to become a plumber! Today he has drawn a grid consisting of n rows and m columns, consisting of nβΓβm square cells.In each cell he will draw a pipe segment. He can only draw four types of segments numbered from 1 to 4, illustrated as follows: Each pipe segment has two ends, illustrated by the arro... | Print a single integer denoting the number of possible final non-leaking pipe systems modulo 1000003 (106β+β3). If there are no such configurations, print 0. | C | 07cbcf6e1f1e7f1a6ec45241cf9ac2a9 | d34ab8e14422b310ffb95e3142291fdb | GNU C | standard output | 256 megabytes | train_000.jsonl | [] | 1316098800 | ["2 2\n13\n..", "3 1\n1\n4\n.", "2 2\n3.\n.1"] | NoteFor the first example, the initial configuration of the grid is as follows. The only two possible final non-leaking pipe configurations are as follows: For the second example, the initial grid is already leaking, so there will be no final grid that is non-leaking.For the final example, there's only one possibl... | PASSED | 2,200 | standard input | 3 seconds | The first line will contain two single-space separated integers n and m (1ββ€βn,βm,βnΒ·mββ€β5Β·105) β the number of rows and columns respectively. Then n lines follow, each contains exactly m characters β the description of the grid. Each character describes a cell and is either one of these: "1" - "4" β a pipe segment ... | ["2", "0", "1"] | #include <stdio.h>
int a[500000][2];
int b[500000][2];
int main()
{
int n, m, x = 1, mod = 1000003, i, j;
char s[500001];
scanf("%d %d", &n, &m);
for (i = 0; i < n; i++) {
for (j = 0; j < 2; j++) {
a[i][j] = 1;
}
}
for (i = 0; i < m; i++) {
for (j = 0; j < 2; j++) {
b[i][j] = 1... | |
A string is called palindrome if it reads the same from left to right and from right to left. For example "kazak", "oo", "r" and "mikhailrubinchikkihcniburliahkim" are palindroms, but strings "abb" and "ij" are not.You are given string s consisting of lowercase Latin letters. At once you can choose any position in the ... | Print the lexicographically smallest palindrome that can be obtained with the minimal number of changes. | C | f996224809df700265d940b12622016f | a1dcf15c624646f6fd8dcf3c14d010d0 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms",
"greedy",
"strings"
] | 1448636400 | ["aabc", "aabcd"] | null | PASSED | 1,800 | standard input | 2 seconds | The only line contains string s (1ββ€β|s|ββ€β2Β·105) consisting of only lowercase Latin letters. | ["abba", "abcba"] | #include<stdio.h>
#include<string.h>
int check(int* q,int s,int l)
{ if(s<0)
return l;
s--;
if(q[s]%2!=0)
{ q[s]-=1;
l++;
l=check(q,s,l);
if(l>1&&(q[s]%2==0))
{
q[s]+=2;
l-=2;
return l;
}
if(l==1&&(q[s]%2==0))
{
q[s]+=1;
... | |
A string is called palindrome if it reads the same from left to right and from right to left. For example "kazak", "oo", "r" and "mikhailrubinchikkihcniburliahkim" are palindroms, but strings "abb" and "ij" are not.You are given string s consisting of lowercase Latin letters. At once you can choose any position in the ... | Print the lexicographically smallest palindrome that can be obtained with the minimal number of changes. | C | f996224809df700265d940b12622016f | 1c1fa8b80006b62b0ab7ebb274380edc | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms",
"greedy",
"strings"
] | 1448636400 | ["aabc", "aabcd"] | null | PASSED | 1,800 | standard input | 2 seconds | The only line contains string s (1ββ€β|s|ββ€β2Β·105) consisting of only lowercase Latin letters. | ["abba", "abcba"] | #include <stdio.h>
int main()
{
char s[200005];
int a[27],i,j,k;
scanf("%s",s);
//printf("%c\n",s[0]);
for(i=0;i<27;i++)
{
a[i]=0;
}
i=0;
while(s[i]!='\0')
{
a[s[i]-96]++;
i++;
}
int l=i,m=0,n=27;
//printf("%d\n",i);
while(1)
{
for(i=m+1;i<=26;i++)
{
if( (a[i]%2) !=0 )
{
m=i;
... | |
A string is called palindrome if it reads the same from left to right and from right to left. For example "kazak", "oo", "r" and "mikhailrubinchikkihcniburliahkim" are palindroms, but strings "abb" and "ij" are not.You are given string s consisting of lowercase Latin letters. At once you can choose any position in the ... | Print the lexicographically smallest palindrome that can be obtained with the minimal number of changes. | C | f996224809df700265d940b12622016f | b00cb9c3f067b986ef409f7531c8a31a | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms",
"greedy",
"strings"
] | 1448636400 | ["aabc", "aabcd"] | null | PASSED | 1,800 | standard input | 2 seconds | The only line contains string s (1ββ€β|s|ββ€β2Β·105) consisting of only lowercase Latin letters. | ["abba", "abcba"] | #include <stdio.h>
#include <string.h>
#define MAX 200000
int hist[256];
int main ()
{
char c;
int n,i,j,k;
int num_odd = 0;
i = 0;
while ('\n' != (c = getchar()))
{
i++;
hist[c]++;
}
n = i;
for (i = 'a'; i <= 'z'; i++)
{
if (hist[i] % 2 == 1)
... | |
A string is called palindrome if it reads the same from left to right and from right to left. For example "kazak", "oo", "r" and "mikhailrubinchikkihcniburliahkim" are palindroms, but strings "abb" and "ij" are not.You are given string s consisting of lowercase Latin letters. At once you can choose any position in the ... | Print the lexicographically smallest palindrome that can be obtained with the minimal number of changes. | C | f996224809df700265d940b12622016f | d7eb3cf7cc3781079337c315d05bb99c | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms",
"greedy",
"strings"
] | 1448636400 | ["aabc", "aabcd"] | null | PASSED | 1,800 | standard input | 2 seconds | The only line contains string s (1ββ€β|s|ββ€β2Β·105) consisting of only lowercase Latin letters. | ["abba", "abcba"] | #include <stdio.h>
#define SIZE 200000
char s[SIZE];
int a['z' - 'a'];
char make_change (int a[])
{
int i = 0, j = 'z' - 'a';
char c = '*';
while (i < j) {
while (i < j && a[i] % 2 == 0)
i++;
while (i < j && a[j] % 2 == 0)
j--;
if (i < j) {
a[i]++, a[j]--;
i++, j--;
}
}
if (a[i] % 2 == 1) ... | |
A string is called palindrome if it reads the same from left to right and from right to left. For example "kazak", "oo", "r" and "mikhailrubinchikkihcniburliahkim" are palindroms, but strings "abb" and "ij" are not.You are given string s consisting of lowercase Latin letters. At once you can choose any position in the ... | Print the lexicographically smallest palindrome that can be obtained with the minimal number of changes. | C | f996224809df700265d940b12622016f | e8dc12429180342f0eb97ff2fc9e9094 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms",
"greedy",
"strings"
] | 1448636400 | ["aabc", "aabcd"] | null | PASSED | 1,800 | standard input | 2 seconds | The only line contains string s (1ββ€β|s|ββ€β2Β·105) consisting of only lowercase Latin letters. | ["abba", "abcba"] | #include<stdio.h>
#include<string.h>
int main(){
int s,k,a=(int)'a',len=0;
int cant[26];
unsigned char cad;
memset(cant,0,sizeof(int)*26);
while(1){
scanf("%c",&cad);
if(cad<'a' || cad>'z'){
break;
}
cant[(int)cad-a]++;
}
k=25;
for(s=0;s<26;s++... | |
A string is called palindrome if it reads the same from left to right and from right to left. For example "kazak", "oo", "r" and "mikhailrubinchikkihcniburliahkim" are palindroms, but strings "abb" and "ij" are not.You are given string s consisting of lowercase Latin letters. At once you can choose any position in the ... | Print the lexicographically smallest palindrome that can be obtained with the minimal number of changes. | C | f996224809df700265d940b12622016f | 6493560368b912172fc1d4d4d8b7bdf1 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms",
"greedy",
"strings"
] | 1448636400 | ["aabc", "aabcd"] | null | PASSED | 1,800 | standard input | 2 seconds | The only line contains string s (1ββ€β|s|ββ€β2Β·105) consisting of only lowercase Latin letters. | ["abba", "abcba"] | #include <stdio.h>
#include <string.h>
#define MAXN 200001
int main() {
char s[MAXN];
long a[26] = {0}, ind[26], oddCount = 0, halfLen = 0;
scanf("%s", s);
long n = strlen(s);
for (long i = 0; i < n; ++i)
++a[s[i]-'a'];
for (long i = 0; i < 26; ++i)
if (a[i] % 2 == 1)
... | |
A string is called palindrome if it reads the same from left to right and from right to left. For example "kazak", "oo", "r" and "mikhailrubinchikkihcniburliahkim" are palindroms, but strings "abb" and "ij" are not.You are given string s consisting of lowercase Latin letters. At once you can choose any position in the ... | Print the lexicographically smallest palindrome that can be obtained with the minimal number of changes. | C | f996224809df700265d940b12622016f | 59f0277a04c3fa34f7b48ba88f32c720 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms",
"greedy",
"strings"
] | 1448636400 | ["aabc", "aabcd"] | null | PASSED | 1,800 | standard input | 2 seconds | The only line contains string s (1ββ€β|s|ββ€β2Β·105) consisting of only lowercase Latin letters. | ["abba", "abcba"] | #include<stdio.h>
#include<string.h>
int main()
{
long int freq[27]={0},i,max,j,n,p=0;
char str[200010],c;
scanf("%s",str);
for(i=0;str[i]!='\0';i++)
freq[str[i]-'a']++;
n=strlen(str);
for(i=0,j=25;i<j;)
{
if(freq[i]%2!=0&&freq[j]%2!=0)
{
freq[i]++;
... | |
A string is called palindrome if it reads the same from left to right and from right to left. For example "kazak", "oo", "r" and "mikhailrubinchikkihcniburliahkim" are palindroms, but strings "abb" and "ij" are not.You are given string s consisting of lowercase Latin letters. At once you can choose any position in the ... | Print the lexicographically smallest palindrome that can be obtained with the minimal number of changes. | C | f996224809df700265d940b12622016f | ed1040c8ab7750682cedd73f5dd1d54d | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms",
"greedy",
"strings"
] | 1448636400 | ["aabc", "aabcd"] | null | PASSED | 1,800 | standard input | 2 seconds | The only line contains string s (1ββ€β|s|ββ€β2Β·105) consisting of only lowercase Latin letters. | ["abba", "abcba"] | #include <stdio.h>
#define MAX_LEN 200001
#define ALPHABETS 26
#define SMALL_A 97
char STRING[MAX_LEN];
int charCount[ALPHABETS] = {0,};
void printArray(int len)
{
int i;
for(i=0 ; i<len ; i++){
if(charCount[i] != 0)
printf("%c: %d\n",i+SMALL_A,charCount[i]);
... | |
A string is called palindrome if it reads the same from left to right and from right to left. For example "kazak", "oo", "r" and "mikhailrubinchikkihcniburliahkim" are palindroms, but strings "abb" and "ij" are not.You are given string s consisting of lowercase Latin letters. At once you can choose any position in the ... | Print the lexicographically smallest palindrome that can be obtained with the minimal number of changes. | C | f996224809df700265d940b12622016f | 63fee45cb095393e1d24d7bbe0d3669d | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms",
"greedy",
"strings"
] | 1448636400 | ["aabc", "aabcd"] | null | PASSED | 1,800 | standard input | 2 seconds | The only line contains string s (1ββ€β|s|ββ€β2Β·105) consisting of only lowercase Latin letters. | ["abba", "abcba"] | #include<stdio.h>
#include<string.h>
int main()
{
char s[1000000];
scanf("%s",s);
int a[26];
int l=strlen(s);
for(int i=0;i<26;i++)
a[i]=0;
for(int i=0;i<l;i++)
{
a[(int)s[i]-(int)'a']++;
}
for(int i=0;i<26;i++)
{
... | |
A string is called palindrome if it reads the same from left to right and from right to left. For example "kazak", "oo", "r" and "mikhailrubinchikkihcniburliahkim" are palindroms, but strings "abb" and "ij" are not.You are given string s consisting of lowercase Latin letters. At once you can choose any position in the ... | Print the lexicographically smallest palindrome that can be obtained with the minimal number of changes. | C | f996224809df700265d940b12622016f | e758a5e6898e03a72064cbea0fdcfa14 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"constructive algorithms",
"greedy",
"strings"
] | 1448636400 | ["aabc", "aabcd"] | null | PASSED | 1,800 | standard input | 2 seconds | The only line contains string s (1ββ€β|s|ββ€β2Β·105) consisting of only lowercase Latin letters. | ["abba", "abcba"] | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
//input definitions
#define sd(x) scanf("%d",&x);
#define slld(x) scanf("%lld",&x);
#define ss(x) scanf("%s",x);
#define sf(x) scanf("%f",&x);
#define slf(x) scanf("%lf",&x);
//output definitions
#define pd(x) printf("%d",x);
#define plld(x) printf("%lld",x);
#d... | |
As you might remember from the previous round, Vova is currently playing a strategic game known as Rage of Empires.Vova managed to build a large army, but forgot about the main person in the army - the commander. So he tries to hire a commander, and he wants to choose the person who will be respected by warriors.Each w... | For each event of the third type print one integer β the number of warriors who respect the commander Vova tries to hire in the event. | C | b12f2784bafb3db74598a22ac4603646 | 0f2fd2fe2d5c894d0f59989adb3b9263 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"data structures",
"bitmasks",
"trees"
] | 1497539100 | ["5\n1 3\n1 4\n3 6 3\n2 4\n3 6 3"] | NoteIn the example the army consists of two warriors with personalities 3 and 4 after first two events. Then Vova tries to hire a commander with personality 6 and leadership 3, and only one warrior respects him (, and 2β<β3, but , and 5ββ₯β3). Then warrior with personality 4 leaves, and when Vova tries to hire that c... | PASSED | 2,000 | standard input | 2 seconds | The first line contains one integer q (1ββ€βqββ€β100000) β the number of events. Then q lines follow. Each line describes the event: 1Β pi (1ββ€βpiββ€β108) β one warrior with personality pi joins Vova's army; 2Β pi (1ββ€βpiββ€β108) β one warrior with personality pi leaves Vova's army (it is guaranteed that there is at least... | ["1\n0"] | #include <stdio.h>
#include <malloc.h>
struct node {
struct node *r;
struct node *l;
int sum;
};
struct node *get() {
struct node *ret = malloc(sizeof(struct node));
ret->r = NULL;
ret->l = NULL;
ret->sum = 0;
return ret;
}
void add(struct node *root, int val, int inc) {
struct no... | |
As you might remember from the previous round, Vova is currently playing a strategic game known as Rage of Empires.Vova managed to build a large army, but forgot about the main person in the army - the commander. So he tries to hire a commander, and he wants to choose the person who will be respected by warriors.Each w... | For each event of the third type print one integer β the number of warriors who respect the commander Vova tries to hire in the event. | C | b12f2784bafb3db74598a22ac4603646 | 501867f5e4839c159e12182a5d5a6648 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"data structures",
"bitmasks",
"trees"
] | 1497539100 | ["5\n1 3\n1 4\n3 6 3\n2 4\n3 6 3"] | NoteIn the example the army consists of two warriors with personalities 3 and 4 after first two events. Then Vova tries to hire a commander with personality 6 and leadership 3, and only one warrior respects him (, and 2β<β3, but , and 5ββ₯β3). Then warrior with personality 4 leaves, and when Vova tries to hire that c... | PASSED | 2,000 | standard input | 2 seconds | The first line contains one integer q (1ββ€βqββ€β100000) β the number of events. Then q lines follow. Each line describes the event: 1Β pi (1ββ€βpiββ€β108) β one warrior with personality pi joins Vova's army; 2Β pi (1ββ€βpiββ€β108) β one warrior with personality pi leaves Vova's army (it is guaranteed that there is at least... | ["1\n0"] | #include <stdio.h>
#include <malloc.h>
struct trie{
struct trie *lc;
struct trie *rc;
int z;
};
struct trie *get(void){
struct trie *ret = malloc(sizeof(struct trie)) ;
ret->z=0;
ret->lc = NULL;
ret->rc = NULL;
return ret;
}
void add(struct trie *root ,int x){
struct trie * tmp = root;
int ind;
for(int i=27... | |
As you might remember from the previous round, Vova is currently playing a strategic game known as Rage of Empires.Vova managed to build a large army, but forgot about the main person in the army - the commander. So he tries to hire a commander, and he wants to choose the person who will be respected by warriors.Each w... | For each event of the third type print one integer β the number of warriors who respect the commander Vova tries to hire in the event. | C | b12f2784bafb3db74598a22ac4603646 | 47c2e765700b25cc9b901508e486474c | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"data structures",
"bitmasks",
"trees"
] | 1497539100 | ["5\n1 3\n1 4\n3 6 3\n2 4\n3 6 3"] | NoteIn the example the army consists of two warriors with personalities 3 and 4 after first two events. Then Vova tries to hire a commander with personality 6 and leadership 3, and only one warrior respects him (, and 2β<β3, but , and 5ββ₯β3). Then warrior with personality 4 leaves, and when Vova tries to hire that c... | PASSED | 2,000 | standard input | 2 seconds | The first line contains one integer q (1ββ€βqββ€β100000) β the number of events. Then q lines follow. Each line describes the event: 1Β pi (1ββ€βpiββ€β108) β one warrior with personality pi joins Vova's army; 2Β pi (1ββ€βpiββ€β108) β one warrior with personality pi leaves Vova's army (it is guaranteed that there is at least... | ["1\n0"] | #include <stdio.h>
#include <malloc.h>
struct trie{
struct trie *lc;
struct trie *rc;
int z;
};
struct trie *get(void){
struct trie *ret = malloc(sizeof(struct trie)) ;
ret->z=0;
ret->lc = NULL;
ret->rc = NULL;
return ret;
}
void add(struct trie *root ,int x){
struct trie * tmp = root;
int ind;
for(int i=32... | |
Consider a table of size $$$n \times m$$$, initially fully white. Rows are numbered $$$1$$$ through $$$n$$$ from top to bottom, columns $$$1$$$ through $$$m$$$ from left to right. Some square inside the table with odd side length was painted black. Find the center of this square. | Output two integers $$$r$$$ and $$$c$$$ ($$$1 \le r \le n$$$, $$$1 \le c \le m$$$) separated by a space β the row and column numbers of the center of the black square. | C | 524273686586cdeb7827ffc1ad59d85a | c10f1cb5cf957b47669a56024b9cd593 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1535387700 | ["5 6\nWWBBBW\nWWBBBW\nWWBBBW\nWWWWWW\nWWWWWW", "3 3\nWWW\nBWW\nWWW"] | null | PASSED | 800 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 115$$$) β the number of rows and the number of columns in the table. The $$$i$$$-th of the next $$$n$$$ lines contains a string of $$$m$$$ characters $$$s_{i1} s_{i2} \ldots s_{im}$$$ ($$$s_{ij}$$$ is 'W' for white cells and 'B' for black cells... | ["2 4", "2 1"] | #include <stdio.h>
int main()
{
int n, m;
scanf("%d%d", &n, &m);
char s[m+2];
char bStart = 0;
int x1, y1, x2, y2;
for(int i = 1; i <= n; i++)
{
scanf("%s", s);
for(int j = 0; j < m; j++)
{
if(s[j] == 'W') continue;
if(bStart == 0)
... | |
Consider a table of size $$$n \times m$$$, initially fully white. Rows are numbered $$$1$$$ through $$$n$$$ from top to bottom, columns $$$1$$$ through $$$m$$$ from left to right. Some square inside the table with odd side length was painted black. Find the center of this square. | Output two integers $$$r$$$ and $$$c$$$ ($$$1 \le r \le n$$$, $$$1 \le c \le m$$$) separated by a space β the row and column numbers of the center of the black square. | C | 524273686586cdeb7827ffc1ad59d85a | 9f4b38c34ccc1c427aa42b40a0e2535c | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1535387700 | ["5 6\nWWBBBW\nWWBBBW\nWWBBBW\nWWWWWW\nWWWWWW", "3 3\nWWW\nBWW\nWWW"] | null | PASSED | 800 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 115$$$) β the number of rows and the number of columns in the table. The $$$i$$$-th of the next $$$n$$$ lines contains a string of $$$m$$$ characters $$$s_{i1} s_{i2} \ldots s_{im}$$$ ($$$s_{ij}$$$ is 'W' for white cells and 'B' for black cells... | ["2 4", "2 1"] | #include<stdio.h>
#include<string.h>
int main()
{
char a;
long long i,t,c=0,d=0,n,m,j,x,q,p;
scanf("%lld %lld\n",&n,&m);
p=0;q=0;c=0;d=0;
for(i=1;i<=n;i++)
{
for(j=1;j<=m;j++)
{
scanf("%c",&a);
if(a=='B')
{p+=i;c++;
q+=j;d++;}
}
s... | |
Consider a table of size $$$n \times m$$$, initially fully white. Rows are numbered $$$1$$$ through $$$n$$$ from top to bottom, columns $$$1$$$ through $$$m$$$ from left to right. Some square inside the table with odd side length was painted black. Find the center of this square. | Output two integers $$$r$$$ and $$$c$$$ ($$$1 \le r \le n$$$, $$$1 \le c \le m$$$) separated by a space β the row and column numbers of the center of the black square. | C | 524273686586cdeb7827ffc1ad59d85a | 0936975d80000bf9aa13a60d403ec564 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1535387700 | ["5 6\nWWBBBW\nWWBBBW\nWWBBBW\nWWWWWW\nWWWWWW", "3 3\nWWW\nBWW\nWWW"] | null | PASSED | 800 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 115$$$) β the number of rows and the number of columns in the table. The $$$i$$$-th of the next $$$n$$$ lines contains a string of $$$m$$$ characters $$$s_{i1} s_{i2} \ldots s_{im}$$$ ($$$s_{ij}$$$ is 'W' for white cells and 'B' for black cells... | ["2 4", "2 1"] | #include <stdio.h>
#include <stdlib.h>
void findSquare(int** matrix, int n, int m, int* a, int* b, int* len) {
int i, j, k;
*len = 0;
for (i = 0; i < n; i++) {
for (j = 0; j < m; j++) {
if (!matrix[i][j]) {
*a = i;
*b = j;
for (k = i; k < n; k++) {
if (matrix[k][j]) {
return;
}
... | |
Consider a table of size $$$n \times m$$$, initially fully white. Rows are numbered $$$1$$$ through $$$n$$$ from top to bottom, columns $$$1$$$ through $$$m$$$ from left to right. Some square inside the table with odd side length was painted black. Find the center of this square. | Output two integers $$$r$$$ and $$$c$$$ ($$$1 \le r \le n$$$, $$$1 \le c \le m$$$) separated by a space β the row and column numbers of the center of the black square. | C | 524273686586cdeb7827ffc1ad59d85a | 9be8dd415d587483c792e241f5aaceb3 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1535387700 | ["5 6\nWWBBBW\nWWBBBW\nWWBBBW\nWWWWWW\nWWWWWW", "3 3\nWWW\nBWW\nWWW"] | null | PASSED | 800 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 115$$$) β the number of rows and the number of columns in the table. The $$$i$$$-th of the next $$$n$$$ lines contains a string of $$$m$$$ characters $$$s_{i1} s_{i2} \ldots s_{im}$$$ ($$$s_{ij}$$$ is 'W' for white cells and 'B' for black cells... | ["2 4", "2 1"] | #include<stdio.h>
int main()
{
int n,m,i,p,q,num=0;
scanf("%d %d",&n,&m);
char s[n+1][m+1];
for(i=0;i<n;i=i+1)
{
scanf("%s",&s[i]);
}
for(i=0;i<n;i=i+1)
{
int j=0;
num=0;
while(s[i][j]!=0)
{
if(s[i][j]=='B')
{
... | |
Consider a table of size $$$n \times m$$$, initially fully white. Rows are numbered $$$1$$$ through $$$n$$$ from top to bottom, columns $$$1$$$ through $$$m$$$ from left to right. Some square inside the table with odd side length was painted black. Find the center of this square. | Output two integers $$$r$$$ and $$$c$$$ ($$$1 \le r \le n$$$, $$$1 \le c \le m$$$) separated by a space β the row and column numbers of the center of the black square. | C | 524273686586cdeb7827ffc1ad59d85a | 140dae1a573edf0ab1680dbaf703d021 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1535387700 | ["5 6\nWWBBBW\nWWBBBW\nWWBBBW\nWWWWWW\nWWWWWW", "3 3\nWWW\nBWW\nWWW"] | null | PASSED | 800 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 115$$$) β the number of rows and the number of columns in the table. The $$$i$$$-th of the next $$$n$$$ lines contains a string of $$$m$$$ characters $$$s_{i1} s_{i2} \ldots s_{im}$$$ ($$$s_{ij}$$$ is 'W' for white cells and 'B' for black cells... | ["2 4", "2 1"] | #include<stdio.h>
#include<string.h>
int main(){
int n,m,i, r_start, r_end, c_start, c_end, mid_x, mid_y, j, black = 0;
char sq[120][120];
scanf("%d %d",&n,&m);
for(i=0;i<n;i++)
scanf("%s", sq[i]);
for(i=0;i<n;i++){
for(j=0;j<m;j++){
if(sq[i][j]=='B' && black==0){
... | |
Consider a table of size $$$n \times m$$$, initially fully white. Rows are numbered $$$1$$$ through $$$n$$$ from top to bottom, columns $$$1$$$ through $$$m$$$ from left to right. Some square inside the table with odd side length was painted black. Find the center of this square. | Output two integers $$$r$$$ and $$$c$$$ ($$$1 \le r \le n$$$, $$$1 \le c \le m$$$) separated by a space β the row and column numbers of the center of the black square. | C | 524273686586cdeb7827ffc1ad59d85a | afb0f75797ab413b0ac08341d1f6f9fa | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1535387700 | ["5 6\nWWBBBW\nWWBBBW\nWWBBBW\nWWWWWW\nWWWWWW", "3 3\nWWW\nBWW\nWWW"] | null | PASSED | 800 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 115$$$) β the number of rows and the number of columns in the table. The $$$i$$$-th of the next $$$n$$$ lines contains a string of $$$m$$$ characters $$$s_{i1} s_{i2} \ldots s_{im}$$$ ($$$s_{ij}$$$ is 'W' for white cells and 'B' for black cells... | ["2 4", "2 1"] | #include<stdio.h>
#include<string.h>
int main()
{
char a;
long long i,t,c=0,d=0,n,m,j,x,q,p;
scanf("%lld %lld\n",&n,&m);
p=0;q=0;c=0;d=0;
for(i=1;i<=n;i++)
{
for(j=1;j<=m;j++)
{
scanf("%c",&a);
if(a=='B')
{p+=i;c++;
q+=j;d++;}
}
s... | |
Consider a table of size $$$n \times m$$$, initially fully white. Rows are numbered $$$1$$$ through $$$n$$$ from top to bottom, columns $$$1$$$ through $$$m$$$ from left to right. Some square inside the table with odd side length was painted black. Find the center of this square. | Output two integers $$$r$$$ and $$$c$$$ ($$$1 \le r \le n$$$, $$$1 \le c \le m$$$) separated by a space β the row and column numbers of the center of the black square. | C | 524273686586cdeb7827ffc1ad59d85a | ae7ff6c408bb2596dfe0512f01fb5797 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1535387700 | ["5 6\nWWBBBW\nWWBBBW\nWWBBBW\nWWWWWW\nWWWWWW", "3 3\nWWW\nBWW\nWWW"] | null | PASSED | 800 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 115$$$) β the number of rows and the number of columns in the table. The $$$i$$$-th of the next $$$n$$$ lines contains a string of $$$m$$$ characters $$$s_{i1} s_{i2} \ldots s_{im}$$$ ($$$s_{ij}$$$ is 'W' for white cells and 'B' for black cells... | ["2 4", "2 1"] | #include<stdio.h>
int main()
{
int R,C,r,c,len=0,i,j;
char a[120][120],g;
scanf("%d %d",&R,&C);
scanf("%c",&g);
for(i=1;i<=R;i++)
{
for(j=1;j<=C;j++)
{
scanf("%c",&a[i][j]);
}
scanf("%c",&g);
}
i=1;
for(i=1;i<=R;i++)
for(j=1;j<=C;j++)
{
if(a[i][j]=='B')
{ len++;
r=i;c=j;
j--;
i... | |
Consider a table of size $$$n \times m$$$, initially fully white. Rows are numbered $$$1$$$ through $$$n$$$ from top to bottom, columns $$$1$$$ through $$$m$$$ from left to right. Some square inside the table with odd side length was painted black. Find the center of this square. | Output two integers $$$r$$$ and $$$c$$$ ($$$1 \le r \le n$$$, $$$1 \le c \le m$$$) separated by a space β the row and column numbers of the center of the black square. | C | 524273686586cdeb7827ffc1ad59d85a | 581beb04bea840cdfb988693f68aa54a | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1535387700 | ["5 6\nWWBBBW\nWWBBBW\nWWBBBW\nWWWWWW\nWWWWWW", "3 3\nWWW\nBWW\nWWW"] | null | PASSED | 800 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 115$$$) β the number of rows and the number of columns in the table. The $$$i$$$-th of the next $$$n$$$ lines contains a string of $$$m$$$ characters $$$s_{i1} s_{i2} \ldots s_{im}$$$ ($$$s_{ij}$$$ is 'W' for white cells and 'B' for black cells... | ["2 4", "2 1"] | #include<stdio.h>
int main()
{
int n,m,ss,s=0,e=0,ll,l=0,i,j,c=0;
char a[116][116];
scanf("%d%d",&n,&m);
for(i=0; i<n; i++)
{
scanf("%s",a[i]);
if(l==0)
for(j=0; j<m; j++)
if(a[i][j]=='B')
l++;
if(s==0)
for(j=0; j<m;... | |
Consider a table of size $$$n \times m$$$, initially fully white. Rows are numbered $$$1$$$ through $$$n$$$ from top to bottom, columns $$$1$$$ through $$$m$$$ from left to right. Some square inside the table with odd side length was painted black. Find the center of this square. | Output two integers $$$r$$$ and $$$c$$$ ($$$1 \le r \le n$$$, $$$1 \le c \le m$$$) separated by a space β the row and column numbers of the center of the black square. | C | 524273686586cdeb7827ffc1ad59d85a | b3831da4e266d51ce04e86e8d84f90c8 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1535387700 | ["5 6\nWWBBBW\nWWBBBW\nWWBBBW\nWWWWWW\nWWWWWW", "3 3\nWWW\nBWW\nWWW"] | null | PASSED | 800 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 115$$$) β the number of rows and the number of columns in the table. The $$$i$$$-th of the next $$$n$$$ lines contains a string of $$$m$$$ characters $$$s_{i1} s_{i2} \ldots s_{im}$$$ ($$$s_{ij}$$$ is 'W' for white cells and 'B' for black cells... | ["2 4", "2 1"] | #include <stdio.h>
#include <math.h>
int main()
{
int n,m,count=0;
scanf("%d%d",&n,&m);
char arr[n][m];
for(int i=0;i<n;i++)
{
char conv[m+1];
scanf("%s",&conv);
for(int j=0;j<m;j++)
{
if(conv[j]=='B')
{
arr[i][j]=1;
count+=1;
}
else
arr[i][j]=0;
}
}
int loo... | |
Consider a table of size $$$n \times m$$$, initially fully white. Rows are numbered $$$1$$$ through $$$n$$$ from top to bottom, columns $$$1$$$ through $$$m$$$ from left to right. Some square inside the table with odd side length was painted black. Find the center of this square. | Output two integers $$$r$$$ and $$$c$$$ ($$$1 \le r \le n$$$, $$$1 \le c \le m$$$) separated by a space β the row and column numbers of the center of the black square. | C | 524273686586cdeb7827ffc1ad59d85a | a08b4d2ab8aa7f0f17cca4db718faecd | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1535387700 | ["5 6\nWWBBBW\nWWBBBW\nWWBBBW\nWWWWWW\nWWWWWW", "3 3\nWWW\nBWW\nWWW"] | null | PASSED | 800 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 115$$$) β the number of rows and the number of columns in the table. The $$$i$$$-th of the next $$$n$$$ lines contains a string of $$$m$$$ characters $$$s_{i1} s_{i2} \ldots s_{im}$$$ ($$$s_{ij}$$$ is 'W' for white cells and 'B' for black cells... | ["2 4", "2 1"] | #include<stdio.h>
#include<string.h>
int main()
{
int i,j,k=0,b=0,c,s=0,r,m,n;
char a;
scanf("%d %d",&n,&m);
for(i=1;i<=n;i++)
{
scanf("%c",&a);
for(j=1;j<=m;j++)
{
scanf("%c",&a);
if(a=='B')
{
b+=i;
s+=j;
... | |
Consider a table of size $$$n \times m$$$, initially fully white. Rows are numbered $$$1$$$ through $$$n$$$ from top to bottom, columns $$$1$$$ through $$$m$$$ from left to right. Some square inside the table with odd side length was painted black. Find the center of this square. | Output two integers $$$r$$$ and $$$c$$$ ($$$1 \le r \le n$$$, $$$1 \le c \le m$$$) separated by a space β the row and column numbers of the center of the black square. | C | 524273686586cdeb7827ffc1ad59d85a | c34a0cceb7f23af6e37b92e47881b7b0 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1535387700 | ["5 6\nWWBBBW\nWWBBBW\nWWBBBW\nWWWWWW\nWWWWWW", "3 3\nWWW\nBWW\nWWW"] | null | PASSED | 800 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 115$$$) β the number of rows and the number of columns in the table. The $$$i$$$-th of the next $$$n$$$ lines contains a string of $$$m$$$ characters $$$s_{i1} s_{i2} \ldots s_{im}$$$ ($$$s_{ij}$$$ is 'W' for white cells and 'B' for black cells... | ["2 4", "2 1"] | #include<stdio.h>
int main()
{
int n,m,i,j;
scanf("%d%d",&n,&m);
char a[n+1][m+1];
int w=0;
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
scanf(" %c",&a[i][j]);
if(a[i][j]=='B')
{
w++;
}
else
{
... | |
Consider a table of size $$$n \times m$$$, initially fully white. Rows are numbered $$$1$$$ through $$$n$$$ from top to bottom, columns $$$1$$$ through $$$m$$$ from left to right. Some square inside the table with odd side length was painted black. Find the center of this square. | Output two integers $$$r$$$ and $$$c$$$ ($$$1 \le r \le n$$$, $$$1 \le c \le m$$$) separated by a space β the row and column numbers of the center of the black square. | C | 524273686586cdeb7827ffc1ad59d85a | 4b0d68d4d6d248ac19201e4ced1175d3 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1535387700 | ["5 6\nWWBBBW\nWWBBBW\nWWBBBW\nWWWWWW\nWWWWWW", "3 3\nWWW\nBWW\nWWW"] | null | PASSED | 800 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 115$$$) β the number of rows and the number of columns in the table. The $$$i$$$-th of the next $$$n$$$ lines contains a string of $$$m$$$ characters $$$s_{i1} s_{i2} \ldots s_{im}$$$ ($$$s_{ij}$$$ is 'W' for white cells and 'B' for black cells... | ["2 4", "2 1"] | #include<stdio.h>
int main ()
{
long long int count=0,k,l,s,t, i,j,row,col,x,y;
scanf("%lld %lld", &row, &col);
char a[row][col];
for(i=0;i<row;i++)
{
for(j=0;j<col;j++)
{
scanf(" %c", &a[i][j]);
}
}
for(i=0;i<row;i++)
{
for(j=0;j<col;j++)
... | |
Consider a table of size $$$n \times m$$$, initially fully white. Rows are numbered $$$1$$$ through $$$n$$$ from top to bottom, columns $$$1$$$ through $$$m$$$ from left to right. Some square inside the table with odd side length was painted black. Find the center of this square. | Output two integers $$$r$$$ and $$$c$$$ ($$$1 \le r \le n$$$, $$$1 \le c \le m$$$) separated by a space β the row and column numbers of the center of the black square. | C | 524273686586cdeb7827ffc1ad59d85a | 30cfeed0747bf1d95776621f63eb64f6 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1535387700 | ["5 6\nWWBBBW\nWWBBBW\nWWBBBW\nWWWWWW\nWWWWWW", "3 3\nWWW\nBWW\nWWW"] | null | PASSED | 800 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 115$$$) β the number of rows and the number of columns in the table. The $$$i$$$-th of the next $$$n$$$ lines contains a string of $$$m$$$ characters $$$s_{i1} s_{i2} \ldots s_{im}$$$ ($$$s_{ij}$$$ is 'W' for white cells and 'B' for black cells... | ["2 4", "2 1"] | #include<stdio.h>
#include<stdlib.h>
int main() {
int row, column;
scanf("%d %d", &row, &column);
char* currentRow = malloc(column * sizeof(char));
int startWidth = 0, endWidth = 0;
int startHeight = 0, endHeight = 0;
for (int i = 1; i <= row; i++) {
scanf("%s", currentRow);
... | |
Consider a table of size $$$n \times m$$$, initially fully white. Rows are numbered $$$1$$$ through $$$n$$$ from top to bottom, columns $$$1$$$ through $$$m$$$ from left to right. Some square inside the table with odd side length was painted black. Find the center of this square. | Output two integers $$$r$$$ and $$$c$$$ ($$$1 \le r \le n$$$, $$$1 \le c \le m$$$) separated by a space β the row and column numbers of the center of the black square. | C | 524273686586cdeb7827ffc1ad59d85a | 2b103a6e8d8b51de66149d52fb48d065 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1535387700 | ["5 6\nWWBBBW\nWWBBBW\nWWBBBW\nWWWWWW\nWWWWWW", "3 3\nWWW\nBWW\nWWW"] | null | PASSED | 800 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 115$$$) β the number of rows and the number of columns in the table. The $$$i$$$-th of the next $$$n$$$ lines contains a string of $$$m$$$ characters $$$s_{i1} s_{i2} \ldots s_{im}$$$ ($$$s_{ij}$$$ is 'W' for white cells and 'B' for black cells... | ["2 4", "2 1"] | #include<stdio.h>
int main()
{
int n, m,p=0,q=0,cnt=0,f=0,g=0;
scanf("%d%d",&n,&m);
char s[116][116]={'\0'};
for(int i=0;i<n;i++)
scanf("%s",s[i]);
for(int i=0;i<n&&g==0;i++)
{
for(int j=0;j<m;j++)
{
if(s[i][j]=='B')
{
cnt++;
if(f==0)
{
p=i+1;
q=j+1;
... | |
Consider a table of size $$$n \times m$$$, initially fully white. Rows are numbered $$$1$$$ through $$$n$$$ from top to bottom, columns $$$1$$$ through $$$m$$$ from left to right. Some square inside the table with odd side length was painted black. Find the center of this square. | Output two integers $$$r$$$ and $$$c$$$ ($$$1 \le r \le n$$$, $$$1 \le c \le m$$$) separated by a space β the row and column numbers of the center of the black square. | C | 524273686586cdeb7827ffc1ad59d85a | 3db6edcf985df7b033e9459cac7919ce | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1535387700 | ["5 6\nWWBBBW\nWWBBBW\nWWBBBW\nWWWWWW\nWWWWWW", "3 3\nWWW\nBWW\nWWW"] | null | PASSED | 800 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 115$$$) β the number of rows and the number of columns in the table. The $$$i$$$-th of the next $$$n$$$ lines contains a string of $$$m$$$ characters $$$s_{i1} s_{i2} \ldots s_{im}$$$ ($$$s_{ij}$$$ is 'W' for white cells and 'B' for black cells... | ["2 4", "2 1"] | #include <stdio.h>
int main() {
int n, m;
scanf("%d%d ", &n, &m);
char s[120][120];
int x0 = -1, y0 = -1, l = -1;
char t;
// printf("%d %d\n", n, m);
for (int y = 0; y < n; y++) {
for (int x = 0; x < m; x++) {
scanf("%c", &s[y][x]);
if (s[y][x] == 'B') {
... | |
Consider a table of size $$$n \times m$$$, initially fully white. Rows are numbered $$$1$$$ through $$$n$$$ from top to bottom, columns $$$1$$$ through $$$m$$$ from left to right. Some square inside the table with odd side length was painted black. Find the center of this square. | Output two integers $$$r$$$ and $$$c$$$ ($$$1 \le r \le n$$$, $$$1 \le c \le m$$$) separated by a space β the row and column numbers of the center of the black square. | C | 524273686586cdeb7827ffc1ad59d85a | 0224b8643570c1088a88ae99cc5b1a7b | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1535387700 | ["5 6\nWWBBBW\nWWBBBW\nWWBBBW\nWWWWWW\nWWWWWW", "3 3\nWWW\nBWW\nWWW"] | null | PASSED | 800 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 115$$$) β the number of rows and the number of columns in the table. The $$$i$$$-th of the next $$$n$$$ lines contains a string of $$$m$$$ characters $$$s_{i1} s_{i2} \ldots s_{im}$$$ ($$$s_{ij}$$$ is 'W' for white cells and 'B' for black cells... | ["2 4", "2 1"] | #include<stdio.h>
#include<string.h>
//using namespace std;
#define ll long long int
//#define endl "\n"
#define PI acos(-1)
#define sci(n) scanf("%d",&n)
#define scl(n) scanf("%lld",&n)
#define scd(n) scanf("%lf",&n)
#define ... | |
Consider a table of size $$$n \times m$$$, initially fully white. Rows are numbered $$$1$$$ through $$$n$$$ from top to bottom, columns $$$1$$$ through $$$m$$$ from left to right. Some square inside the table with odd side length was painted black. Find the center of this square. | Output two integers $$$r$$$ and $$$c$$$ ($$$1 \le r \le n$$$, $$$1 \le c \le m$$$) separated by a space β the row and column numbers of the center of the black square. | C | 524273686586cdeb7827ffc1ad59d85a | d1c537680a49b5d0932a0901b98c1303 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1535387700 | ["5 6\nWWBBBW\nWWBBBW\nWWBBBW\nWWWWWW\nWWWWWW", "3 3\nWWW\nBWW\nWWW"] | null | PASSED | 800 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 115$$$) β the number of rows and the number of columns in the table. The $$$i$$$-th of the next $$$n$$$ lines contains a string of $$$m$$$ characters $$$s_{i1} s_{i2} \ldots s_{im}$$$ ($$$s_{ij}$$$ is 'W' for white cells and 'B' for black cells... | ["2 4", "2 1"] | #include <stdio.h>
int main()
{
int num,m,sum1=0,sum2=0,c=0,i,j;
char mat[150][150];
scanf("%d%d",&num,&m);
for(i=0;i<num;i++)
{
scanf("%s",&mat[i]);
}
for(i=0;i<num;i++)
{
for(j=0;j<m;j++)
{
if(mat[i][j]=='B')
{
c++;
... | |
Consider a table of size $$$n \times m$$$, initially fully white. Rows are numbered $$$1$$$ through $$$n$$$ from top to bottom, columns $$$1$$$ through $$$m$$$ from left to right. Some square inside the table with odd side length was painted black. Find the center of this square. | Output two integers $$$r$$$ and $$$c$$$ ($$$1 \le r \le n$$$, $$$1 \le c \le m$$$) separated by a space β the row and column numbers of the center of the black square. | C | 524273686586cdeb7827ffc1ad59d85a | 4122d1c4bb354bb17af618dc656d5d0c | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1535387700 | ["5 6\nWWBBBW\nWWBBBW\nWWBBBW\nWWWWWW\nWWWWWW", "3 3\nWWW\nBWW\nWWW"] | null | PASSED | 800 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 115$$$) β the number of rows and the number of columns in the table. The $$$i$$$-th of the next $$$n$$$ lines contains a string of $$$m$$$ characters $$$s_{i1} s_{i2} \ldots s_{im}$$$ ($$$s_{ij}$$$ is 'W' for white cells and 'B' for black cells... | ["2 4", "2 1"] | #include<stdio.h>
#include<string.h>
int main()
{
int n,m,i,j,p,q,x,y,z=0;
scanf("%d %d",&n,&m);
char S[n][m];
for(i=0;i<n;i++)
{
scanf("%s",S[i]);
for(j=0;j<m;j++)
{
if(S[i][j]=='B'&&z==0)
{
p=i;
q=j;
z=... | |
Consider a table of size $$$n \times m$$$, initially fully white. Rows are numbered $$$1$$$ through $$$n$$$ from top to bottom, columns $$$1$$$ through $$$m$$$ from left to right. Some square inside the table with odd side length was painted black. Find the center of this square. | Output two integers $$$r$$$ and $$$c$$$ ($$$1 \le r \le n$$$, $$$1 \le c \le m$$$) separated by a space β the row and column numbers of the center of the black square. | C | 524273686586cdeb7827ffc1ad59d85a | 9257326d97f629302337c8e3a3538f5b | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1535387700 | ["5 6\nWWBBBW\nWWBBBW\nWWBBBW\nWWWWWW\nWWWWWW", "3 3\nWWW\nBWW\nWWW"] | null | PASSED | 800 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 115$$$) β the number of rows and the number of columns in the table. The $$$i$$$-th of the next $$$n$$$ lines contains a string of $$$m$$$ characters $$$s_{i1} s_{i2} \ldots s_{im}$$$ ($$$s_{ij}$$$ is 'W' for white cells and 'B' for black cells... | ["2 4", "2 1"] | #include<stdio.h>
int main()
{
int n,m,i,j,k,r=0,c=0,flag=1;
char a[120][120];
scanf("%d %d ",&n,&m);
for(i=0;i<n;i++)
gets(a[i]);
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
if(a[i][j]=='B')
{
k=i;
r=r+i+1;
c=c+j+1;
while(a[k][j]=='B')
k++;
r=r+k-1;
while(a[i][j]=='B')
j++;
... | |
Consider a table of size $$$n \times m$$$, initially fully white. Rows are numbered $$$1$$$ through $$$n$$$ from top to bottom, columns $$$1$$$ through $$$m$$$ from left to right. Some square inside the table with odd side length was painted black. Find the center of this square. | Output two integers $$$r$$$ and $$$c$$$ ($$$1 \le r \le n$$$, $$$1 \le c \le m$$$) separated by a space β the row and column numbers of the center of the black square. | C | 524273686586cdeb7827ffc1ad59d85a | 89f0bb7b49a49c6b2654cf05a96991e5 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1535387700 | ["5 6\nWWBBBW\nWWBBBW\nWWBBBW\nWWWWWW\nWWWWWW", "3 3\nWWW\nBWW\nWWW"] | null | PASSED | 800 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 115$$$) β the number of rows and the number of columns in the table. The $$$i$$$-th of the next $$$n$$$ lines contains a string of $$$m$$$ characters $$$s_{i1} s_{i2} \ldots s_{im}$$$ ($$$s_{ij}$$$ is 'W' for white cells and 'B' for black cells... | ["2 4", "2 1"] | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
int i,j,k,d,min=1000,max=0,a,b,p,q,c;
scanf("%d %d",&i,&j);
char ara[i][j],ch;
for(p=1;p<=i;p++){
for(q=1;q<=j;q++){
scanf(" %c",&ch);
if(ch=='B'){
if(p+q<min){
min=p+q;
a=p;
... | |
Consider a table of size $$$n \times m$$$, initially fully white. Rows are numbered $$$1$$$ through $$$n$$$ from top to bottom, columns $$$1$$$ through $$$m$$$ from left to right. Some square inside the table with odd side length was painted black. Find the center of this square. | Output two integers $$$r$$$ and $$$c$$$ ($$$1 \le r \le n$$$, $$$1 \le c \le m$$$) separated by a space β the row and column numbers of the center of the black square. | C | 524273686586cdeb7827ffc1ad59d85a | f96cd9ae2f02161cbbe173b2797c1996 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1535387700 | ["5 6\nWWBBBW\nWWBBBW\nWWBBBW\nWWWWWW\nWWWWWW", "3 3\nWWW\nBWW\nWWW"] | null | PASSED | 800 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 115$$$) β the number of rows and the number of columns in the table. The $$$i$$$-th of the next $$$n$$$ lines contains a string of $$$m$$$ characters $$$s_{i1} s_{i2} \ldots s_{im}$$$ ($$$s_{ij}$$$ is 'W' for white cells and 'B' for black cells... | ["2 4", "2 1"] | #include<stdio.h>
int main(void)
{
int i,in=0,row1,row2=0,j,n,m,col1,col2=0;
scanf("%d %d",&n,&m);
char string[m+1];
for(i=0;i<n;i++)
{
scanf("%s",string);
for(j=0;string[j]!='\0';j++)
{
if(string[j]=='B'&&in==0)
{
col1=i+1;
... | |
Consider a table of size $$$n \times m$$$, initially fully white. Rows are numbered $$$1$$$ through $$$n$$$ from top to bottom, columns $$$1$$$ through $$$m$$$ from left to right. Some square inside the table with odd side length was painted black. Find the center of this square. | Output two integers $$$r$$$ and $$$c$$$ ($$$1 \le r \le n$$$, $$$1 \le c \le m$$$) separated by a space β the row and column numbers of the center of the black square. | C | 524273686586cdeb7827ffc1ad59d85a | efe314b59f51b12c0e3251ba3c66628a | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1535387700 | ["5 6\nWWBBBW\nWWBBBW\nWWBBBW\nWWWWWW\nWWWWWW", "3 3\nWWW\nBWW\nWWW"] | null | PASSED | 800 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 115$$$) β the number of rows and the number of columns in the table. The $$$i$$$-th of the next $$$n$$$ lines contains a string of $$$m$$$ characters $$$s_{i1} s_{i2} \ldots s_{im}$$$ ($$$s_{ij}$$$ is 'W' for white cells and 'B' for black cells... | ["2 4", "2 1"] | #include <stdio.h>
int width,height;
char matrix[116][116];
int blacklen,rightcornerw,rightcornerh;
int main ()
{
//freopen ("cf.in","r",stdin),freopen("cf.out","w",stdout);
scanf ("%d %d ",&height,&width);
for (int i=0;i<height;i++)
{
for (int j=0;j<=width;j++)
{
scanf ("%c",&matrix[i][j]);
}
}
for (i... | |
The only difference between easy and hard versions is constraints.Now elections are held in Berland and you want to win them. More precisely, you want everyone to vote for you.There are $$$n$$$ voters, and two ways to convince each of them to vote for you. The first way to convince the $$$i$$$-th voter is to pay him $$... | For each test case print one integer β the minimum number of coins you have to spend so that everyone votes for you. | C | cc64dfbaadc7f9deae23c71df52d7326 | 743db54697e268beae16b0b5bf5917bf | GNU C11 | standard output | 512 megabytes | train_000.jsonl | [
"dp",
"greedy",
"data structures"
] | 1571929500 | ["3\n3\n1 5\n2 10\n2 8\n7\n0 1\n3 1\n1 1\n6 1\n1 1\n4 1\n4 1\n6\n2 6\n2 3\n2 8\n2 7\n4 4\n5 5"] | NoteIn the first test case you have to buy vote of the third voter. Then the set of people voting for you will change as follows: $$${3} \rightarrow {1, 3} \rightarrow {1, 2, 3}$$$.In the second example you don't need to buy votes. The set of people voting for you will change as follows: $$${1} \rightarrow {1, 3, 5} \r... | PASSED | 2,300 | standard input | 2 seconds | The first line contains one integer $$$t$$$ ($$$1 \le t \le 5000$$$) β the number of test cases. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) β the number of voters. The next $$$n$$$ lines contains the description of voters. $$$i$$$-th line contains two integers $$$m_i$$$ and $... | ["8\n0\n7"] | #include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#define N 200000
void srand_() {
struct timeval tv;
gettimeofday(&tv, NULL);
srand(tv.tv_sec ^ tv.tv_usec);
}
int rand_(int n) {
return (rand() * 76543LL + rand()) % n;
}
int mm[N], pp[N];
int pq[1 + N], iq[N], cnt;
int less(int u, int v) {
return... | |
The only difference between easy and hard versions is constraints.Now elections are held in Berland and you want to win them. More precisely, you want everyone to vote for you.There are $$$n$$$ voters, and two ways to convince each of them to vote for you. The first way to convince the $$$i$$$-th voter is to pay him $$... | For each test case print one integer β the minimum number of coins you have to spend so that everyone votes for you. | C | cc64dfbaadc7f9deae23c71df52d7326 | bc7996c149154515144e21015d5650b6 | GNU C11 | standard output | 512 megabytes | train_000.jsonl | [
"dp",
"greedy",
"data structures"
] | 1571929500 | ["3\n3\n1 5\n2 10\n2 8\n7\n0 1\n3 1\n1 1\n6 1\n1 1\n4 1\n4 1\n6\n2 6\n2 3\n2 8\n2 7\n4 4\n5 5"] | NoteIn the first test case you have to buy vote of the third voter. Then the set of people voting for you will change as follows: $$${3} \rightarrow {1, 3} \rightarrow {1, 2, 3}$$$.In the second example you don't need to buy votes. The set of people voting for you will change as follows: $$${1} \rightarrow {1, 3, 5} \r... | PASSED | 2,300 | standard input | 2 seconds | The first line contains one integer $$$t$$$ ($$$1 \le t \le 5000$$$) β the number of test cases. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) β the number of voters. The next $$$n$$$ lines contains the description of voters. $$$i$$$-th line contains two integers $$$m_i$$$ and $... | ["8\n0\n7"] | #include<stdio.h>
#include<stdlib.h>
#define DUBEG 0
typedef struct __st_pair{
int m, p;
}pair;
pair arr[200005];
long long ans[2][5003];
int n;
int cmp_fn(const void *_a, const void *_b){
pair *a, *b;
a = (pair *)_a;
b = (pair *)_b;
return (a->m) - (b->m);
}
int main(){
int tcases;
scanf("%d", &tcas... | |
Mike is the president of country What-The-Fatherland. There are n bears living in this country besides Mike. All of them are standing in a line and they are numbered from 1 to n from left to right. i-th bear is exactly ai feet high. A group of bears is a non-empty contiguous segment of the line. The size of a group i... | Print n integers in one line. For each x from 1 to n, print the maximum strength among all groups of size x. | C | 5cf25cd4a02ce8020258115639c0ee64 | aacf273efff17402fbd2dbc87584d84d | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"dsu",
"binary search",
"data structures"
] | 1432658100 | ["10\n1 2 3 4 5 4 3 2 1 6"] | null | PASSED | 1,900 | standard input | 1 second | The first line of input contains integer n (1ββ€βnββ€β2βΓβ105), the number of bears. The second line contains n integers separated by space, a1,βa2,β...,βan (1ββ€βaiββ€β109), heights of bears. | ["6 4 4 3 3 2 2 1 1 1"] | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*left[i] stores index of element just less than ht[i] to the left,
* right[i] stores the index of the element just less than ht[i] to the right*/
int left[200001],right[200001];
int stack[200001],ans[200001];
int top;
int main()
{
int n;
scanf("... | |
Mike is the president of country What-The-Fatherland. There are n bears living in this country besides Mike. All of them are standing in a line and they are numbered from 1 to n from left to right. i-th bear is exactly ai feet high. A group of bears is a non-empty contiguous segment of the line. The size of a group i... | Print n integers in one line. For each x from 1 to n, print the maximum strength among all groups of size x. | C | 5cf25cd4a02ce8020258115639c0ee64 | cbf06c7e8eefffe4218d2961e93fae70 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"dsu",
"binary search",
"data structures"
] | 1432658100 | ["10\n1 2 3 4 5 4 3 2 1 6"] | null | PASSED | 1,900 | standard input | 1 second | The first line of input contains integer n (1ββ€βnββ€β2βΓβ105), the number of bears. The second line contains n integers separated by space, a1,βa2,β...,βan (1ββ€βaiββ€β109), heights of bears. | ["6 4 4 3 3 2 2 1 1 1"] | #include <stdio.h>
#define MAXN 200000
int n, v[MAXN], heap[MAXN], f[MAXN], ans[MAXN+1], t[MAXN], max[MAXN];
int tata(int p){
return (p-1)/2;
}
int fiust(int p){
return 2*p+1;
}
int fiudr(int p){
return 2*p+2;
}
void swap(int a, int b){
int aux=heap[a];
heap[a]=heap[b];
heap[b]=aux;
}
void cobor... | |
Mike is the president of country What-The-Fatherland. There are n bears living in this country besides Mike. All of them are standing in a line and they are numbered from 1 to n from left to right. i-th bear is exactly ai feet high. A group of bears is a non-empty contiguous segment of the line. The size of a group i... | Print n integers in one line. For each x from 1 to n, print the maximum strength among all groups of size x. | C | 5cf25cd4a02ce8020258115639c0ee64 | d9c33ef23f52f2aa5cb3724530e8667f | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"dsu",
"binary search",
"data structures"
] | 1432658100 | ["10\n1 2 3 4 5 4 3 2 1 6"] | null | PASSED | 1,900 | standard input | 1 second | The first line of input contains integer n (1ββ€βnββ€β2βΓβ105), the number of bears. The second line contains n integers separated by space, a1,βa2,β...,βan (1ββ€βaiββ€β109), heights of bears. | ["6 4 4 3 3 2 2 1 1 1"] | #include<stdio.h>
int main()
{
int t=1;
//scanf("%d",&t);
while(t--)
{long long int st[200009],ans[200009];
long long int a[200009],top=-1,l[200009],r[200009],i,j,n;
scanf("%I64d",&n);
for(i=0;i<n;i++)
scanf("%I64d",&a[i]);
st[++top]=0;ans[n]=0;l[0]=-1;r[n-1]=n;
for(i=1;i<n;i++)
{ans[i]=0;
while(... | |
Mike is the president of country What-The-Fatherland. There are n bears living in this country besides Mike. All of them are standing in a line and they are numbered from 1 to n from left to right. i-th bear is exactly ai feet high. A group of bears is a non-empty contiguous segment of the line. The size of a group i... | Print n integers in one line. For each x from 1 to n, print the maximum strength among all groups of size x. | C | 5cf25cd4a02ce8020258115639c0ee64 | 15dde6e02e163390421824e656997de4 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"dsu",
"binary search",
"data structures"
] | 1432658100 | ["10\n1 2 3 4 5 4 3 2 1 6"] | null | PASSED | 1,900 | standard input | 1 second | The first line of input contains integer n (1ββ€βnββ€β2βΓβ105), the number of bears. The second line contains n integers separated by space, a1,βa2,β...,βan (1ββ€βaiββ€β109), heights of bears. | ["6 4 4 3 3 2 2 1 1 1"] | #include<stdio.h>
int main() {
long long int p,i,j,k,l,n,m,a[200005],b[200005]={0},c[200005],stc[200005],ptr,ans[200005]={0};
scanf("%lld",&n);
for(i=1;i<=n;i++)
scanf("%lld",&a[i]);
a[0] = -1;
a[n+1] = 0;
ptr = 1;
stc[1] = 1;
stc[0] = 0;
b[1] = 0;
for(i=2;i<=n;i++) {
if(a[i] > a[stc[ptr]])
b[i] = stc[... | |
Mike is the president of country What-The-Fatherland. There are n bears living in this country besides Mike. All of them are standing in a line and they are numbered from 1 to n from left to right. i-th bear is exactly ai feet high. A group of bears is a non-empty contiguous segment of the line. The size of a group i... | Print n integers in one line. For each x from 1 to n, print the maximum strength among all groups of size x. | C | 5cf25cd4a02ce8020258115639c0ee64 | 7cd7b33a76e0f22dad10698927cc84bc | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"dsu",
"binary search",
"data structures"
] | 1432658100 | ["10\n1 2 3 4 5 4 3 2 1 6"] | null | PASSED | 1,900 | standard input | 1 second | The first line of input contains integer n (1ββ€βnββ€β2βΓβ105), the number of bears. The second line contains n integers separated by space, a1,βa2,β...,βan (1ββ€βaiββ€β109), heights of bears. | ["6 4 4 3 3 2 2 1 1 1"] | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#include <limits.h>
#define INF INT_MIN
typedef long long int LL;
#define SI(n) scanf("%d",&n)
#define PI(n) printf("%d",n)
int max(int a , int b){
if(a>=b) return a;
return b;
}
int min(int a , int b){
if(a>b) return b;
return a;
}
type... | |
Mike is the president of country What-The-Fatherland. There are n bears living in this country besides Mike. All of them are standing in a line and they are numbered from 1 to n from left to right. i-th bear is exactly ai feet high. A group of bears is a non-empty contiguous segment of the line. The size of a group i... | Print n integers in one line. For each x from 1 to n, print the maximum strength among all groups of size x. | C | 5cf25cd4a02ce8020258115639c0ee64 | 2c6e6a035570ee7aeae660ffc201058c | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"dsu",
"binary search",
"data structures"
] | 1432658100 | ["10\n1 2 3 4 5 4 3 2 1 6"] | null | PASSED | 1,900 | standard input | 1 second | The first line of input contains integer n (1ββ€βnββ€β2βΓβ105), the number of bears. The second line contains n integers separated by space, a1,βa2,β...,βan (1ββ€βaiββ€β109), heights of bears. | ["6 4 4 3 3 2 2 1 1 1"] | #include<stdio.h>
int main()
{
long long int n;
scanf("%lld",&n);
long long int a[200005],b[200005],c[200005],d[200005],i,j;
for(i=0;i<n;i++)
{
d[i]=0;
scanf("%lld",&a[i]);
}
b[0]=-1;
for(i=1;i<n;i++)
{
j=i-1;
if(a[j]<a[i])
b[i]=j;
else
{
while(b[j]!=-1)
{
if(a[b[j]]<a[i])
{
b... | |
Mike is the president of country What-The-Fatherland. There are n bears living in this country besides Mike. All of them are standing in a line and they are numbered from 1 to n from left to right. i-th bear is exactly ai feet high. A group of bears is a non-empty contiguous segment of the line. The size of a group i... | Print n integers in one line. For each x from 1 to n, print the maximum strength among all groups of size x. | C | 5cf25cd4a02ce8020258115639c0ee64 | 9839bac7b198957096ce53ca98e9a14d | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"dsu",
"binary search",
"data structures"
] | 1432658100 | ["10\n1 2 3 4 5 4 3 2 1 6"] | null | PASSED | 1,900 | standard input | 1 second | The first line of input contains integer n (1ββ€βnββ€β2βΓβ105), the number of bears. The second line contains n integers separated by space, a1,βa2,β...,βan (1ββ€βaiββ€β109), heights of bears. | ["6 4 4 3 3 2 2 1 1 1"] | #include <stdio.h>
#define N 200000
int a[N];
int s[N];
int l[N], r[N];
int m[N+1];
int main()
{
int n;
scanf("%d", &n);
int i;
for (i=0; i<n; i++) {
scanf("%d", &a[i]);
}
int sp = -1;
/* top is s[sp] */
for (i=0; i<n; i++) {
while (sp >= 0 && a[s[sp]] > a[i]) {
int top = s[sp--];
r[top] = i;
}
... | |
Mike is the president of country What-The-Fatherland. There are n bears living in this country besides Mike. All of them are standing in a line and they are numbered from 1 to n from left to right. i-th bear is exactly ai feet high. A group of bears is a non-empty contiguous segment of the line. The size of a group i... | Print n integers in one line. For each x from 1 to n, print the maximum strength among all groups of size x. | C | 5cf25cd4a02ce8020258115639c0ee64 | c7a52f387a18467492d3dc9074adcb70 | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"dsu",
"binary search",
"data structures"
] | 1432658100 | ["10\n1 2 3 4 5 4 3 2 1 6"] | null | PASSED | 1,900 | standard input | 1 second | The first line of input contains integer n (1ββ€βnββ€β2βΓβ105), the number of bears. The second line contains n integers separated by space, a1,βa2,β...,βan (1ββ€βaiββ€β109), heights of bears. | ["6 4 4 3 3 2 2 1 1 1"] | #include<stdio.h>
#include<stdlib.h>
int main(){
int n,*ar,*l,*r,i,j;
scanf("%d",&n);
ar=malloc(sizeof(int)*n);
l=malloc(sizeof(int)*n);
r=malloc(sizeof(int)*n);
for(i=0;i<n;i++)
scanf("%d",ar+i);
for(i=0;i<n;i++){
j=i-1;
while(j>=0&&ar[j]>=ar[i])
j=l[j];
l[i]=j;
}
for(i=n-1;i>=0;i--){
j=i+1;
... | |
Mike is the president of country What-The-Fatherland. There are n bears living in this country besides Mike. All of them are standing in a line and they are numbered from 1 to n from left to right. i-th bear is exactly ai feet high. A group of bears is a non-empty contiguous segment of the line. The size of a group i... | Print n integers in one line. For each x from 1 to n, print the maximum strength among all groups of size x. | C | 5cf25cd4a02ce8020258115639c0ee64 | da0d5cd8b1bd86327e53c4193b0be60e | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"dsu",
"binary search",
"data structures"
] | 1432658100 | ["10\n1 2 3 4 5 4 3 2 1 6"] | null | PASSED | 1,900 | standard input | 1 second | The first line of input contains integer n (1ββ€βnββ€β2βΓβ105), the number of bears. The second line contains n integers separated by space, a1,βa2,β...,βan (1ββ€βaiββ€β109), heights of bears. | ["6 4 4 3 3 2 2 1 1 1"] | #include<stdio.h>
#include<stdlib.h>
typedef struct stack{
int top;
int items[200000];
}stk;
int top(stk *ps){
return ps->items[ps->top];
}
void pop(stk *ps){
ps->top--;
return;
}
void push(stk *ps,int i){
ps->items[++(ps->top)]=i;
return;
}
int isempty(stk *ps){
return (ps->top==-1);
}
void max(int *x,in... | |
Mike is the president of country What-The-Fatherland. There are n bears living in this country besides Mike. All of them are standing in a line and they are numbered from 1 to n from left to right. i-th bear is exactly ai feet high. A group of bears is a non-empty contiguous segment of the line. The size of a group i... | Print n integers in one line. For each x from 1 to n, print the maximum strength among all groups of size x. | C | 5cf25cd4a02ce8020258115639c0ee64 | 9d838689c32e1c8cff5339b97821c89b | GNU C | standard output | 256 megabytes | train_000.jsonl | [
"dp",
"dsu",
"binary search",
"data structures"
] | 1432658100 | ["10\n1 2 3 4 5 4 3 2 1 6"] | null | PASSED | 1,900 | standard input | 1 second | The first line of input contains integer n (1ββ€βnββ€β2βΓβ105), the number of bears. The second line contains n integers separated by space, a1,βa2,β...,βan (1ββ€βaiββ€β109), heights of bears. | ["6 4 4 3 3 2 2 1 1 1"] | #include<stdio.h>
#include<stdlib.h>
int stack[200010],top=0,max[200010];
struct arr
{
int val,len;
};
typedef struct arr arr;
arr a[200010];
void merge(arr a[],int l,int mid,int r)
{
int i=l,j=mid+1,k=0;
arr c[200010];
for(;i<=mid&&j<=r;k++)
{
if(a[i].val... | |
In a small restaurant there are a tables for one person and b tables for two persons. It it known that n groups of people come today, each consisting of one or two people. If a group consist of one person, it is seated at a vacant one-seater table. If there are none of them, it is seated at a vacant two-seater table. I... | Print the total number of people the restaurant denies service to. | C | e21e768dbb2e5f72873dc1c7de4879fd | 3af162577c018065af9688069bfa33e2 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1499791500 | ["4 1 2\n1 2 1 1", "4 1 1\n1 1 2 1"] | NoteIn the first example the first group consists of one person, it is seated at a vacant one-seater table. The next group occupies a whole two-seater table. The third group consists of one person, it occupies one place at the remaining two-seater table. The fourth group consists of one person, he is seated at the rema... | PASSED | 1,200 | standard input | 1 second | The first line contains three integers n, a and b (1ββ€βnββ€β2Β·105, 1ββ€βa,βbββ€β2Β·105) β the number of groups coming to the restaurant, the number of one-seater and the number of two-seater tables. The second line contains a sequence of integers t1,βt2,β...,βtn (1ββ€βtiββ€β2) β the description of clients in chronological or... | ["0", "2"] | #include<stdio.h>
int main()
{
long long n,a,r=0,b;
float m=0;
scanf("%lld %lld %lld",&n,&a,&b);
int t[n];
for(long long i=0;i<n;i++)
{
scanf("%d",&t[i]);
}
for(long long i=0;i<n;i++)
{
if(t[i]==2)
{
if(b>=1)
{
b=b-1;
... | |
In a small restaurant there are a tables for one person and b tables for two persons. It it known that n groups of people come today, each consisting of one or two people. If a group consist of one person, it is seated at a vacant one-seater table. If there are none of them, it is seated at a vacant two-seater table. I... | Print the total number of people the restaurant denies service to. | C | e21e768dbb2e5f72873dc1c7de4879fd | 18309299d43b881f186d4dd55d234d9f | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1499791500 | ["4 1 2\n1 2 1 1", "4 1 1\n1 1 2 1"] | NoteIn the first example the first group consists of one person, it is seated at a vacant one-seater table. The next group occupies a whole two-seater table. The third group consists of one person, it occupies one place at the remaining two-seater table. The fourth group consists of one person, he is seated at the rema... | PASSED | 1,200 | standard input | 1 second | The first line contains three integers n, a and b (1ββ€βnββ€β2Β·105, 1ββ€βa,βbββ€β2Β·105) β the number of groups coming to the restaurant, the number of one-seater and the number of two-seater tables. The second line contains a sequence of integers t1,βt2,β...,βtn (1ββ€βtiββ€β2) β the description of clients in chronological or... | ["0", "2"] | #include <stdio.h>
int main()
{
int n, one_seat, two_seat, half_seat = 0, denied = 0;
char g;
scanf("%d %d %d", &n, &one_seat, &two_seat);
scanf("%c", &g);
for (int i = 0; i < n; ++i)
{
scanf("%c ", &g);
if (g == '1')
{
if (one_seat > 0)
one_seat--;
else if (two_seat > 0)
{
two_seat--;
... | |
In a small restaurant there are a tables for one person and b tables for two persons. It it known that n groups of people come today, each consisting of one or two people. If a group consist of one person, it is seated at a vacant one-seater table. If there are none of them, it is seated at a vacant two-seater table. I... | Print the total number of people the restaurant denies service to. | C | e21e768dbb2e5f72873dc1c7de4879fd | 3a16a96613bd0c16f6aa047b6ebeb4ca | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1499791500 | ["4 1 2\n1 2 1 1", "4 1 1\n1 1 2 1"] | NoteIn the first example the first group consists of one person, it is seated at a vacant one-seater table. The next group occupies a whole two-seater table. The third group consists of one person, it occupies one place at the remaining two-seater table. The fourth group consists of one person, he is seated at the rema... | PASSED | 1,200 | standard input | 1 second | The first line contains three integers n, a and b (1ββ€βnββ€β2Β·105, 1ββ€βa,βbββ€β2Β·105) β the number of groups coming to the restaurant, the number of one-seater and the number of two-seater tables. The second line contains a sequence of integers t1,βt2,β...,βtn (1ββ€βtiββ€β2) β the description of clients in chronological or... | ["0", "2"] | #include<stdio.h>
int main(int argc, char const *argv[]) {
/* code */
int n,sing,dou,dou_sing=0;
scanf("%d %d %d",&n,&sing,&dou);
int deny=0,incoming;
for(int i=0;i<n;i++)
{
scanf("%d",&incoming);
if(incoming==2 && dou >=1)
dou=dou-1;
else if (incoming==1 && sing>=1)
sing=sing-1;
... | |
In a small restaurant there are a tables for one person and b tables for two persons. It it known that n groups of people come today, each consisting of one or two people. If a group consist of one person, it is seated at a vacant one-seater table. If there are none of them, it is seated at a vacant two-seater table. I... | Print the total number of people the restaurant denies service to. | C | e21e768dbb2e5f72873dc1c7de4879fd | 140acd1ff6a986d215f35bf9f14afde4 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1499791500 | ["4 1 2\n1 2 1 1", "4 1 1\n1 1 2 1"] | NoteIn the first example the first group consists of one person, it is seated at a vacant one-seater table. The next group occupies a whole two-seater table. The third group consists of one person, it occupies one place at the remaining two-seater table. The fourth group consists of one person, he is seated at the rema... | PASSED | 1,200 | standard input | 1 second | The first line contains three integers n, a and b (1ββ€βnββ€β2Β·105, 1ββ€βa,βbββ€β2Β·105) β the number of groups coming to the restaurant, the number of one-seater and the number of two-seater tables. The second line contains a sequence of integers t1,βt2,β...,βtn (1ββ€βtiββ€β2) β the description of clients in chronological or... | ["0", "2"] | #include <stdio.h>
int main()
{
int n, a, b, i, temp, c = 0, count = 0;
scanf("%d %d %d", &n, &a, &b);
for(i=0; i<n; i++){
scanf("%d", &temp);
if(temp == 1){
if(a != 0)
a--;
else if(b != 0){
b--;
c++;
}
... | |
In a small restaurant there are a tables for one person and b tables for two persons. It it known that n groups of people come today, each consisting of one or two people. If a group consist of one person, it is seated at a vacant one-seater table. If there are none of them, it is seated at a vacant two-seater table. I... | Print the total number of people the restaurant denies service to. | C | e21e768dbb2e5f72873dc1c7de4879fd | 018c61a37afe77b49c35c5647ccb4e80 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1499791500 | ["4 1 2\n1 2 1 1", "4 1 1\n1 1 2 1"] | NoteIn the first example the first group consists of one person, it is seated at a vacant one-seater table. The next group occupies a whole two-seater table. The third group consists of one person, it occupies one place at the remaining two-seater table. The fourth group consists of one person, he is seated at the rema... | PASSED | 1,200 | standard input | 1 second | The first line contains three integers n, a and b (1ββ€βnββ€β2Β·105, 1ββ€βa,βbββ€β2Β·105) β the number of groups coming to the restaurant, the number of one-seater and the number of two-seater tables. The second line contains a sequence of integers t1,βt2,β...,βtn (1ββ€βtiββ€β2) β the description of clients in chronological or... | ["0", "2"] | #include<stdio.h>
int otable;
int ttable;
int totable;
int g[200001];
int main(){
int n,a,b; //nκ·Έλ£Ή 1μ§λ¦¬ν
μ΄λΈ 2μ§λ¦¬ν
μ΄λΈ
scanf("%d %d %d",&n,&a,&b);
otable=a,ttable=b;
for(int i=0;i<n;i++){
scanf("%d",&g[i]);
}
int ans=0;
for(int i=0;i<n;i++){
if(g[i]==1){
if(otable>0){
... | |
In a small restaurant there are a tables for one person and b tables for two persons. It it known that n groups of people come today, each consisting of one or two people. If a group consist of one person, it is seated at a vacant one-seater table. If there are none of them, it is seated at a vacant two-seater table. I... | Print the total number of people the restaurant denies service to. | C | e21e768dbb2e5f72873dc1c7de4879fd | 4a6362f466638baa6d550adafcec1da9 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1499791500 | ["4 1 2\n1 2 1 1", "4 1 1\n1 1 2 1"] | NoteIn the first example the first group consists of one person, it is seated at a vacant one-seater table. The next group occupies a whole two-seater table. The third group consists of one person, it occupies one place at the remaining two-seater table. The fourth group consists of one person, he is seated at the rema... | PASSED | 1,200 | standard input | 1 second | The first line contains three integers n, a and b (1ββ€βnββ€β2Β·105, 1ββ€βa,βbββ€β2Β·105) β the number of groups coming to the restaurant, the number of one-seater and the number of two-seater tables. The second line contains a sequence of integers t1,βt2,β...,βtn (1ββ€βtiββ€β2) β the description of clients in chronological or... | ["0", "2"] | #include<stdio.h>
int main()
{
int N,M,i,j,k,a,b,c,d,x,y,z,t,s,m,n,p,q;
scanf("%d %d %d", &N, &a, &b);
int A[N],B[N],C[N];
for(i=0; i<N; i++)
{
scanf("%d", &A[i]);
}
x=0;
y=0;
c=0;
for(i=0; i<N; i++)
{
if(A[i]==2)
{
if(b==0)
... | |
In a small restaurant there are a tables for one person and b tables for two persons. It it known that n groups of people come today, each consisting of one or two people. If a group consist of one person, it is seated at a vacant one-seater table. If there are none of them, it is seated at a vacant two-seater table. I... | Print the total number of people the restaurant denies service to. | C | e21e768dbb2e5f72873dc1c7de4879fd | a84262a07526a802aa89ea76905870f9 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1499791500 | ["4 1 2\n1 2 1 1", "4 1 1\n1 1 2 1"] | NoteIn the first example the first group consists of one person, it is seated at a vacant one-seater table. The next group occupies a whole two-seater table. The third group consists of one person, it occupies one place at the remaining two-seater table. The fourth group consists of one person, he is seated at the rema... | PASSED | 1,200 | standard input | 1 second | The first line contains three integers n, a and b (1ββ€βnββ€β2Β·105, 1ββ€βa,βbββ€β2Β·105) β the number of groups coming to the restaurant, the number of one-seater and the number of two-seater tables. The second line contains a sequence of integers t1,βt2,β...,βtn (1ββ€βtiββ€β2) β the description of clients in chronological or... | ["0", "2"] | #include<stdio.h>
int main()
{
int N,M,i,j,k,a,b,c,d,x,y,z,t,s,m,n,p,q;
scanf("%d %d %d", &N, &a, &b);
int A[N],B[N],C[N];
for(i=0; i<N; i++)
{
scanf("%d", &A[i]);
}
x=0;
y=0;
c=0;
for(i=0; i<N; i++)
{
if(A[i]==2)
{
if(b==0)
... | |
In a small restaurant there are a tables for one person and b tables for two persons. It it known that n groups of people come today, each consisting of one or two people. If a group consist of one person, it is seated at a vacant one-seater table. If there are none of them, it is seated at a vacant two-seater table. I... | Print the total number of people the restaurant denies service to. | C | e21e768dbb2e5f72873dc1c7de4879fd | 7bc633c6dc4bf8574a8d38ccbbfe8235 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1499791500 | ["4 1 2\n1 2 1 1", "4 1 1\n1 1 2 1"] | NoteIn the first example the first group consists of one person, it is seated at a vacant one-seater table. The next group occupies a whole two-seater table. The third group consists of one person, it occupies one place at the remaining two-seater table. The fourth group consists of one person, he is seated at the rema... | PASSED | 1,200 | standard input | 1 second | The first line contains three integers n, a and b (1ββ€βnββ€β2Β·105, 1ββ€βa,βbββ€β2Β·105) β the number of groups coming to the restaurant, the number of one-seater and the number of two-seater tables. The second line contains a sequence of integers t1,βt2,β...,βtn (1ββ€βtiββ€β2) β the description of clients in chronological or... | ["0", "2"] | /* Coached by rainboy */
#include <stdio.h>
int main() {
int n, a, b, c, cnt;
scanf("%d%d%d", &n, &a, &b);
cnt = c = 0;
while (n--) {
int t;
scanf("%d", &t);
if (t == 1)
if (a > 0)
a--;
else if (b > 0)
c++, b--;
else if (c > 0)
c--;
else
cnt++;
else
if (b > 0)
b--;
e... | |
In a small restaurant there are a tables for one person and b tables for two persons. It it known that n groups of people come today, each consisting of one or two people. If a group consist of one person, it is seated at a vacant one-seater table. If there are none of them, it is seated at a vacant two-seater table. I... | Print the total number of people the restaurant denies service to. | C | e21e768dbb2e5f72873dc1c7de4879fd | f8e4d30b0c0dd2ef4c798b09c787c7fd | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1499791500 | ["4 1 2\n1 2 1 1", "4 1 1\n1 1 2 1"] | NoteIn the first example the first group consists of one person, it is seated at a vacant one-seater table. The next group occupies a whole two-seater table. The third group consists of one person, it occupies one place at the remaining two-seater table. The fourth group consists of one person, he is seated at the rema... | PASSED | 1,200 | standard input | 1 second | The first line contains three integers n, a and b (1ββ€βnββ€β2Β·105, 1ββ€βa,βbββ€β2Β·105) β the number of groups coming to the restaurant, the number of one-seater and the number of two-seater tables. The second line contains a sequence of integers t1,βt2,β...,βtn (1ββ€βtiββ€β2) β the description of clients in chronological or... | ["0", "2"] | #include <stdio.h>
int main() {
int n, a, b, c, cnt;
scanf("%d%d%d", &n, &a, &b);
cnt = c = 0;
while (n--) {
int t;
scanf("%d", &t);
if (t == 1)
if (a > 0)
a--;
else if (b > 0)
c++, b--;
else if (c > 0)
c--;
else
cnt++;
else
if (b > 0)
b--;
else
cnt += 2;
}
pri... | |
In a small restaurant there are a tables for one person and b tables for two persons. It it known that n groups of people come today, each consisting of one or two people. If a group consist of one person, it is seated at a vacant one-seater table. If there are none of them, it is seated at a vacant two-seater table. I... | Print the total number of people the restaurant denies service to. | C | e21e768dbb2e5f72873dc1c7de4879fd | fb66d076e91490a8951a53aed0d9e574 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1499791500 | ["4 1 2\n1 2 1 1", "4 1 1\n1 1 2 1"] | NoteIn the first example the first group consists of one person, it is seated at a vacant one-seater table. The next group occupies a whole two-seater table. The third group consists of one person, it occupies one place at the remaining two-seater table. The fourth group consists of one person, he is seated at the rema... | PASSED | 1,200 | standard input | 1 second | The first line contains three integers n, a and b (1ββ€βnββ€β2Β·105, 1ββ€βa,βbββ€β2Β·105) β the number of groups coming to the restaurant, the number of one-seater and the number of two-seater tables. The second line contains a sequence of integers t1,βt2,β...,βtn (1ββ€βtiββ€β2) β the description of clients in chronological or... | ["0", "2"] | #include<stdio.h>
int main()
{
long int n,a,b,x,c=0,ans=0,i;
scanf("%d%d%d",&n,&a,&b);
for(i=1;i<=n;i++)
{
scanf("%d",&x);
if(x==1)
{
if(a>=1)
a--;
else if(a==0&&b>=1)
{
b--;
c++;
}
... | |
In a small restaurant there are a tables for one person and b tables for two persons. It it known that n groups of people come today, each consisting of one or two people. If a group consist of one person, it is seated at a vacant one-seater table. If there are none of them, it is seated at a vacant two-seater table. I... | Print the total number of people the restaurant denies service to. | C | e21e768dbb2e5f72873dc1c7de4879fd | fb067d264699701368a2a798106a7b46 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1499791500 | ["4 1 2\n1 2 1 1", "4 1 1\n1 1 2 1"] | NoteIn the first example the first group consists of one person, it is seated at a vacant one-seater table. The next group occupies a whole two-seater table. The third group consists of one person, it occupies one place at the remaining two-seater table. The fourth group consists of one person, he is seated at the rema... | PASSED | 1,200 | standard input | 1 second | The first line contains three integers n, a and b (1ββ€βnββ€β2Β·105, 1ββ€βa,βbββ€β2Β·105) β the number of groups coming to the restaurant, the number of one-seater and the number of two-seater tables. The second line contains a sequence of integers t1,βt2,β...,βtn (1ββ€βtiββ€β2) β the description of clients in chronological or... | ["0", "2"] | #include <stdio.h>
#include <stdlib.h>
#include<math.h>
int main()
{
int n, a, b;
int* t= malloc(n*sizeof(int));
scanf("%d %d %d", &n, &a, &b);
char temp;
for(int i=0; i<n; i++)
{
scanf("%d%c", &t[i], &temp);
}
if(n>=1 && n<=2*pow(10, 5) && a>=1 && b<=2*pow(10, 5))
{
... | |
In a small restaurant there are a tables for one person and b tables for two persons. It it known that n groups of people come today, each consisting of one or two people. If a group consist of one person, it is seated at a vacant one-seater table. If there are none of them, it is seated at a vacant two-seater table. I... | Print the total number of people the restaurant denies service to. | C | e21e768dbb2e5f72873dc1c7de4879fd | cf370441c88662f3a117acc55aba0586 | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1499791500 | ["4 1 2\n1 2 1 1", "4 1 1\n1 1 2 1"] | NoteIn the first example the first group consists of one person, it is seated at a vacant one-seater table. The next group occupies a whole two-seater table. The third group consists of one person, it occupies one place at the remaining two-seater table. The fourth group consists of one person, he is seated at the rema... | PASSED | 1,200 | standard input | 1 second | The first line contains three integers n, a and b (1ββ€βnββ€β2Β·105, 1ββ€βa,βbββ€β2Β·105) β the number of groups coming to the restaurant, the number of one-seater and the number of two-seater tables. The second line contains a sequence of integers t1,βt2,β...,βtn (1ββ€βtiββ€β2) β the description of clients in chronological or... | ["0", "2"] | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<conio.h>
#include<ctype.h>
#include<string.h>
int main()
{
int n, a,b,*t,i,j,k,l,ts=0,os=0,bi=0,d=0;
scanf("%d%d%d",&n,&a,&b);
t=(int*)malloc(sizeof(int)*n);
for(i=0;i<n;i++){
scanf("%d",&t[i]);
if(t[i]==1)
os++;... | |
In a small restaurant there are a tables for one person and b tables for two persons. It it known that n groups of people come today, each consisting of one or two people. If a group consist of one person, it is seated at a vacant one-seater table. If there are none of them, it is seated at a vacant two-seater table. I... | Print the total number of people the restaurant denies service to. | C | e21e768dbb2e5f72873dc1c7de4879fd | ad63ce4ced6010b9ba999c951faaa49e | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1499791500 | ["4 1 2\n1 2 1 1", "4 1 1\n1 1 2 1"] | NoteIn the first example the first group consists of one person, it is seated at a vacant one-seater table. The next group occupies a whole two-seater table. The third group consists of one person, it occupies one place at the remaining two-seater table. The fourth group consists of one person, he is seated at the rema... | PASSED | 1,200 | standard input | 1 second | The first line contains three integers n, a and b (1ββ€βnββ€β2Β·105, 1ββ€βa,βbββ€β2Β·105) β the number of groups coming to the restaurant, the number of one-seater and the number of two-seater tables. The second line contains a sequence of integers t1,βt2,β...,βtn (1ββ€βtiββ€β2) β the description of clients in chronological or... | ["0", "2"] | #include<stdio.h>
int main()
{
long long int i,a,b,n,c,count;
while(scanf("%I64d",&n)==1)
{
scanf("%I64d%I64d",&a,&b);
b=b*2;
int a1=0;
count=0;
for(i=0; i<n; i++)
{
scanf("%I64d",&c);
if(c==1&&a>0)
{
a--;
... | |
In a small restaurant there are a tables for one person and b tables for two persons. It it known that n groups of people come today, each consisting of one or two people. If a group consist of one person, it is seated at a vacant one-seater table. If there are none of them, it is seated at a vacant two-seater table. I... | Print the total number of people the restaurant denies service to. | C | e21e768dbb2e5f72873dc1c7de4879fd | 8a3fb5331ee72c3c09ab3b736a543f7f | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1499791500 | ["4 1 2\n1 2 1 1", "4 1 1\n1 1 2 1"] | NoteIn the first example the first group consists of one person, it is seated at a vacant one-seater table. The next group occupies a whole two-seater table. The third group consists of one person, it occupies one place at the remaining two-seater table. The fourth group consists of one person, he is seated at the rema... | PASSED | 1,200 | standard input | 1 second | The first line contains three integers n, a and b (1ββ€βnββ€β2Β·105, 1ββ€βa,βbββ€β2Β·105) β the number of groups coming to the restaurant, the number of one-seater and the number of two-seater tables. The second line contains a sequence of integers t1,βt2,β...,βtn (1ββ€βtiββ€β2) β the description of clients in chronological or... | ["0", "2"] | #include<stdio.h>
int main()
{
int n,a,b,i,j,service = 0;
scanf("%d %d %d",&n,&a,&b);
j = b * 2;
int ara[n];
for(i = 0;i < n;i++)
{
scanf("%d",&ara[i]);
}
for(i = 0;i < n;i++)
{
if(ara[i] == 1)
{
if(a > 0)
{
a--;
... | |
In a small restaurant there are a tables for one person and b tables for two persons. It it known that n groups of people come today, each consisting of one or two people. If a group consist of one person, it is seated at a vacant one-seater table. If there are none of them, it is seated at a vacant two-seater table. I... | Print the total number of people the restaurant denies service to. | C | e21e768dbb2e5f72873dc1c7de4879fd | 1cc7659d56dd4d2c831b68acabacca1c | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1499791500 | ["4 1 2\n1 2 1 1", "4 1 1\n1 1 2 1"] | NoteIn the first example the first group consists of one person, it is seated at a vacant one-seater table. The next group occupies a whole two-seater table. The third group consists of one person, it occupies one place at the remaining two-seater table. The fourth group consists of one person, he is seated at the rema... | PASSED | 1,200 | standard input | 1 second | The first line contains three integers n, a and b (1ββ€βnββ€β2Β·105, 1ββ€βa,βbββ€β2Β·105) β the number of groups coming to the restaurant, the number of one-seater and the number of two-seater tables. The second line contains a sequence of integers t1,βt2,β...,βtn (1ββ€βtiββ€β2) β the description of clients in chronological or... | ["0", "2"] | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
int n,a,b,i,m=0,d[200001],c=0;
scanf("%d %d %d",&n,&a,&b);
for(i=0; i<n; i++)
scanf("%d",&d[i]);
for(i=0; i<n; i++){
if(d[i]==2){
if(b>0) b--;
else m+=2;
}
else if(d[i]==1){
... | |
In a small restaurant there are a tables for one person and b tables for two persons. It it known that n groups of people come today, each consisting of one or two people. If a group consist of one person, it is seated at a vacant one-seater table. If there are none of them, it is seated at a vacant two-seater table. I... | Print the total number of people the restaurant denies service to. | C | e21e768dbb2e5f72873dc1c7de4879fd | 3950b6ab27d90809476d508bcc5f6cfe | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1499791500 | ["4 1 2\n1 2 1 1", "4 1 1\n1 1 2 1"] | NoteIn the first example the first group consists of one person, it is seated at a vacant one-seater table. The next group occupies a whole two-seater table. The third group consists of one person, it occupies one place at the remaining two-seater table. The fourth group consists of one person, he is seated at the rema... | PASSED | 1,200 | standard input | 1 second | The first line contains three integers n, a and b (1ββ€βnββ€β2Β·105, 1ββ€βa,βbββ€β2Β·105) β the number of groups coming to the restaurant, the number of one-seater and the number of two-seater tables. The second line contains a sequence of integers t1,βt2,β...,βtn (1ββ€βtiββ€β2) β the description of clients in chronological or... | ["0", "2"] | #include<stdio.h>
int main()
{
int n = 0, a = 0 , b = 0 , rem = 0;
int count = 0 ;
scanf("%d %d %d",&n,&a,&b);
for ( int i = 0 ; i < n ; i++ )
{
int m = 0;
scanf("%d",&m);
if (m == 2)
{
if ( b > 0 )
b -= 1 ;
else
count += 2 ;
}
else
{
if ( a > 0)
a -= 1;
else if ( b > 0 )
{... | |
In a small restaurant there are a tables for one person and b tables for two persons. It it known that n groups of people come today, each consisting of one or two people. If a group consist of one person, it is seated at a vacant one-seater table. If there are none of them, it is seated at a vacant two-seater table. I... | Print the total number of people the restaurant denies service to. | C | e21e768dbb2e5f72873dc1c7de4879fd | 73b10e534aa43d594fc2f409d441865c | GNU C11 | standard output | 256 megabytes | train_000.jsonl | [
"implementation"
] | 1499791500 | ["4 1 2\n1 2 1 1", "4 1 1\n1 1 2 1"] | NoteIn the first example the first group consists of one person, it is seated at a vacant one-seater table. The next group occupies a whole two-seater table. The third group consists of one person, it occupies one place at the remaining two-seater table. The fourth group consists of one person, he is seated at the rema... | PASSED | 1,200 | standard input | 1 second | The first line contains three integers n, a and b (1ββ€βnββ€β2Β·105, 1ββ€βa,βbββ€β2Β·105) β the number of groups coming to the restaurant, the number of one-seater and the number of two-seater tables. The second line contains a sequence of integers t1,βt2,β...,βtn (1ββ€βtiββ€β2) β the description of clients in chronological or... | ["0", "2"] | #include<stdio.h>
#include<string.h>
int main()
{
int n,a,b;
scanf("%d %d %d",&n,&a,&b);
int cap1=0;
int cap2=0;
int vacant1=a;
int vacant2=b;
int deny=0;
for(int itr=0;itr<n;itr++)
{
int size;
scanf("%d",&size);
if(size==1)
{
if(cap1<a)
{
cap1++;
vacant1--;
}
else if(cap2<2*b)
{... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.