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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process of a tournament is described in the next paragraph.There are n toy cars. Each pair collides. The result of a collision can be one of the following: no car turned over, one car turned ov... | Print the number of good cars and in the next line print their space-separated indices in the increasing order. | C | 3fc0ac711b113fa98f41740536dad44f | 45daf60b0468b4bc4f037c7a252ec45e | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1432053000 | ["3\n-1 0 0\n0 -1 1\n0 2 -1", "4\n-1 3 3 3\n3 -1 3 3\n3 3 -1 3\n3 3 3 -1"] | null | PASSED | 900 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β100) β the number of cars. Each of the next n lines contains n space-separated integers that determine matrix A. It is guaranteed that on the main diagonal there are β-β1, and β-β1 doesn't appear anywhere else in the matrix. It is guaranteed that the input is correct, that is... | ["2\n1 3", "0"] | #include <stdio.h>
int main(){
int n,i=1,j,x;
scanf("%d",&n);
int good[n+1],goodcount=0;
while(i<=n){
int goodflag=1;
for(j=0; j<n; j++){
scanf("%d",&x);
if(x==3||x==1){
goodflag=0;
}
}
good[i++]=goodflag;
goodcount+=goodflag;
}
printf("%d\n", goodcount);
for(i=1;i<=n;i++){
if(good[i])... | |
Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process of a tournament is described in the next paragraph.There are n toy cars. Each pair collides. The result of a collision can be one of the following: no car turned over, one car turned ov... | Print the number of good cars and in the next line print their space-separated indices in the increasing order. | C | 3fc0ac711b113fa98f41740536dad44f | 916d85ef2dcea33a82f056e1aed6e530 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1432053000 | ["3\n-1 0 0\n0 -1 1\n0 2 -1", "4\n-1 3 3 3\n3 -1 3 3\n3 3 -1 3\n3 3 3 -1"] | null | PASSED | 900 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β100) β the number of cars. Each of the next n lines contains n space-separated integers that determine matrix A. It is guaranteed that on the main diagonal there are β-β1, and β-β1 doesn't appear anywhere else in the matrix. It is guaranteed that the input is correct, that is... | ["2\n1 3", "0"] | #include <stdio.h>
#include <stdlib.h>
int main() {
int n, number = 0, i, j;
int *ptr, **mass;
int *goodCar;
scanf("%d", &n);
ptr = malloc(n * n * sizeof(int));
goodCar = malloc(n * sizeof(int));
mass = malloc(n * sizeof(int*));
for(i = 0; i < n; i++) {
mass[i] = &ptr[i * n];
goodCar[i] = 0;
}
for(i =... | |
Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process of a tournament is described in the next paragraph.There are n toy cars. Each pair collides. The result of a collision can be one of the following: no car turned over, one car turned ov... | Print the number of good cars and in the next line print their space-separated indices in the increasing order. | C | 3fc0ac711b113fa98f41740536dad44f | d30f5743c70a24af1d913ca5d6e3fbbc | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1432053000 | ["3\n-1 0 0\n0 -1 1\n0 2 -1", "4\n-1 3 3 3\n3 -1 3 3\n3 3 -1 3\n3 3 3 -1"] | null | PASSED | 900 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β100) β the number of cars. Each of the next n lines contains n space-separated integers that determine matrix A. It is guaranteed that on the main diagonal there are β-β1, and β-β1 doesn't appear anywhere else in the matrix. It is guaranteed that the input is correct, that is... | ["2\n1 3", "0"] | #include <stdio.h>
int main(int argc, char const *argv[]){
int n, i, j, acc = 0;
scanf("%d", &n);
int m[n][n], goods[n];
for (i=0; i<n; ++i){
for (j=0; j<n; ++j) scanf("%d", &m[i][j]);
goods[i] = 0;
}
for (i=0; i<n; ++i){
for (j=0; j<n; ++j){
if (j != i && (m[i][j] == 1 || m[i][j] == 3)){
goods[i] =... | |
Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process of a tournament is described in the next paragraph.There are n toy cars. Each pair collides. The result of a collision can be one of the following: no car turned over, one car turned ov... | Print the number of good cars and in the next line print their space-separated indices in the increasing order. | C | 3fc0ac711b113fa98f41740536dad44f | 26af909bbf0493999abd4743b14c7bf8 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1432053000 | ["3\n-1 0 0\n0 -1 1\n0 2 -1", "4\n-1 3 3 3\n3 -1 3 3\n3 3 -1 3\n3 3 3 -1"] | null | PASSED | 900 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β100) β the number of cars. Each of the next n lines contains n space-separated integers that determine matrix A. It is guaranteed that on the main diagonal there are β-β1, and β-β1 doesn't appear anywhere else in the matrix. It is guaranteed that the input is correct, that is... | ["2\n1 3", "0"] | #include <stdio.h>
int main()
{
int n, j, i, k = 0, count = 0, check = 0;
scanf("%d", &n);
int ara[n][n];
int f[n];
for(i = 0; i < n; i++) {
for(j = 0; j < n; j++) {
scanf("%d", &ara[i][j]);
}
}
for(i = 0; i < n; i++) {
for(j = 0; j < n; j++) {
... | |
Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process of a tournament is described in the next paragraph.There are n toy cars. Each pair collides. The result of a collision can be one of the following: no car turned over, one car turned ov... | Print the number of good cars and in the next line print their space-separated indices in the increasing order. | C | 3fc0ac711b113fa98f41740536dad44f | 785887b3b20aede12df0a03fc1477d57 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1432053000 | ["3\n-1 0 0\n0 -1 1\n0 2 -1", "4\n-1 3 3 3\n3 -1 3 3\n3 3 -1 3\n3 3 3 -1"] | null | PASSED | 900 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β100) β the number of cars. Each of the next n lines contains n space-separated integers that determine matrix A. It is guaranteed that on the main diagonal there are β-β1, and β-β1 doesn't appear anywhere else in the matrix. It is guaranteed that the input is correct, that is... | ["2\n1 3", "0"] | #include<stdio.h>
int main()
{
int n,r,c,check=1,i=0;
scanf("%d",&n);
int a[n][n],save[n];
for(r=0;r<n;++r)
{
check=1;
for(c=0;c<n;++c)
{
scanf("%d",&a[r][c]);
if(a[r][c]==1||a[r][c]==3)
check=0;
}
if(check==1)
{
save[i]=r+1;
++i;
}
}
printf("%d\n",i);
for(r=0;r<i;++r)
printf("%d "... | |
Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process of a tournament is described in the next paragraph.There are n toy cars. Each pair collides. The result of a collision can be one of the following: no car turned over, one car turned ov... | Print the number of good cars and in the next line print their space-separated indices in the increasing order. | C | 3fc0ac711b113fa98f41740536dad44f | 60a50dc9d9448a83c5e313f480c4c128 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1432053000 | ["3\n-1 0 0\n0 -1 1\n0 2 -1", "4\n-1 3 3 3\n3 -1 3 3\n3 3 -1 3\n3 3 3 -1"] | null | PASSED | 900 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β100) β the number of cars. Each of the next n lines contains n space-separated integers that determine matrix A. It is guaranteed that on the main diagonal there are β-β1, and β-β1 doesn't appear anywhere else in the matrix. It is guaranteed that the input is correct, that is... | ["2\n1 3", "0"] | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <float.h>
int main()
{
int n, **s, j, a = 0, count = 0, *l;
scanf("%d", &n);
s = (int**)malloc(sizeof(int*)*n);
for (int i = 0; i < n; i++)
s[i]= (int*)malloc(sizeof(int)*n);
l = (int*)malloc(sizeof(int)*n);
for (int i = 0; i < n; i++)
for (... | |
Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process of a tournament is described in the next paragraph.There are n toy cars. Each pair collides. The result of a collision can be one of the following: no car turned over, one car turned ov... | Print the number of good cars and in the next line print their space-separated indices in the increasing order. | C | 3fc0ac711b113fa98f41740536dad44f | effb70fd0d6f1b9483d49b5d5db56617 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1432053000 | ["3\n-1 0 0\n0 -1 1\n0 2 -1", "4\n-1 3 3 3\n3 -1 3 3\n3 3 -1 3\n3 3 3 -1"] | null | PASSED | 900 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β100) β the number of cars. Each of the next n lines contains n space-separated integers that determine matrix A. It is guaranteed that on the main diagonal there are β-β1, and β-β1 doesn't appear anywhere else in the matrix. It is guaranteed that the input is correct, that is... | ["2\n1 3", "0"] | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
long long int ch[200000]= {0},cp[500000];
char kh[1000],arr[1000000];
int a,b=0,c,d,e,i=0,j=0,k=0,l=0,tep,temp,m,n,x,y;
double z,go;
scanf("%d",&a);
j=0;
k=0;
l=0;
m=n=0;
for(j=1; j<=a; j++)
{
l=0;
... | |
Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process of a tournament is described in the next paragraph.There are n toy cars. Each pair collides. The result of a collision can be one of the following: no car turned over, one car turned ov... | Print the number of good cars and in the next line print their space-separated indices in the increasing order. | C | 3fc0ac711b113fa98f41740536dad44f | f1be0d193e2cc06ff2186a8070dd4ae1 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1432053000 | ["3\n-1 0 0\n0 -1 1\n0 2 -1", "4\n-1 3 3 3\n3 -1 3 3\n3 3 -1 3\n3 3 3 -1"] | null | PASSED | 900 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β100) β the number of cars. Each of the next n lines contains n space-separated integers that determine matrix A. It is guaranteed that on the main diagonal there are β-β1, and β-β1 doesn't appear anywhere else in the matrix. It is guaranteed that the input is correct, that is... | ["2\n1 3", "0"] | #include <stdio.h>
int arr1[100];
int main()
{
int n, i, j, count = 0;
scanf("%d", &n);
int arr[n][n];
for(i=0; i<n; i++){
for(j=0; j<n; j++){
scanf("%d", &arr[i][j]);
if(arr[i][j] == 0)
continue;
else if(arr[i][j] == 1)
arr... | |
Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process of a tournament is described in the next paragraph.There are n toy cars. Each pair collides. The result of a collision can be one of the following: no car turned over, one car turned ov... | Print the number of good cars and in the next line print their space-separated indices in the increasing order. | C | 3fc0ac711b113fa98f41740536dad44f | 4527ffc70ea60b9ab090b1e43a89bb05 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1432053000 | ["3\n-1 0 0\n0 -1 1\n0 2 -1", "4\n-1 3 3 3\n3 -1 3 3\n3 3 -1 3\n3 3 3 -1"] | null | PASSED | 900 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β100) β the number of cars. Each of the next n lines contains n space-separated integers that determine matrix A. It is guaranteed that on the main diagonal there are β-β1, and β-β1 doesn't appear anywhere else in the matrix. It is guaranteed that the input is correct, that is... | ["2\n1 3", "0"] | #include<stdio.h>
int main()
{
int n,data[105][105],l=0,i,j,flag=0,ar[100];
scanf("%d",&n);
for(i=1;i<=n;i++)
{
flag=0;
for(j=1;j<=n;j++)
{
scanf("%d",&data[i][j]);
if(data[i][j]==1||data[i][j]==3)
{
... | |
Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process of a tournament is described in the next paragraph.There are n toy cars. Each pair collides. The result of a collision can be one of the following: no car turned over, one car turned ov... | Print the number of good cars and in the next line print their space-separated indices in the increasing order. | C | 3fc0ac711b113fa98f41740536dad44f | 89027f82008d85103c9ec4830d3cf64a | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1432053000 | ["3\n-1 0 0\n0 -1 1\n0 2 -1", "4\n-1 3 3 3\n3 -1 3 3\n3 3 -1 3\n3 3 3 -1"] | null | PASSED | 900 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β100) β the number of cars. Each of the next n lines contains n space-separated integers that determine matrix A. It is guaranteed that on the main diagonal there are β-β1, and β-β1 doesn't appear anywhere else in the matrix. It is guaranteed that the input is correct, that is... | ["2\n1 3", "0"] | #include <stdio.h>
//#include <stdlib.h>
#include <string.h>
//#include <math.h>
//#include <algorithm>
//#include <map>
//using namespace std;
int z[150];
int main()
{
//freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
memset(z,0,150*sizeof(int));
int n,f,c,num=... | |
Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process of a tournament is described in the next paragraph.There are n toy cars. Each pair collides. The result of a collision can be one of the following: no car turned over, one car turned ov... | Print the number of good cars and in the next line print their space-separated indices in the increasing order. | C | 3fc0ac711b113fa98f41740536dad44f | e4c5e096dd8991532c33addf92aaded3 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1432053000 | ["3\n-1 0 0\n0 -1 1\n0 2 -1", "4\n-1 3 3 3\n3 -1 3 3\n3 3 -1 3\n3 3 3 -1"] | null | PASSED | 900 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β100) β the number of cars. Each of the next n lines contains n space-separated integers that determine matrix A. It is guaranteed that on the main diagonal there are β-β1, and β-β1 doesn't appear anywhere else in the matrix. It is guaranteed that the input is correct, that is... | ["2\n1 3", "0"] | #pragma warning(disable:4996)
#include <stdio.h>
#include <malloc.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#define forn(i,n) for (i = 0; i<n; i++)
int lol(const void *x1, const void *x2)
{
return *(int*)x1 - *(int*)x2;
}
int gcd(int a, int b)
{
int c;
while (b)
{
c = a % b;
a = b;
b = c... | |
Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process of a tournament is described in the next paragraph.There are n toy cars. Each pair collides. The result of a collision can be one of the following: no car turned over, one car turned ov... | Print the number of good cars and in the next line print their space-separated indices in the increasing order. | C | 3fc0ac711b113fa98f41740536dad44f | 18697fb425abc3914484ccc8c53cf7f0 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1432053000 | ["3\n-1 0 0\n0 -1 1\n0 2 -1", "4\n-1 3 3 3\n3 -1 3 3\n3 3 -1 3\n3 3 3 -1"] | null | PASSED | 900 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β100) β the number of cars. Each of the next n lines contains n space-separated integers that determine matrix A. It is guaranteed that on the main diagonal there are β-β1, and β-β1 doesn't appear anywhere else in the matrix. It is guaranteed that the input is correct, that is... | ["2\n1 3", "0"] | #include <stdio.h>
int main() {
int n ;
scanf("%d", &n);
int grid[n];
for (int i = 0 ; i < n ; i++) {
grid[i] = 0;
}
for (int i = 0 ; i < n ; i++) {
for (int j = 0 ; j < n ; j++) {
int temp ;
scanf("%d", &temp);
if ( temp == 0) {
}
else if ( temp == 1) {
int r... | |
Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process of a tournament is described in the next paragraph.There are n toy cars. Each pair collides. The result of a collision can be one of the following: no car turned over, one car turned ov... | Print the number of good cars and in the next line print their space-separated indices in the increasing order. | C | 3fc0ac711b113fa98f41740536dad44f | 2dc31cd8e5309b513bb2c54c33bb6e93 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1432053000 | ["3\n-1 0 0\n0 -1 1\n0 2 -1", "4\n-1 3 3 3\n3 -1 3 3\n3 3 -1 3\n3 3 3 -1"] | null | PASSED | 900 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β100) β the number of cars. Each of the next n lines contains n space-separated integers that determine matrix A. It is guaranteed that on the main diagonal there are β-β1, and β-β1 doesn't appear anywhere else in the matrix. It is guaranteed that the input is correct, that is... | ["2\n1 3", "0"] | #include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
int i,j;
int a[n][n],b[n];
for(i=0;i<=n;i++)
b[i]=0;
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
scanf("%d",&a[i][j]);
if(a[i][j]==1)
{
b[i+1]=1;
}
if(a[i][j]==2)
{
b[j+1]=1;
}
if(a[i][j]==3)
{
b[j+1]=1;
b[i+1]=1;
}
... | |
Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process of a tournament is described in the next paragraph.There are n toy cars. Each pair collides. The result of a collision can be one of the following: no car turned over, one car turned ov... | Print the number of good cars and in the next line print their space-separated indices in the increasing order. | C | 3fc0ac711b113fa98f41740536dad44f | df33f79e3ccdfcb78b1cf157db0d0fe4 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1432053000 | ["3\n-1 0 0\n0 -1 1\n0 2 -1", "4\n-1 3 3 3\n3 -1 3 3\n3 3 -1 3\n3 3 3 -1"] | null | PASSED | 900 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β100) β the number of cars. Each of the next n lines contains n space-separated integers that determine matrix A. It is guaranteed that on the main diagonal there are β-β1, and β-β1 doesn't appear anywhere else in the matrix. It is guaranteed that the input is correct, that is... | ["2\n1 3", "0"] | //
// main.c
// hr
//
// Created by Chaitya on 5/15/15.
// Copyright (c) 2015 Chaitya. All rights reserved.
//
/*
There are n toy cars. Each pair collides. The result of a collision can be one of the following: no car turned over, one car turned over, both cars turned over. A car is good if it turned over in no co... | |
Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process of a tournament is described in the next paragraph.There are n toy cars. Each pair collides. The result of a collision can be one of the following: no car turned over, one car turned ov... | Print the number of good cars and in the next line print their space-separated indices in the increasing order. | C | 3fc0ac711b113fa98f41740536dad44f | 03f00b82df2d7de427c1acf8d752628e | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1432053000 | ["3\n-1 0 0\n0 -1 1\n0 2 -1", "4\n-1 3 3 3\n3 -1 3 3\n3 3 -1 3\n3 3 3 -1"] | null | PASSED | 900 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β100) β the number of cars. Each of the next n lines contains n space-separated integers that determine matrix A. It is guaranteed that on the main diagonal there are β-β1, and β-β1 doesn't appear anywhere else in the matrix. It is guaranteed that the input is correct, that is... | ["2\n1 3", "0"] | #include <stdio.h>
int mn(int a, int b){if(a<b) return a; else return b;}
const int M = 101;
int main(){
int i,j,n,c,b[M][M];
for(i=0;i<M;i++)
for(j=0;j<M;j++)
b[i][j]=0;
scanf("%i",&n);
c = n;
for(i=0;i<n;i++){
for(j=0;j<n;j++){
int a;
scanf("%i",... | |
Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process of a tournament is described in the next paragraph.There are n toy cars. Each pair collides. The result of a collision can be one of the following: no car turned over, one car turned ov... | Print the number of good cars and in the next line print their space-separated indices in the increasing order. | C | 3fc0ac711b113fa98f41740536dad44f | 5ce0aaa912a297b58fa42784b5b264fc | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1432053000 | ["3\n-1 0 0\n0 -1 1\n0 2 -1", "4\n-1 3 3 3\n3 -1 3 3\n3 3 -1 3\n3 3 3 -1"] | null | PASSED | 900 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β100) β the number of cars. Each of the next n lines contains n space-separated integers that determine matrix A. It is guaranteed that on the main diagonal there are β-β1, and β-β1 doesn't appear anywhere else in the matrix. It is guaranteed that the input is correct, that is... | ["2\n1 3", "0"] | #include<stdio.h>
int main()
{
int n,count=0,c,i,j,a,A[100];
scanf("%d",&n);
for(i=0;i<n;i++)
{
c=0;
for(j=0;j<n;j++)
{
scanf("%d",&a);
if(a==1||a==3)
c=1;
}
if(!c)
A[count++]=i;
}
printf("%d\n",count);
f... | |
Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process of a tournament is described in the next paragraph.There are n toy cars. Each pair collides. The result of a collision can be one of the following: no car turned over, one car turned ov... | Print the number of good cars and in the next line print their space-separated indices in the increasing order. | C | 3fc0ac711b113fa98f41740536dad44f | 5cc73f1c10cf86c3cba81339400c5b1c | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1432053000 | ["3\n-1 0 0\n0 -1 1\n0 2 -1", "4\n-1 3 3 3\n3 -1 3 3\n3 3 -1 3\n3 3 3 -1"] | null | PASSED | 900 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β100) β the number of cars. Each of the next n lines contains n space-separated integers that determine matrix A. It is guaranteed that on the main diagonal there are β-β1, and β-β1 doesn't appear anywhere else in the matrix. It is guaranteed that the input is correct, that is... | ["2\n1 3", "0"] | #include <stdio.h>
int main(int argc, char const *argv[])
{
int n,v;
scanf("%d", &n);
int c[n+1];
for (int i = 1; i <= n; ++i) c[i]=1;
for (int i = 1; i <= n; ++i)
for (int j = 1; j <= n; ++j)
{
scanf("%d", &v);
switch (v) {
case 0: c[i]&=1,c... | |
Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process of a tournament is described in the next paragraph.There are n toy cars. Each pair collides. The result of a collision can be one of the following: no car turned over, one car turned ov... | Print the number of good cars and in the next line print their space-separated indices in the increasing order. | C | 3fc0ac711b113fa98f41740536dad44f | c4922748091634dedf125c46f646a60a | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1432053000 | ["3\n-1 0 0\n0 -1 1\n0 2 -1", "4\n-1 3 3 3\n3 -1 3 3\n3 3 -1 3\n3 3 3 -1"] | null | PASSED | 900 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β100) β the number of cars. Each of the next n lines contains n space-separated integers that determine matrix A. It is guaranteed that on the main diagonal there are β-β1, and β-β1 doesn't appear anywhere else in the matrix. It is guaranteed that the input is correct, that is... | ["2\n1 3", "0"] | #include<stdio.h>
int main()
{
int i,j,n;
scanf("%d",&n);
int ans[n];
int count=0;
int arr[n][n];
for(i=0;i<n;i++)
{
ans[i]=1;
for(j=0;j<n;j++)
{
scanf("%d",&arr[i][j]);
if(arr[i][j]==1)
{
ans[i]=0;
}
... | |
Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process of a tournament is described in the next paragraph.There are n toy cars. Each pair collides. The result of a collision can be one of the following: no car turned over, one car turned ov... | Print the number of good cars and in the next line print their space-separated indices in the increasing order. | C | 3fc0ac711b113fa98f41740536dad44f | e09ad557c1b8a25a3da669d60a3fa0c4 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1432053000 | ["3\n-1 0 0\n0 -1 1\n0 2 -1", "4\n-1 3 3 3\n3 -1 3 3\n3 3 -1 3\n3 3 3 -1"] | null | PASSED | 900 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β100) β the number of cars. Each of the next n lines contains n space-separated integers that determine matrix A. It is guaranteed that on the main diagonal there are β-β1, and β-β1 doesn't appear anywhere else in the matrix. It is guaranteed that the input is correct, that is... | ["2\n1 3", "0"] | #include <stdio.h>
int main(void)
{
int n;
scanf("%d ", &n);
int arr[n][n], car[n];
for (int i = 0; i < n; i++)
car[i] = 1;
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++){
scanf("%d ", &arr[i][j]);
if (arr[i][j] == 1 || arr[i][j] == 3)
car[i] = 0;
}
int n... | |
Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process of a tournament is described in the next paragraph.There are n toy cars. Each pair collides. The result of a collision can be one of the following: no car turned over, one car turned ov... | Print the number of good cars and in the next line print their space-separated indices in the increasing order. | C | 3fc0ac711b113fa98f41740536dad44f | bfd2c83c4c6f25b54ab0ab8b3d5d8d95 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1432053000 | ["3\n-1 0 0\n0 -1 1\n0 2 -1", "4\n-1 3 3 3\n3 -1 3 3\n3 3 -1 3\n3 3 3 -1"] | null | PASSED | 900 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β100) β the number of cars. Each of the next n lines contains n space-separated integers that determine matrix A. It is guaranteed that on the main diagonal there are β-β1, and β-β1 doesn't appear anywhere else in the matrix. It is guaranteed that the input is correct, that is... | ["2\n1 3", "0"] | #include <stdio.h>
#define N 200
int main() {
static int ii[N];
int n, k, i;
scanf("%d", &n);
k = 0;
for (i = 1; i <= n; i++) {
static int aa[N];
int j, yes;
for (j = 0; j < n; j++)
scanf("%d", &aa[j]);
yes = 1;
for (j = 0; j < n; j++)
if (aa[j] != -1 && aa[j] != 0 && aa[j] != 2) {
yes = 0;... | |
Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process of a tournament is described in the next paragraph.There are n toy cars. Each pair collides. The result of a collision can be one of the following: no car turned over, one car turned ov... | Print the number of good cars and in the next line print their space-separated indices in the increasing order. | C | 3fc0ac711b113fa98f41740536dad44f | 88749b2a8df8e4351584659d3ad3550a | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1432053000 | ["3\n-1 0 0\n0 -1 1\n0 2 -1", "4\n-1 3 3 3\n3 -1 3 3\n3 3 -1 3\n3 3 3 -1"] | null | PASSED | 900 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β100) β the number of cars. Each of the next n lines contains n space-separated integers that determine matrix A. It is guaranteed that on the main diagonal there are β-β1, and β-β1 doesn't appear anywhere else in the matrix. It is guaranteed that the input is correct, that is... | ["2\n1 3", "0"] | #include <stdio.h>
#include <stdlib.h>
int main(){
int n, *gc, car, count;
scanf("%d", &n);
count = n;
gc = (int*) malloc(n*sizeof(int));
for(int i=0; i < n; i++) gc[i] = 1;
for(int r=0; r < n; r++){
for(int c=0; c < n; c++){
scanf("%d", &car);
if (car >= 2 && gc[c] == 1){
gc[c]... | |
Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process of a tournament is described in the next paragraph.There are n toy cars. Each pair collides. The result of a collision can be one of the following: no car turned over, one car turned ov... | Print the number of good cars and in the next line print their space-separated indices in the increasing order. | C | 3fc0ac711b113fa98f41740536dad44f | 3eb48ac870c25db20dfa982b0297e8cd | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1432053000 | ["3\n-1 0 0\n0 -1 1\n0 2 -1", "4\n-1 3 3 3\n3 -1 3 3\n3 3 -1 3\n3 3 3 -1"] | null | PASSED | 900 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β100) β the number of cars. Each of the next n lines contains n space-separated integers that determine matrix A. It is guaranteed that on the main diagonal there are β-β1, and β-β1 doesn't appear anywhere else in the matrix. It is guaranteed that the input is correct, that is... | ["2\n1 3", "0"] | #include<stdio.h>
int main(n)
{scanf("%d",&n);
int a,i,j,b[100]={0},t=1,c=0;
for(i=0;i<n;i++)
{
t=1;
for(j=0;j<n;j++)
{
scanf("%d",&a);
if(a==3 || a==1)
t=0;
}
if(t)
{
b[i]=i+1;
c++;
}
}
printf("%d\n",c);
for(i=0;i<n;i++)
if(b[i])
printf("%d ",b[i]);
} | |
Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process of a tournament is described in the next paragraph.There are n toy cars. Each pair collides. The result of a collision can be one of the following: no car turned over, one car turned ov... | Print the number of good cars and in the next line print their space-separated indices in the increasing order. | C | 3fc0ac711b113fa98f41740536dad44f | a16677982af0b9c4a0dd1383497dda0e | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1432053000 | ["3\n-1 0 0\n0 -1 1\n0 2 -1", "4\n-1 3 3 3\n3 -1 3 3\n3 3 -1 3\n3 3 3 -1"] | null | PASSED | 900 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β100) β the number of cars. Each of the next n lines contains n space-separated integers that determine matrix A. It is guaranteed that on the main diagonal there are β-β1, and β-β1 doesn't appear anywhere else in the matrix. It is guaranteed that the input is correct, that is... | ["2\n1 3", "0"] | #include <stdio.h>
int main()
{
int Mat[100][100];
int i, j, N, Cnt;
int Ans[100];
scanf("%d", &N);
for(i = 0; i < N; ++i)
{
for(j = 0; j < N; ++j)
{
scanf("%d", &Mat[i][j]);
}
}
Cnt = 0;
for(i = 0; i < N; ++i)
{
for(j = 0; j < N; ++j)... | |
Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process of a tournament is described in the next paragraph.There are n toy cars. Each pair collides. The result of a collision can be one of the following: no car turned over, one car turned ov... | Print the number of good cars and in the next line print their space-separated indices in the increasing order. | C | 3fc0ac711b113fa98f41740536dad44f | 9af2dc87d9e48280128fc33c2c36743f | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1432053000 | ["3\n-1 0 0\n0 -1 1\n0 2 -1", "4\n-1 3 3 3\n3 -1 3 3\n3 3 -1 3\n3 3 3 -1"] | null | PASSED | 900 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β100) β the number of cars. Each of the next n lines contains n space-separated integers that determine matrix A. It is guaranteed that on the main diagonal there are β-β1, and β-β1 doesn't appear anywhere else in the matrix. It is guaranteed that the input is correct, that is... | ["2\n1 3", "0"] | #include <stdio.h>
int ans[101], k;
int main()
{
int n, a[101][101], i, j, cnt=0, t=1;
scanf("%d", &n);
for(i=0; i<n; i++)
{
for(j=0; j<n; j++)
scanf("%d", &a[i][j]);
}
for(i=0; i<n; i++)
{
for(j=0; j<n; j++)
{
if(a[i][j]==1 || a[i][j]==3)
... | |
Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process of a tournament is described in the next paragraph.There are n toy cars. Each pair collides. The result of a collision can be one of the following: no car turned over, one car turned ov... | Print the number of good cars and in the next line print their space-separated indices in the increasing order. | C | 3fc0ac711b113fa98f41740536dad44f | f103f714f2df25cf6e5b236eb4f71c04 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1432053000 | ["3\n-1 0 0\n0 -1 1\n0 2 -1", "4\n-1 3 3 3\n3 -1 3 3\n3 3 -1 3\n3 3 3 -1"] | null | PASSED | 900 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β100) β the number of cars. Each of the next n lines contains n space-separated integers that determine matrix A. It is guaranteed that on the main diagonal there are β-β1, and β-β1 doesn't appear anywhere else in the matrix. It is guaranteed that the input is correct, that is... | ["2\n1 3", "0"] | #include<stdio.h>
int main()
{
int n,i,j,c=0;
scanf("%d",&n);
int x[n][n],y[n];
for(i=0;i<n;i++)
{y[i]=0;
for(j=0;j<n;j++)
{
scanf("%d",&x[i][j]);
if(x[i][j]==1) y[i]=1;
else if(x[i][j]==2) y[j]=1;
else if(x[i][j]==3) {y[i]=1; y[j... | |
Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process of a tournament is described in the next paragraph.There are n toy cars. Each pair collides. The result of a collision can be one of the following: no car turned over, one car turned ov... | Print the number of good cars and in the next line print their space-separated indices in the increasing order. | C | 3fc0ac711b113fa98f41740536dad44f | e1572f434df8b526d94ad1d4d2a0388a | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1432053000 | ["3\n-1 0 0\n0 -1 1\n0 2 -1", "4\n-1 3 3 3\n3 -1 3 3\n3 3 -1 3\n3 3 3 -1"] | null | PASSED | 900 | standard input | 1 second | The first line contains integer n (1ββ€βnββ€β100) β the number of cars. Each of the next n lines contains n space-separated integers that determine matrix A. It is guaranteed that on the main diagonal there are β-β1, and β-β1 doesn't appear anywhere else in the matrix. It is guaranteed that the input is correct, that is... | ["2\n1 3", "0"] | #include <stdio.h>
int main()
{
long n, x[102]={0}, y, i, j, g=0;
scanf("%d", &n);
for(i=1; i<=n; i++)
{
for(j=1; j<=n; j++)
{
scanf("%d", &y);
if(y==1)x[i]++;
if(y==2)x[j]++;
if(y==3)x[i]++, x[j]++;
}
}
for(i=1; i<=n; i++)if(x[i]==0)g+... | |
Tenten runs a weapon shop for ninjas. Today she is willing to sell $$$n$$$ shurikens which cost $$$1$$$, $$$2$$$, ..., $$$n$$$ ryo (local currency). During a day, Tenten will place the shurikens onto the showcase, which is empty at the beginning of the day. Her job is fairly simple: sometimes Tenten places another shur... | If the list is consistent, print "YES". Otherwise (that is, if the list is contradictory and there is no valid order of shurikens placement), print "NO". In the first case the second line must contain $$$n$$$ space-separated integers denoting the prices of shurikens in order they were placed. If there are multiple answ... | C | 5fa2af185c4e3c8a1ce3df0983824bad | 8a2b70492974c3430d6d869a4a96d701 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"data structures",
"implementation",
"greedy"
] | 1603623900 | ["4\n+\n+\n- 2\n+\n- 3\n+\n- 1\n- 4", "1\n- 1\n+", "3\n+\n+\n+\n- 2\n- 1\n- 3"] | NoteIn the first example Tenten first placed shurikens with prices $$$4$$$ and $$$2$$$. After this a customer came in and bought the cheapest shuriken which costed $$$2$$$. Next, Tenten added a shuriken with price $$$3$$$ on the showcase to the already placed $$$4$$$-ryo. Then a new customer bought this $$$3$$$-ryo shu... | PASSED | 1,700 | standard input | 1 second | The first line contains the only integer $$$n$$$ ($$$1\leq n\leq 10^5$$$) standing for the number of shurikens. The following $$$2n$$$ lines describe the events in the format described above. It's guaranteed that there are exactly $$$n$$$ events of the first type, and each price from $$$1$$$ to $$$n$$$ occurs exactly ... | ["YES\n4 2 3 1", "NO", "NO"] | #include <stdio.h>
#define N 100000
int main() {
static int aa[N * 2], qu[N];
int n, i, cnt;
scanf("%d", &n);
for (i = 0; i < n * 2; i++) {
static char s[2];
scanf("%s", s);
if (s[0] != '+')
scanf("%d", &aa[i]);
}
cnt = 0;
for (i = n * 2 - 1; i >= 0; i--)
if (aa[i] > 0) {
if (cnt && qu[cnt - 1]... | |
Santa Claus has Robot which lives on the infinite grid and can move along its lines. He can also, having a sequence of m points p1,βp2,β...,βpm with integer coordinates, do the following: denote its initial location by p0. First, the robot will move from p0 to p1 along one of the shortest paths between them (please not... | The only line of input should contain the minimum possible length of the sequence. | C | b1c7ca90ce9a67605fa058d4fd38c2f2 | 706ddf307861deedc323d03ba8233e6a | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"greedy",
"shortest paths"
] | 1482656700 | ["4\nRURD", "6\nRRULDD", "26\nRRRULURURUULULLLDLDDRDRDLD", "3\nRLL", "4\nLRLR"] | NoteThe illustrations to the first three tests are given below. The last example illustrates that each point in the sequence should be counted as many times as it is presented in the sequence. | PASSED | 1,400 | standard input | 2 seconds | The first line of input contains the only positive integer n (1ββ€βnββ€β2Β·105) which equals the number of unit segments the robot traveled. The second line contains the movements protocol, which consists of n letters, each being equal either L, or R, or U, or D. k-th letter stands for the direction which Robot traveled t... | ["2", "2", "7", "2", "4"] | /* Coached by rainboy */
#include <stdio.h>
#define N 200000
int main() {
static char s[N + 1];
int n, i, left, right, up, down, ans;
scanf("%d%s", &n, s);
ans = left = right = up = down = 0;
for (i = 0; i < n; i++) {
if ((s[i] == 'L' && right) || (s[i] == 'R' && left) || (s[i] == 'U' && down) || (s[i] == 'D'... | |
Santa Claus has Robot which lives on the infinite grid and can move along its lines. He can also, having a sequence of m points p1,βp2,β...,βpm with integer coordinates, do the following: denote its initial location by p0. First, the robot will move from p0 to p1 along one of the shortest paths between them (please not... | The only line of input should contain the minimum possible length of the sequence. | C | b1c7ca90ce9a67605fa058d4fd38c2f2 | 1b83de532cbde449cec02d5b500d8b1b | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"greedy",
"shortest paths"
] | 1482656700 | ["4\nRURD", "6\nRRULDD", "26\nRRRULURURUULULLLDLDDRDRDLD", "3\nRLL", "4\nLRLR"] | NoteThe illustrations to the first three tests are given below. The last example illustrates that each point in the sequence should be counted as many times as it is presented in the sequence. | PASSED | 1,400 | standard input | 2 seconds | The first line of input contains the only positive integer n (1ββ€βnββ€β2Β·105) which equals the number of unit segments the robot traveled. The second line contains the movements protocol, which consists of n letters, each being equal either L, or R, or U, or D. k-th letter stands for the direction which Robot traveled t... | ["2", "2", "7", "2", "4"] | #include <stdio.h>
#include <math.h>
int main()
{
long int n,count=1;
scanf("%ld\n",&n);
char a[n],b[2];
int flag[2];
flag[0]=0;
flag[1]=0;
scanf("%s",a);
for (int i = 0; i < n; ++i)
{ if (flag[0]==0)
{
if (a[i]=='R')
{ flag[0]=1;
b[0]='R';
continue;
}
if (a[i]=='L')
{ flag[0]=... | |
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded.The problem is the follows. Given n points in the plane, find a pair of points between w... | If there doesn't exist such a data which let the given code get TLE, print "no solution" (without quotes); else print n lines, and the i-th line contains two integers xi,βyi (|xi|,β|yi|ββ€β109) representing the coordinates of the i-th point. The conditions below must be held: All the points must be distinct. |xi|,β|y... | C | a7846e4ae1f3fa5051fab9139a25539c | 89da7f9404918dc77a31c81521aa1eeb | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1369582200 | ["4 3", "2 100"] | null | PASSED | 1,300 | standard input | 2 seconds | A single line which contains two space-separated integers n and k (2ββ€βnββ€β2000, 1ββ€βkββ€β109). | ["0 0\n0 1\n1 0\n1 1", "no solution"] | #include <stdio.h>
int main()
{
int n,k;
int i;
while(scanf("%d %d",&n,&k)!=EOF)
{
if((n-1)*n/2<=k)
{
printf("no solution\n");
continue;
}
else
{
for(i=0;i<n;i++)
{
printf("%d %d\n",0,i);
}
}
}
return 0;
} | |
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded.The problem is the follows. Given n points in the plane, find a pair of points between w... | If there doesn't exist such a data which let the given code get TLE, print "no solution" (without quotes); else print n lines, and the i-th line contains two integers xi,βyi (|xi|,β|yi|ββ€β109) representing the coordinates of the i-th point. The conditions below must be held: All the points must be distinct. |xi|,β|y... | C | a7846e4ae1f3fa5051fab9139a25539c | 11b632325aa1028553db3db44c386514 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1369582200 | ["4 3", "2 100"] | null | PASSED | 1,300 | standard input | 2 seconds | A single line which contains two space-separated integers n and k (2ββ€βnββ€β2000, 1ββ€βkββ€β109). | ["0 0\n0 1\n1 0\n1 1", "no solution"] | #include<stdio.h>
int main(){
int n,i;
long int k,sum=0;
scanf("%d%ld",&n,&k);
sum=(n-1)*n/2;
if(sum<=k)
printf("no solution");
else{
for(i=1;i<=n;i++)
printf("%d %d\n",1,i);
}
return 0;
}
| |
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded.The problem is the follows. Given n points in the plane, find a pair of points between w... | If there doesn't exist such a data which let the given code get TLE, print "no solution" (without quotes); else print n lines, and the i-th line contains two integers xi,βyi (|xi|,β|yi|ββ€β109) representing the coordinates of the i-th point. The conditions below must be held: All the points must be distinct. |xi|,β|y... | C | a7846e4ae1f3fa5051fab9139a25539c | 894236610b46c04d24244f812d0e326f | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1369582200 | ["4 3", "2 100"] | null | PASSED | 1,300 | standard input | 2 seconds | A single line which contains two space-separated integers n and k (2ββ€βnββ€β2000, 1ββ€βkββ€β109). | ["0 0\n0 1\n1 0\n1 1", "no solution"] | #include <stdio.h>
int main()
{
int n, k, i;
scanf("%d %d", &n, &k);
if (k >= n * (n - 1) / 2) {
puts("no solution");
} else {
for (i = 0; i < n; i++) printf("0 %d\n", i);
}
return 0;
}
| |
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded.The problem is the follows. Given n points in the plane, find a pair of points between w... | If there doesn't exist such a data which let the given code get TLE, print "no solution" (without quotes); else print n lines, and the i-th line contains two integers xi,βyi (|xi|,β|yi|ββ€β109) representing the coordinates of the i-th point. The conditions below must be held: All the points must be distinct. |xi|,β|y... | C | a7846e4ae1f3fa5051fab9139a25539c | e2f4614feb38e7f286cd4f45ece7c13b | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1369582200 | ["4 3", "2 100"] | null | PASSED | 1,300 | standard input | 2 seconds | A single line which contains two space-separated integers n and k (2ββ€βnββ€β2000, 1ββ€βkββ€β109). | ["0 0\n0 1\n1 0\n1 1", "no solution"] | #include<stdio.h>
int main()
{
int n,k,res,i;
scanf("%d %d",&n,&k);
res=(n*(n-1))/2;
if(res<=k)
printf("no solution\n");
else
for(i=0;i<n;i++)
{
printf("%d %d\n",1,i*2);
}
return 0;
}
| |
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded.The problem is the follows. Given n points in the plane, find a pair of points between w... | If there doesn't exist such a data which let the given code get TLE, print "no solution" (without quotes); else print n lines, and the i-th line contains two integers xi,βyi (|xi|,β|yi|ββ€β109) representing the coordinates of the i-th point. The conditions below must be held: All the points must be distinct. |xi|,β|y... | C | a7846e4ae1f3fa5051fab9139a25539c | 1ae85433f5957a0a5c8765c9654dffe4 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1369582200 | ["4 3", "2 100"] | null | PASSED | 1,300 | standard input | 2 seconds | A single line which contains two space-separated integers n and k (2ββ€βnββ€β2000, 1ββ€βkββ€β109). | ["0 0\n0 1\n1 0\n1 1", "no solution"] | #include <stdio.h>
int main()
{
int N,K,i;
scanf("%d %d",&N,&K);
i=(1+N-1)*(N-1)/2;
if(i<=K)
{
puts("no solution");
}
else
{
for(i=0;i<N;++i)
{
printf("0 %d\n",i,i);
}
}
return 0;
}
| |
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded.The problem is the follows. Given n points in the plane, find a pair of points between w... | If there doesn't exist such a data which let the given code get TLE, print "no solution" (without quotes); else print n lines, and the i-th line contains two integers xi,βyi (|xi|,β|yi|ββ€β109) representing the coordinates of the i-th point. The conditions below must be held: All the points must be distinct. |xi|,β|y... | C | a7846e4ae1f3fa5051fab9139a25539c | fbd6e4478576d6b01f4c8c33c030d78e | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation"
] | 1369582200 | ["4 3", "2 100"] | null | PASSED | 1,300 | standard input | 2 seconds | A single line which contains two space-separated integers n and k (2ββ€βnββ€β2000, 1ββ€βkββ€β109). | ["0 0\n0 1\n1 0\n1 1", "no solution"] | #include<stdio.h>
#include <ctype.h>
#include<string.h>
int main(){
int n,k,i=0,l=1000000000;
scanf("%d %d",&n,&k);
if(k>=((n*(n-1))/2)){
printf("no solution");
return 0;
}
else{
for (i=0; i<n; i++) {
printf("%d %d\n",0,i);
}
}
return 0;
} | |
Soon after the Chunga-Changa island was discovered, it started to acquire some forms of civilization and even market economy. A new currency arose, colloquially called "chizhik". One has to pay in chizhiks to buy a coconut now.Sasha and Masha are about to buy some coconuts which are sold at price $$$z$$$ chizhiks per c... | Print two integers: the maximum possible number of coconuts the girls can buy and the minimum number of chizhiks one girl has to give to the other. | C | 863a8124d46bb09b49fc88939fb5f364 | 117b3bb3707f9633897815484897410f | GNU C11 | standard output | 512 megabytes | train_001.jsonl | [
"greedy",
"math"
] | 1560677700 | ["5 4 3", "6 8 2"] | NoteThe first example is described in the statement. In the second example the optimal solution is to dot exchange any chizhiks. The girls will buy $$$3 + 4 = 7$$$ coconuts. | PASSED | 1,000 | standard input | 1 second | The first line contains three integers $$$x$$$, $$$y$$$ and $$$z$$$ ($$$0 \le x, y \le 10^{18}$$$, $$$1 \le z \le 10^{18}$$$)Β β the number of chizhics Sasha has, the number of chizhics Masha has and the price of a coconut. | ["3 1", "7 0"] | #include<stdio.h>
int main()
{
long long int x,y,z,p,q;
scanf("%lld %lld %lld",&x,&y,&z);
p=x%z;
q=y%z;
printf("%lld ",(x/z)+(y/z)+((p+q)/z));
if((p+q)/z==1)
{
if(p>=q)
{
printf("%lld",z-p);
}
else
{
printf("%lld",z-q);
}
}
else
{
p... | |
Soon after the Chunga-Changa island was discovered, it started to acquire some forms of civilization and even market economy. A new currency arose, colloquially called "chizhik". One has to pay in chizhiks to buy a coconut now.Sasha and Masha are about to buy some coconuts which are sold at price $$$z$$$ chizhiks per c... | Print two integers: the maximum possible number of coconuts the girls can buy and the minimum number of chizhiks one girl has to give to the other. | C | 863a8124d46bb09b49fc88939fb5f364 | 52c62b639f66b650e2c9c2a07fac3b49 | GNU C11 | standard output | 512 megabytes | train_001.jsonl | [
"greedy",
"math"
] | 1560677700 | ["5 4 3", "6 8 2"] | NoteThe first example is described in the statement. In the second example the optimal solution is to dot exchange any chizhiks. The girls will buy $$$3 + 4 = 7$$$ coconuts. | PASSED | 1,000 | standard input | 1 second | The first line contains three integers $$$x$$$, $$$y$$$ and $$$z$$$ ($$$0 \le x, y \le 10^{18}$$$, $$$1 \le z \le 10^{18}$$$)Β β the number of chizhics Sasha has, the number of chizhics Masha has and the price of a coconut. | ["3 1", "7 0"] | #include<stdio.h>
#define ll long long
int main()
{
ll n, m, s;
scanf("%lld %lld %lld", &n, &m, &s);
if(n < m){
ll temp = n % s, min = m % s;
if(temp != 0){
m += temp;
n -= temp;
}
if(temp + min >= s){
if(temp >= min){
min = s - temp;
}else{
min = s - min;
}
}else{
min = 0;
... | |
Soon after the Chunga-Changa island was discovered, it started to acquire some forms of civilization and even market economy. A new currency arose, colloquially called "chizhik". One has to pay in chizhiks to buy a coconut now.Sasha and Masha are about to buy some coconuts which are sold at price $$$z$$$ chizhiks per c... | Print two integers: the maximum possible number of coconuts the girls can buy and the minimum number of chizhiks one girl has to give to the other. | C | 863a8124d46bb09b49fc88939fb5f364 | 0f6c3cb1fd14fee55478c378594003a4 | GNU C11 | standard output | 512 megabytes | train_001.jsonl | [
"greedy",
"math"
] | 1560677700 | ["5 4 3", "6 8 2"] | NoteThe first example is described in the statement. In the second example the optimal solution is to dot exchange any chizhiks. The girls will buy $$$3 + 4 = 7$$$ coconuts. | PASSED | 1,000 | standard input | 1 second | The first line contains three integers $$$x$$$, $$$y$$$ and $$$z$$$ ($$$0 \le x, y \le 10^{18}$$$, $$$1 \le z \le 10^{18}$$$)Β β the number of chizhics Sasha has, the number of chizhics Masha has and the price of a coconut. | ["3 1", "7 0"] | #include <stdio.h>
int main()
{
long long int x,y,z,i,j;
scanf("%I64d %I64d %I64d",&x,&y,&z);
i=(unsigned long long int)(x+y)/z;
if(x%z+y%z>=z)
{
if(x%z>=y%z)
{
j=z-x%z;
}
else j=z-y%z;
}
else j=0;
printf("%I64d %I64d",i,j);
return 0;
}
| |
Soon after the Chunga-Changa island was discovered, it started to acquire some forms of civilization and even market economy. A new currency arose, colloquially called "chizhik". One has to pay in chizhiks to buy a coconut now.Sasha and Masha are about to buy some coconuts which are sold at price $$$z$$$ chizhiks per c... | Print two integers: the maximum possible number of coconuts the girls can buy and the minimum number of chizhiks one girl has to give to the other. | C | 863a8124d46bb09b49fc88939fb5f364 | 20a50f3ecb0d93279f3f5f32627914b3 | GNU C11 | standard output | 512 megabytes | train_001.jsonl | [
"greedy",
"math"
] | 1560677700 | ["5 4 3", "6 8 2"] | NoteThe first example is described in the statement. In the second example the optimal solution is to dot exchange any chizhiks. The girls will buy $$$3 + 4 = 7$$$ coconuts. | PASSED | 1,000 | standard input | 1 second | The first line contains three integers $$$x$$$, $$$y$$$ and $$$z$$$ ($$$0 \le x, y \le 10^{18}$$$, $$$1 \le z \le 10^{18}$$$)Β β the number of chizhics Sasha has, the number of chizhics Masha has and the price of a coconut. | ["3 1", "7 0"] | #include<stdio.h>
int main(){
long long int x, y, z, rx, ry, cocos, p;
scanf("%I64d %I64d %I64d", &x, &y, &z);
cocos = (x + y)/z;
if(x/z + y/z == cocos)
printf("%I64d 0", cocos);
else{
rx = z - (x % z);
ry = z - (y % z);
if(rx < ry)
p = rx;
else
... | |
Soon after the Chunga-Changa island was discovered, it started to acquire some forms of civilization and even market economy. A new currency arose, colloquially called "chizhik". One has to pay in chizhiks to buy a coconut now.Sasha and Masha are about to buy some coconuts which are sold at price $$$z$$$ chizhiks per c... | Print two integers: the maximum possible number of coconuts the girls can buy and the minimum number of chizhiks one girl has to give to the other. | C | 863a8124d46bb09b49fc88939fb5f364 | a53a38ad0f1fabbea58fa3e52b88b26a | GNU C11 | standard output | 512 megabytes | train_001.jsonl | [
"greedy",
"math"
] | 1560677700 | ["5 4 3", "6 8 2"] | NoteThe first example is described in the statement. In the second example the optimal solution is to dot exchange any chizhiks. The girls will buy $$$3 + 4 = 7$$$ coconuts. | PASSED | 1,000 | standard input | 1 second | The first line contains three integers $$$x$$$, $$$y$$$ and $$$z$$$ ($$$0 \le x, y \le 10^{18}$$$, $$$1 \le z \le 10^{18}$$$)Β β the number of chizhics Sasha has, the number of chizhics Masha has and the price of a coconut. | ["3 1", "7 0"] | #include<stdio.h>
#define max(a,b) a>b?a:b
int main()
{
long long int x,y,z,a,b,r=0,sum=0;
scanf("%lld%lld%lld",&x,&y,&z);
sum=(x/z)+(y/z);
a=x%z;
b=y%z;
if(a+b>=z)
{
r=max(a,b);
r=z-r;
printf("%lld %lld\n",sum+1,r);
}
else
printf("%lld %lld\n",sum,r);... | |
Soon after the Chunga-Changa island was discovered, it started to acquire some forms of civilization and even market economy. A new currency arose, colloquially called "chizhik". One has to pay in chizhiks to buy a coconut now.Sasha and Masha are about to buy some coconuts which are sold at price $$$z$$$ chizhiks per c... | Print two integers: the maximum possible number of coconuts the girls can buy and the minimum number of chizhiks one girl has to give to the other. | C | 863a8124d46bb09b49fc88939fb5f364 | d1aaa4bddb628ed0405dc017cf8bfebd | GNU C11 | standard output | 512 megabytes | train_001.jsonl | [
"greedy",
"math"
] | 1560677700 | ["5 4 3", "6 8 2"] | NoteThe first example is described in the statement. In the second example the optimal solution is to dot exchange any chizhiks. The girls will buy $$$3 + 4 = 7$$$ coconuts. | PASSED | 1,000 | standard input | 1 second | The first line contains three integers $$$x$$$, $$$y$$$ and $$$z$$$ ($$$0 \le x, y \le 10^{18}$$$, $$$1 \le z \le 10^{18}$$$)Β β the number of chizhics Sasha has, the number of chizhics Masha has and the price of a coconut. | ["3 1", "7 0"] | #include<stdio.h>
int main()
{
long long int x,y,z,n,e,a,b,c,d;
scanf("%lld %lld %lld",&x,&y,&z);
n=(x+y)/z;
a=x%z;
b=y%z;
c=(a==0)?0:(z-a);
d=(b==0)?0:(z-b);
if(a+b>=z)
{
if(a<=b && a<=c && a<=d)
e=a;
else if(b<=c && b<=d)
e=b;
else if... | |
Soon after the Chunga-Changa island was discovered, it started to acquire some forms of civilization and even market economy. A new currency arose, colloquially called "chizhik". One has to pay in chizhiks to buy a coconut now.Sasha and Masha are about to buy some coconuts which are sold at price $$$z$$$ chizhiks per c... | Print two integers: the maximum possible number of coconuts the girls can buy and the minimum number of chizhiks one girl has to give to the other. | C | 863a8124d46bb09b49fc88939fb5f364 | 6d103feeace67740fa5f18fc6211035e | GNU C11 | standard output | 512 megabytes | train_001.jsonl | [
"greedy",
"math"
] | 1560677700 | ["5 4 3", "6 8 2"] | NoteThe first example is described in the statement. In the second example the optimal solution is to dot exchange any chizhiks. The girls will buy $$$3 + 4 = 7$$$ coconuts. | PASSED | 1,000 | standard input | 1 second | The first line contains three integers $$$x$$$, $$$y$$$ and $$$z$$$ ($$$0 \le x, y \le 10^{18}$$$, $$$1 \le z \le 10^{18}$$$)Β β the number of chizhics Sasha has, the number of chizhics Masha has and the price of a coconut. | ["3 1", "7 0"] | #include <stdio.h>
int main()
{
long long int x,y,z,l,a,b,k=0;
scanf("%I64d %I64d %I64d",&x,&y,&z);
l=(x+y)/z;
a=x%z;
b=y%z;
if((a+b)>=z)
{
if(a>b)
{
k=z-a;
}
else
{
k=z-b;
}
}
printf("%I64d %I64d\n",l,k);
return 0;
}
| |
Soon after the Chunga-Changa island was discovered, it started to acquire some forms of civilization and even market economy. A new currency arose, colloquially called "chizhik". One has to pay in chizhiks to buy a coconut now.Sasha and Masha are about to buy some coconuts which are sold at price $$$z$$$ chizhiks per c... | Print two integers: the maximum possible number of coconuts the girls can buy and the minimum number of chizhiks one girl has to give to the other. | C | 863a8124d46bb09b49fc88939fb5f364 | f8c3e3f0c895f218902e41a27bef2761 | GNU C11 | standard output | 512 megabytes | train_001.jsonl | [
"greedy",
"math"
] | 1560677700 | ["5 4 3", "6 8 2"] | NoteThe first example is described in the statement. In the second example the optimal solution is to dot exchange any chizhiks. The girls will buy $$$3 + 4 = 7$$$ coconuts. | PASSED | 1,000 | standard input | 1 second | The first line contains three integers $$$x$$$, $$$y$$$ and $$$z$$$ ($$$0 \le x, y \le 10^{18}$$$, $$$1 \le z \le 10^{18}$$$)Β β the number of chizhics Sasha has, the number of chizhics Masha has and the price of a coconut. | ["3 1", "7 0"] | #include <stdio.h>
int main()
{
long long int x,y,z,l,a,b,k=0;
scanf("%I64d %I64d %I64d",&x,&y,&z);
l=(x+y)/z;
a=x%z;
b=y%z;
if((a+b)>=z)
{
if(a>b)
{
k=z-a;
}
else
{
k=z-b;
}
}
printf("%I64d %I64d\n",l,k);
return 0;
} | |
Soon after the Chunga-Changa island was discovered, it started to acquire some forms of civilization and even market economy. A new currency arose, colloquially called "chizhik". One has to pay in chizhiks to buy a coconut now.Sasha and Masha are about to buy some coconuts which are sold at price $$$z$$$ chizhiks per c... | Print two integers: the maximum possible number of coconuts the girls can buy and the minimum number of chizhiks one girl has to give to the other. | C | 863a8124d46bb09b49fc88939fb5f364 | 45bfeeb3f3024cd032baa41750c8542a | GNU C11 | standard output | 512 megabytes | train_001.jsonl | [
"greedy",
"math"
] | 1560677700 | ["5 4 3", "6 8 2"] | NoteThe first example is described in the statement. In the second example the optimal solution is to dot exchange any chizhiks. The girls will buy $$$3 + 4 = 7$$$ coconuts. | PASSED | 1,000 | standard input | 1 second | The first line contains three integers $$$x$$$, $$$y$$$ and $$$z$$$ ($$$0 \le x, y \le 10^{18}$$$, $$$1 \le z \le 10^{18}$$$)Β β the number of chizhics Sasha has, the number of chizhics Masha has and the price of a coconut. | ["3 1", "7 0"] | #include <inttypes.h>
#include <stdio.h>
int main()
{
int64_t x,y,z,a,b,c,k;
scanf ("%I64d %I64d %I64d",&x,&y,&z);
a=x%z;
b=y%z;
c=x/z+y/z;
if ((a==0)||(b==0)) k=0;
else {
if (((a<=b)&&(a>=z-b)) || ((b<=a)&&(b>=z-a))) {
++c;
if (a<=b) k=z-b;
else ... | |
Soon after the Chunga-Changa island was discovered, it started to acquire some forms of civilization and even market economy. A new currency arose, colloquially called "chizhik". One has to pay in chizhiks to buy a coconut now.Sasha and Masha are about to buy some coconuts which are sold at price $$$z$$$ chizhiks per c... | Print two integers: the maximum possible number of coconuts the girls can buy and the minimum number of chizhiks one girl has to give to the other. | C | 863a8124d46bb09b49fc88939fb5f364 | 56a9103b3af297f3b9cb79f8b859d175 | GNU C11 | standard output | 512 megabytes | train_001.jsonl | [
"greedy",
"math"
] | 1560677700 | ["5 4 3", "6 8 2"] | NoteThe first example is described in the statement. In the second example the optimal solution is to dot exchange any chizhiks. The girls will buy $$$3 + 4 = 7$$$ coconuts. | PASSED | 1,000 | standard input | 1 second | The first line contains three integers $$$x$$$, $$$y$$$ and $$$z$$$ ($$$0 \le x, y \le 10^{18}$$$, $$$1 \le z \le 10^{18}$$$)Β β the number of chizhics Sasha has, the number of chizhics Masha has and the price of a coconut. | ["3 1", "7 0"] | #include <stdio.h>
#include <stdlib.h>
int main(int argc, char const *argv[])
{
unsigned long long int x , y , z ;
scanf("%I64d %I64d %I64d",&x,&y,&z);
//io
unsigned long long int modx , mody,increase,difference,temp,buy;
modx = x%z;
mody = y%z ;
if (modx > mody)
{
modx = (modx + mody);
increase = modx /... | |
Soon after the Chunga-Changa island was discovered, it started to acquire some forms of civilization and even market economy. A new currency arose, colloquially called "chizhik". One has to pay in chizhiks to buy a coconut now.Sasha and Masha are about to buy some coconuts which are sold at price $$$z$$$ chizhiks per c... | Print two integers: the maximum possible number of coconuts the girls can buy and the minimum number of chizhiks one girl has to give to the other. | C | 863a8124d46bb09b49fc88939fb5f364 | 8165f5b5fdaa180bf0f2c126d3cd7efb | GNU C11 | standard output | 512 megabytes | train_001.jsonl | [
"greedy",
"math"
] | 1560677700 | ["5 4 3", "6 8 2"] | NoteThe first example is described in the statement. In the second example the optimal solution is to dot exchange any chizhiks. The girls will buy $$$3 + 4 = 7$$$ coconuts. | PASSED | 1,000 | standard input | 1 second | The first line contains three integers $$$x$$$, $$$y$$$ and $$$z$$$ ($$$0 \le x, y \le 10^{18}$$$, $$$1 \le z \le 10^{18}$$$)Β β the number of chizhics Sasha has, the number of chizhics Masha has and the price of a coconut. | ["3 1", "7 0"] | #include <stdio.h>
#include <stdlib.h>
int main(int argc, char const *argv[])
{
unsigned long long int x , y , z ;
scanf("%I64d %I64d %I64d",&x,&y,&z);
unsigned long long int modx , mody,increase,difference,temp,buy;
modx = x%z;
mody = y%z ;
if (modx > mody)
{
modx = (modx + mody);
increase = modx / z ;
... | |
Soon after the Chunga-Changa island was discovered, it started to acquire some forms of civilization and even market economy. A new currency arose, colloquially called "chizhik". One has to pay in chizhiks to buy a coconut now.Sasha and Masha are about to buy some coconuts which are sold at price $$$z$$$ chizhiks per c... | Print two integers: the maximum possible number of coconuts the girls can buy and the minimum number of chizhiks one girl has to give to the other. | C | 863a8124d46bb09b49fc88939fb5f364 | ecac32ec4e4bfa38c81c3320bc63dcd9 | GNU C11 | standard output | 512 megabytes | train_001.jsonl | [
"greedy",
"math"
] | 1560677700 | ["5 4 3", "6 8 2"] | NoteThe first example is described in the statement. In the second example the optimal solution is to dot exchange any chizhiks. The girls will buy $$$3 + 4 = 7$$$ coconuts. | PASSED | 1,000 | standard input | 1 second | The first line contains three integers $$$x$$$, $$$y$$$ and $$$z$$$ ($$$0 \le x, y \le 10^{18}$$$, $$$1 \le z \le 10^{18}$$$)Β β the number of chizhics Sasha has, the number of chizhics Masha has and the price of a coconut. | ["3 1", "7 0"] | #include<stdio.h>
int main()
{
long long int a,b,c,d,e,f,g=0,h=0;
scanf("%lld%lld%lld",&a,&b,&c);
d=(a+b)/c;
e=a%c;
f=b%c;
if((e+f)>=c)
{
if(e>f)
g=c-e;
else
g=c-f;
}
printf("%lld %lld",d,g);
}
| |
Soon after the Chunga-Changa island was discovered, it started to acquire some forms of civilization and even market economy. A new currency arose, colloquially called "chizhik". One has to pay in chizhiks to buy a coconut now.Sasha and Masha are about to buy some coconuts which are sold at price $$$z$$$ chizhiks per c... | Print two integers: the maximum possible number of coconuts the girls can buy and the minimum number of chizhiks one girl has to give to the other. | C | 863a8124d46bb09b49fc88939fb5f364 | 6014c55f5e77fc310c8d03d50a93c8a4 | GNU C11 | standard output | 512 megabytes | train_001.jsonl | [
"greedy",
"math"
] | 1560677700 | ["5 4 3", "6 8 2"] | NoteThe first example is described in the statement. In the second example the optimal solution is to dot exchange any chizhiks. The girls will buy $$$3 + 4 = 7$$$ coconuts. | PASSED | 1,000 | standard input | 1 second | The first line contains three integers $$$x$$$, $$$y$$$ and $$$z$$$ ($$$0 \le x, y \le 10^{18}$$$, $$$1 \le z \le 10^{18}$$$)Β β the number of chizhics Sasha has, the number of chizhics Masha has and the price of a coconut. | ["3 1", "7 0"] | #include <stdio.h>
int main(void){
long long x,y,z;
long long sum;
long long a1,a2;
scanf("%I64d %I64d %I64d",&x,&y,&z);
sum=x+y;
if(sum%z==0){
long long M=x>y?x:y;
a1=sum/z;
a2=(M%z)<(z-(M%z))?(M%z):(z-(M%z));
printf("%I64d %I64d\n",a1,a2);
}else{
long long m1=(x%z)<(z-(x%z))?(x%z):(z-(x%z));
long ... | |
Soon after the Chunga-Changa island was discovered, it started to acquire some forms of civilization and even market economy. A new currency arose, colloquially called "chizhik". One has to pay in chizhiks to buy a coconut now.Sasha and Masha are about to buy some coconuts which are sold at price $$$z$$$ chizhiks per c... | Print two integers: the maximum possible number of coconuts the girls can buy and the minimum number of chizhiks one girl has to give to the other. | C | 863a8124d46bb09b49fc88939fb5f364 | f16e9f39daa810b21478b2e29ee1a02a | GNU C11 | standard output | 512 megabytes | train_001.jsonl | [
"greedy",
"math"
] | 1560677700 | ["5 4 3", "6 8 2"] | NoteThe first example is described in the statement. In the second example the optimal solution is to dot exchange any chizhiks. The girls will buy $$$3 + 4 = 7$$$ coconuts. | PASSED | 1,000 | standard input | 1 second | The first line contains three integers $$$x$$$, $$$y$$$ and $$$z$$$ ($$$0 \le x, y \le 10^{18}$$$, $$$1 \le z \le 10^{18}$$$)Β β the number of chizhics Sasha has, the number of chizhics Masha has and the price of a coconut. | ["3 1", "7 0"] | #include<stdio.h>
long long x,y,z,c=0,p=0;
int main()
{
scanf("%I64d %I64d %I64d",&x,&y,&z);
c+=(x/z);
c+=(y/z);
long long a=(x%z),b=(y%z);
if(a+b>=z)
{
if(a>=b)p=b-((a+b)%z);
else p=a-((a+b)%z);
}
c+=((a+b)/z);
printf("%I64d %I64d",c,p);
}
| |
Soon after the Chunga-Changa island was discovered, it started to acquire some forms of civilization and even market economy. A new currency arose, colloquially called "chizhik". One has to pay in chizhiks to buy a coconut now.Sasha and Masha are about to buy some coconuts which are sold at price $$$z$$$ chizhiks per c... | Print two integers: the maximum possible number of coconuts the girls can buy and the minimum number of chizhiks one girl has to give to the other. | C | 863a8124d46bb09b49fc88939fb5f364 | 4f785ddd5bee72b543fe4b4481a9bed0 | GNU C11 | standard output | 512 megabytes | train_001.jsonl | [
"greedy",
"math"
] | 1560677700 | ["5 4 3", "6 8 2"] | NoteThe first example is described in the statement. In the second example the optimal solution is to dot exchange any chizhiks. The girls will buy $$$3 + 4 = 7$$$ coconuts. | PASSED | 1,000 | standard input | 1 second | The first line contains three integers $$$x$$$, $$$y$$$ and $$$z$$$ ($$$0 \le x, y \le 10^{18}$$$, $$$1 \le z \le 10^{18}$$$)Β β the number of chizhics Sasha has, the number of chizhics Masha has and the price of a coconut. | ["3 1", "7 0"] | #include<stdio.h>
int main()
{
long long x,y,z,min,max,r;
scanf("%lld%lld%lld",&x,&y,&z);
if(x%z==0||y%z==0)
{
printf("%lld %d",(x/z)+(y/z),0);
}
else
{
if(x%z>y%z)
{
min=y%z;
max=x%z;
}
else
{
min=x%z;
max=y%z;
}
r=z-max;
if(r>min)
{
... | |
Soon after the Chunga-Changa island was discovered, it started to acquire some forms of civilization and even market economy. A new currency arose, colloquially called "chizhik". One has to pay in chizhiks to buy a coconut now.Sasha and Masha are about to buy some coconuts which are sold at price $$$z$$$ chizhiks per c... | Print two integers: the maximum possible number of coconuts the girls can buy and the minimum number of chizhiks one girl has to give to the other. | C | 863a8124d46bb09b49fc88939fb5f364 | 678625615d3e008ac9885fba4f89521f | GNU C11 | standard output | 512 megabytes | train_001.jsonl | [
"greedy",
"math"
] | 1560677700 | ["5 4 3", "6 8 2"] | NoteThe first example is described in the statement. In the second example the optimal solution is to dot exchange any chizhiks. The girls will buy $$$3 + 4 = 7$$$ coconuts. | PASSED | 1,000 | standard input | 1 second | The first line contains three integers $$$x$$$, $$$y$$$ and $$$z$$$ ($$$0 \le x, y \le 10^{18}$$$, $$$1 \le z \le 10^{18}$$$)Β β the number of chizhics Sasha has, the number of chizhics Masha has and the price of a coconut. | ["3 1", "7 0"] | #include<stdio.h>
long long max(long long x,long long y){
if(x>y)
return x;
else
return y;
}
long long min(long long x,long long y){
if(x>y)
return y;
else
return x;
}
main(){
long long a,b,c;
long long x,y,z;
scanf("%I64d%I64d%I64d",&a,&b,&c);
x=(a+b)/c;
y=(a+b)%c;
printf("%I64d %I64d",x,max(min((a%c)... | |
Soon after the Chunga-Changa island was discovered, it started to acquire some forms of civilization and even market economy. A new currency arose, colloquially called "chizhik". One has to pay in chizhiks to buy a coconut now.Sasha and Masha are about to buy some coconuts which are sold at price $$$z$$$ chizhiks per c... | Print two integers: the maximum possible number of coconuts the girls can buy and the minimum number of chizhiks one girl has to give to the other. | C | 863a8124d46bb09b49fc88939fb5f364 | e79b006e0809dcf123c32a71b8e02134 | GNU C11 | standard output | 512 megabytes | train_001.jsonl | [
"greedy",
"math"
] | 1560677700 | ["5 4 3", "6 8 2"] | NoteThe first example is described in the statement. In the second example the optimal solution is to dot exchange any chizhiks. The girls will buy $$$3 + 4 = 7$$$ coconuts. | PASSED | 1,000 | standard input | 1 second | The first line contains three integers $$$x$$$, $$$y$$$ and $$$z$$$ ($$$0 \le x, y \le 10^{18}$$$, $$$1 \le z \le 10^{18}$$$)Β β the number of chizhics Sasha has, the number of chizhics Masha has and the price of a coconut. | ["3 1", "7 0"] | #include<stdio.h>
int main()
{
unsigned long long int a,b,c,i,j,k,l;
scanf("%llu %llu %llu",&a,&b,&c);
if(a%c==0||b%c==0)
{
printf("%llu 0",(a/c+b/c));
}
else
{
if(a+b>=c)
{
if((a/c+b/c)==((a+b)/c))
printf("%llu 0",(a+b)/c);
else if((c-(a%c))<=(c-(b%c)))
printf("%llu %l... | |
Soon after the Chunga-Changa island was discovered, it started to acquire some forms of civilization and even market economy. A new currency arose, colloquially called "chizhik". One has to pay in chizhiks to buy a coconut now.Sasha and Masha are about to buy some coconuts which are sold at price $$$z$$$ chizhiks per c... | Print two integers: the maximum possible number of coconuts the girls can buy and the minimum number of chizhiks one girl has to give to the other. | C | 863a8124d46bb09b49fc88939fb5f364 | fc61b196000cdb4eeeba4f80de126bed | GNU C11 | standard output | 512 megabytes | train_001.jsonl | [
"greedy",
"math"
] | 1560677700 | ["5 4 3", "6 8 2"] | NoteThe first example is described in the statement. In the second example the optimal solution is to dot exchange any chizhiks. The girls will buy $$$3 + 4 = 7$$$ coconuts. | PASSED | 1,000 | standard input | 1 second | The first line contains three integers $$$x$$$, $$$y$$$ and $$$z$$$ ($$$0 \le x, y \le 10^{18}$$$, $$$1 \le z \le 10^{18}$$$)Β β the number of chizhics Sasha has, the number of chizhics Masha has and the price of a coconut. | ["3 1", "7 0"] | #include<stdio.h>
int main()
{
long long unsigned int x,y,z,total,rem_1,rem_2;
scanf("%llu%llu%llu",&x,&y,&z);
total=(x+y)/z;
rem_1=x%z;
rem_2=y%z;
if(rem_1==0 || rem_2==0)
printf("%llu %d",total,0);
else if((rem_1+rem_2)<z)
printf("%llu %d",total,0);
else
{
i... | |
Soon after the Chunga-Changa island was discovered, it started to acquire some forms of civilization and even market economy. A new currency arose, colloquially called "chizhik". One has to pay in chizhiks to buy a coconut now.Sasha and Masha are about to buy some coconuts which are sold at price $$$z$$$ chizhiks per c... | Print two integers: the maximum possible number of coconuts the girls can buy and the minimum number of chizhiks one girl has to give to the other. | C | 863a8124d46bb09b49fc88939fb5f364 | f1ceac9fb3e9a7296986780ad9f68311 | GNU C11 | standard output | 512 megabytes | train_001.jsonl | [
"greedy",
"math"
] | 1560677700 | ["5 4 3", "6 8 2"] | NoteThe first example is described in the statement. In the second example the optimal solution is to dot exchange any chizhiks. The girls will buy $$$3 + 4 = 7$$$ coconuts. | PASSED | 1,000 | standard input | 1 second | The first line contains three integers $$$x$$$, $$$y$$$ and $$$z$$$ ($$$0 \le x, y \le 10^{18}$$$, $$$1 \le z \le 10^{18}$$$)Β β the number of chizhics Sasha has, the number of chizhics Masha has and the price of a coconut. | ["3 1", "7 0"] | #include <stdio.h>
long long min(long long a, long long b){
return (a < b ? a : b);
}
int main(){
long long x, y, z;
scanf("%lld%lld%lld", &x, &y, &z);
long long res;
res = (x / z) + (y / z);
x %= z; y %= z;
res += (x + y) / z;
if(x + y < z)
printf("%lld 0\n", res);
else
printf("%lld %lld\n"... | |
Soon after the Chunga-Changa island was discovered, it started to acquire some forms of civilization and even market economy. A new currency arose, colloquially called "chizhik". One has to pay in chizhiks to buy a coconut now.Sasha and Masha are about to buy some coconuts which are sold at price $$$z$$$ chizhiks per c... | Print two integers: the maximum possible number of coconuts the girls can buy and the minimum number of chizhiks one girl has to give to the other. | C | 863a8124d46bb09b49fc88939fb5f364 | 6fdb7b4b86894260a61bb659ac6dc171 | GNU C11 | standard output | 512 megabytes | train_001.jsonl | [
"greedy",
"math"
] | 1560677700 | ["5 4 3", "6 8 2"] | NoteThe first example is described in the statement. In the second example the optimal solution is to dot exchange any chizhiks. The girls will buy $$$3 + 4 = 7$$$ coconuts. | PASSED | 1,000 | standard input | 1 second | The first line contains three integers $$$x$$$, $$$y$$$ and $$$z$$$ ($$$0 \le x, y \le 10^{18}$$$, $$$1 \le z \le 10^{18}$$$)Β β the number of chizhics Sasha has, the number of chizhics Masha has and the price of a coconut. | ["3 1", "7 0"] | #include <stdio.h>
long long min(long long a, long long b){
return (a < b ? a : b);
}
int main(){
long long x, y, z;
long long res, mn;
scanf("%lld%lld%lld", &x, &y, &z);
res = (x + y) / z;
x %= z; y %= z;
if(x + y >= z) mn = min(z - x, z - y);
else mn = 0;
printf("%lld %lld\n"... | |
Soon after the Chunga-Changa island was discovered, it started to acquire some forms of civilization and even market economy. A new currency arose, colloquially called "chizhik". One has to pay in chizhiks to buy a coconut now.Sasha and Masha are about to buy some coconuts which are sold at price $$$z$$$ chizhiks per c... | Print two integers: the maximum possible number of coconuts the girls can buy and the minimum number of chizhiks one girl has to give to the other. | C | 863a8124d46bb09b49fc88939fb5f364 | dec597c1788959bcd5650b379664ba3d | GNU C11 | standard output | 512 megabytes | train_001.jsonl | [
"greedy",
"math"
] | 1560677700 | ["5 4 3", "6 8 2"] | NoteThe first example is described in the statement. In the second example the optimal solution is to dot exchange any chizhiks. The girls will buy $$$3 + 4 = 7$$$ coconuts. | PASSED | 1,000 | standard input | 1 second | The first line contains three integers $$$x$$$, $$$y$$$ and $$$z$$$ ($$$0 \le x, y \le 10^{18}$$$, $$$1 \le z \le 10^{18}$$$)Β β the number of chizhics Sasha has, the number of chizhics Masha has and the price of a coconut. | ["3 1", "7 0"] | #include<stdio.h>
int main()
{
long long int a,b,c,p,q,r,k;
scanf("%I64d %I64d %I64d",&a,&b,&c);
p=(a+b)/c;
q=a%c;
r=b%c;
if(q+r>=c)
{
if(q>=r)
k=c-q;
else
k=c-r;
}
else
k=0;
printf("%I64d %I64d",p,k);
} | |
Soon after the Chunga-Changa island was discovered, it started to acquire some forms of civilization and even market economy. A new currency arose, colloquially called "chizhik". One has to pay in chizhiks to buy a coconut now.Sasha and Masha are about to buy some coconuts which are sold at price $$$z$$$ chizhiks per c... | Print two integers: the maximum possible number of coconuts the girls can buy and the minimum number of chizhiks one girl has to give to the other. | C | 863a8124d46bb09b49fc88939fb5f364 | ae13f1d66fd29f547d139f864af21fb3 | GNU C11 | standard output | 512 megabytes | train_001.jsonl | [
"greedy",
"math"
] | 1560677700 | ["5 4 3", "6 8 2"] | NoteThe first example is described in the statement. In the second example the optimal solution is to dot exchange any chizhiks. The girls will buy $$$3 + 4 = 7$$$ coconuts. | PASSED | 1,000 | standard input | 1 second | The first line contains three integers $$$x$$$, $$$y$$$ and $$$z$$$ ($$$0 \le x, y \le 10^{18}$$$, $$$1 \le z \le 10^{18}$$$)Β β the number of chizhics Sasha has, the number of chizhics Masha has and the price of a coconut. | ["3 1", "7 0"] | #include<stdio.h>
int main()
{
unsigned long long int x,y,z,n1,n2,t = 0,g = 0,k;
scanf("%llu%llu%llu",&x,&y,&z);
t = x/z + y/z;
if( (x%z != 0) && (y%z != 0) )
{
n1 = x%z;
n2 = y%z;
if ((n1 + n2) >= z )
{
if(n1>=n2)
{
... | |
Soon after the Chunga-Changa island was discovered, it started to acquire some forms of civilization and even market economy. A new currency arose, colloquially called "chizhik". One has to pay in chizhiks to buy a coconut now.Sasha and Masha are about to buy some coconuts which are sold at price $$$z$$$ chizhiks per c... | Print two integers: the maximum possible number of coconuts the girls can buy and the minimum number of chizhiks one girl has to give to the other. | C | 863a8124d46bb09b49fc88939fb5f364 | f18e17d5963223097e7421efb2493880 | GNU C11 | standard output | 512 megabytes | train_001.jsonl | [
"greedy",
"math"
] | 1560677700 | ["5 4 3", "6 8 2"] | NoteThe first example is described in the statement. In the second example the optimal solution is to dot exchange any chizhiks. The girls will buy $$$3 + 4 = 7$$$ coconuts. | PASSED | 1,000 | standard input | 1 second | The first line contains three integers $$$x$$$, $$$y$$$ and $$$z$$$ ($$$0 \le x, y \le 10^{18}$$$, $$$1 \le z \le 10^{18}$$$)Β β the number of chizhics Sasha has, the number of chizhics Masha has and the price of a coconut. | ["3 1", "7 0"] | #include <stdio.h>
int main()
{
long long int x, y, z, k;
scanf("%I64d %I64d %I64d", &x, &y, &z);
k = x % z + y % z;
if (k < z)
printf("%I64d 0", x / z + y / z);
else
{
printf("%I64d ", (x / z) + (y / z) + 1);
if ((x % z) <= (y % z))
printf("%I64d", z - (y % z));
else
printf("%I64d", z - (x % ... | |
Soon after the Chunga-Changa island was discovered, it started to acquire some forms of civilization and even market economy. A new currency arose, colloquially called "chizhik". One has to pay in chizhiks to buy a coconut now.Sasha and Masha are about to buy some coconuts which are sold at price $$$z$$$ chizhiks per c... | Print two integers: the maximum possible number of coconuts the girls can buy and the minimum number of chizhiks one girl has to give to the other. | C | 863a8124d46bb09b49fc88939fb5f364 | ab7edc1c3d2e0233691a1d9db696f6fc | GNU C11 | standard output | 512 megabytes | train_001.jsonl | [
"greedy",
"math"
] | 1560677700 | ["5 4 3", "6 8 2"] | NoteThe first example is described in the statement. In the second example the optimal solution is to dot exchange any chizhiks. The girls will buy $$$3 + 4 = 7$$$ coconuts. | PASSED | 1,000 | standard input | 1 second | The first line contains three integers $$$x$$$, $$$y$$$ and $$$z$$$ ($$$0 \le x, y \le 10^{18}$$$, $$$1 \le z \le 10^{18}$$$)Β β the number of chizhics Sasha has, the number of chizhics Masha has and the price of a coconut. | ["3 1", "7 0"] | #include<stdio.h>
int main(){
long long int x, y, z;
scanf("%lld %lld %lld", &x, &y, &z);
long long int temp=0, tot=0, temp1=0;
tot=tot+(x/z);
if(x%z!=0){
temp=x%z;
}
// 1000000000000000000
tot=tot+(y/z);
if(y%z!=0){
temp1=y%z;
}
long long int ctr=0;
int flag=0;
if(temp>0 && temp1>0){
if(temp+temp... | |
Soon after the Chunga-Changa island was discovered, it started to acquire some forms of civilization and even market economy. A new currency arose, colloquially called "chizhik". One has to pay in chizhiks to buy a coconut now.Sasha and Masha are about to buy some coconuts which are sold at price $$$z$$$ chizhiks per c... | Print two integers: the maximum possible number of coconuts the girls can buy and the minimum number of chizhiks one girl has to give to the other. | C | 863a8124d46bb09b49fc88939fb5f364 | 0761c99a62ab209c87bfdf6d10a18643 | GNU C11 | standard output | 512 megabytes | train_001.jsonl | [
"greedy",
"math"
] | 1560677700 | ["5 4 3", "6 8 2"] | NoteThe first example is described in the statement. In the second example the optimal solution is to dot exchange any chizhiks. The girls will buy $$$3 + 4 = 7$$$ coconuts. | PASSED | 1,000 | standard input | 1 second | The first line contains three integers $$$x$$$, $$$y$$$ and $$$z$$$ ($$$0 \le x, y \le 10^{18}$$$, $$$1 \le z \le 10^{18}$$$)Β β the number of chizhics Sasha has, the number of chizhics Masha has and the price of a coconut. | ["3 1", "7 0"] | // https://codeforces.com/contest/1181/problem/A
#include <stdio.h>
#define ll long long
#define MIN(a,b) \
({ __typeof__ (a) _a = (a); \
__typeof__ (b) _b = (b); \
_a < _b ? _a : _b; })
int main(){
ll a, b, p, max, min;
scanf("%I64d %I64d %I64d", &a, &b, &p);
max = (a + b)/p;
if (max == (a/p... | |
Soon after the Chunga-Changa island was discovered, it started to acquire some forms of civilization and even market economy. A new currency arose, colloquially called "chizhik". One has to pay in chizhiks to buy a coconut now.Sasha and Masha are about to buy some coconuts which are sold at price $$$z$$$ chizhiks per c... | Print two integers: the maximum possible number of coconuts the girls can buy and the minimum number of chizhiks one girl has to give to the other. | C | 863a8124d46bb09b49fc88939fb5f364 | fc12d04d54746e1225fa9903b4634cac | GNU C11 | standard output | 512 megabytes | train_001.jsonl | [
"greedy",
"math"
] | 1560677700 | ["5 4 3", "6 8 2"] | NoteThe first example is described in the statement. In the second example the optimal solution is to dot exchange any chizhiks. The girls will buy $$$3 + 4 = 7$$$ coconuts. | PASSED | 1,000 | standard input | 1 second | The first line contains three integers $$$x$$$, $$$y$$$ and $$$z$$$ ($$$0 \le x, y \le 10^{18}$$$, $$$1 \le z \le 10^{18}$$$)Β β the number of chizhics Sasha has, the number of chizhics Masha has and the price of a coconut. | ["3 1", "7 0"] | #include <stdio.h>
typedef long long ll;
int main()
{
ll x, y, z, num, dbt=0;
scanf("%I64d%I64d%I64d", &x, &y, &z);
num = (x+y)/z;
if (num > (x/z+y/z))
{
if (((x/z+1)*z-x)<(y/z+1)*z-y) dbt = y%z>=((x/z+1)*z-x)?((x/z+1)*z-x):0;
else dbt = x%z>=((y/z+1)*z-y)?((y/z+1)*z-y):0;
}
printf("%I64d %I64d\n", num, dbt)... | |
Soon after the Chunga-Changa island was discovered, it started to acquire some forms of civilization and even market economy. A new currency arose, colloquially called "chizhik". One has to pay in chizhiks to buy a coconut now.Sasha and Masha are about to buy some coconuts which are sold at price $$$z$$$ chizhiks per c... | Print two integers: the maximum possible number of coconuts the girls can buy and the minimum number of chizhiks one girl has to give to the other. | C | 863a8124d46bb09b49fc88939fb5f364 | 5df351a48c1bc884be9348629f02e6c0 | GNU C11 | standard output | 512 megabytes | train_001.jsonl | [
"greedy",
"math"
] | 1560677700 | ["5 4 3", "6 8 2"] | NoteThe first example is described in the statement. In the second example the optimal solution is to dot exchange any chizhiks. The girls will buy $$$3 + 4 = 7$$$ coconuts. | PASSED | 1,000 | standard input | 1 second | The first line contains three integers $$$x$$$, $$$y$$$ and $$$z$$$ ($$$0 \le x, y \le 10^{18}$$$, $$$1 \le z \le 10^{18}$$$)Β β the number of chizhics Sasha has, the number of chizhics Masha has and the price of a coconut. | ["3 1", "7 0"] | #include<stdio.h>
int main()
{
long long int x,y,z,s,a,b,d=0;
scanf("%lld %lld %lld",&x,&y,&z);
s=(x/z)+(y/z);
a=x%z;
b=y%z;
if((a+b)>=z)
{
s=s+1;
if(a>=b)
{
d=z-a;
}
else
{
d=z-b;
}
}
printf("%lld %lld\n... | |
Soon after the Chunga-Changa island was discovered, it started to acquire some forms of civilization and even market economy. A new currency arose, colloquially called "chizhik". One has to pay in chizhiks to buy a coconut now.Sasha and Masha are about to buy some coconuts which are sold at price $$$z$$$ chizhiks per c... | Print two integers: the maximum possible number of coconuts the girls can buy and the minimum number of chizhiks one girl has to give to the other. | C | 863a8124d46bb09b49fc88939fb5f364 | d98dfcfa30866440618ba8d844880ef9 | GNU C11 | standard output | 512 megabytes | train_001.jsonl | [
"greedy",
"math"
] | 1560677700 | ["5 4 3", "6 8 2"] | NoteThe first example is described in the statement. In the second example the optimal solution is to dot exchange any chizhiks. The girls will buy $$$3 + 4 = 7$$$ coconuts. | PASSED | 1,000 | standard input | 1 second | The first line contains three integers $$$x$$$, $$$y$$$ and $$$z$$$ ($$$0 \le x, y \le 10^{18}$$$, $$$1 \le z \le 10^{18}$$$)Β β the number of chizhics Sasha has, the number of chizhics Masha has and the price of a coconut. | ["3 1", "7 0"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
long long int x,y,z,a;
scanf("%I64d%I64d%I64d",&x,&y,&z);
printf("%I64d %I64d",(x+y)/z,(x%z>y%z)?(y%z<z-x%z)?0:z-x%z:(x%z<z-y%z)?0:z-y%z);
return 0;
}
| |
Soon after the Chunga-Changa island was discovered, it started to acquire some forms of civilization and even market economy. A new currency arose, colloquially called "chizhik". One has to pay in chizhiks to buy a coconut now.Sasha and Masha are about to buy some coconuts which are sold at price $$$z$$$ chizhiks per c... | Print two integers: the maximum possible number of coconuts the girls can buy and the minimum number of chizhiks one girl has to give to the other. | C | 863a8124d46bb09b49fc88939fb5f364 | 884f08f9d93f2b9b88651fc4af76c7d1 | GNU C11 | standard output | 512 megabytes | train_001.jsonl | [
"greedy",
"math"
] | 1560677700 | ["5 4 3", "6 8 2"] | NoteThe first example is described in the statement. In the second example the optimal solution is to dot exchange any chizhiks. The girls will buy $$$3 + 4 = 7$$$ coconuts. | PASSED | 1,000 | standard input | 1 second | The first line contains three integers $$$x$$$, $$$y$$$ and $$$z$$$ ($$$0 \le x, y \le 10^{18}$$$, $$$1 \le z \le 10^{18}$$$)Β β the number of chizhics Sasha has, the number of chizhics Masha has and the price of a coconut. | ["3 1", "7 0"] | #include<stdio.h>
int main()
{
long long int x,y,z,maxc,rest,count;
scanf("%lld%lld%lld",&x,&y,&z);
maxc=(x/z)+(y/z);
rest=(x%z)+(y%z);
if(rest>=z)
{
maxc++;
if((x%z)>=(y%z))
{
count=z-(x%z);
}
else{count=z-(y%z);}
}
else{count=0;}
... | |
Soon after the Chunga-Changa island was discovered, it started to acquire some forms of civilization and even market economy. A new currency arose, colloquially called "chizhik". One has to pay in chizhiks to buy a coconut now.Sasha and Masha are about to buy some coconuts which are sold at price $$$z$$$ chizhiks per c... | Print two integers: the maximum possible number of coconuts the girls can buy and the minimum number of chizhiks one girl has to give to the other. | C | 863a8124d46bb09b49fc88939fb5f364 | 2be9f5c08167b15fb85ff61eb9563064 | GNU C11 | standard output | 512 megabytes | train_001.jsonl | [
"greedy",
"math"
] | 1560677700 | ["5 4 3", "6 8 2"] | NoteThe first example is described in the statement. In the second example the optimal solution is to dot exchange any chizhiks. The girls will buy $$$3 + 4 = 7$$$ coconuts. | PASSED | 1,000 | standard input | 1 second | The first line contains three integers $$$x$$$, $$$y$$$ and $$$z$$$ ($$$0 \le x, y \le 10^{18}$$$, $$$1 \le z \le 10^{18}$$$)Β β the number of chizhics Sasha has, the number of chizhics Masha has and the price of a coconut. | ["3 1", "7 0"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
unsigned long long int sasha, masha, price;
unsigned long long int bought=0,exchanged=0;
scanf("%I64d %I64d %I64d",&sasha,&masha,&price);
bought+=sasha/price;
sasha=sasha%price;
bought+=masha/price;
masha=masha%price;
if (masha>=sasha)
{
if (sasha>=(pri... | |
You're given an undirected graph with $$$n$$$ nodes and $$$m$$$ edges. Nodes are numbered from $$$1$$$ to $$$n$$$.The graph is considered harmonious if and only if the following property holds: For every triple of integers $$$(l, m, r)$$$ such that $$$1 \le l < m < r \le n$$$, if there exists a path going from n... | Print the minimum number of edges we have to add to the graph to make it harmonious. | C | 04fd1a55027cce56a491b984ce3a1d6d | 8697404dd1907138219aa8505632c9ab | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"greedy",
"graphs",
"constructive algorithms",
"dsu",
"sortings",
"dfs and similar"
] | 1573914900 | ["14 8\n1 2\n2 7\n3 4\n6 3\n5 7\n3 8\n6 8\n11 12", "200000 3\n7 9\n9 8\n4 5"] | NoteIn the first example, the given graph is not harmonious (for instance, $$$1 < 6 < 7$$$, node $$$1$$$ can reach node $$$7$$$ through the path $$$1 \rightarrow 2 \rightarrow 7$$$, but node $$$1$$$ can't reach node $$$6$$$). However adding the edge $$$(2, 4)$$$ is sufficient to make it harmonious.In the second e... | PASSED | 1,700 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$3 \le n \le 200\ 000$$$ and $$$1 \le m \le 200\ 000$$$). The $$$i$$$-th of the next $$$m$$$ lines contains two integers $$$u_i$$$ and $$$v_i$$$ ($$$1 \le u_i, v_i \le n$$$, $$$u_i \neq v_i$$$), that mean that there's an edge between nodes $$$u$$$ and $$$v$$$.... | ["1", "0"] | #include <stdio.h>
#include <string.h>
#define N 200000
int max(int a, int b) { return a > b ? a : b; }
int dsu[N], rr[N];
int find(int i) {
return dsu[i] < 0 ? i : (dsu[i] = find(dsu[i]));
}
void join(int i, int j) {
int r;
i = find(i);
j = find(j);
if (i == j)
return;
r = max(rr[i], rr[j]);
if (dsu[i] ... | |
You're given an undirected graph with $$$n$$$ nodes and $$$m$$$ edges. Nodes are numbered from $$$1$$$ to $$$n$$$.The graph is considered harmonious if and only if the following property holds: For every triple of integers $$$(l, m, r)$$$ such that $$$1 \le l < m < r \le n$$$, if there exists a path going from n... | Print the minimum number of edges we have to add to the graph to make it harmonious. | C | 04fd1a55027cce56a491b984ce3a1d6d | c76406049efb04d99a26e13b40de3952 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"greedy",
"graphs",
"constructive algorithms",
"dsu",
"sortings",
"dfs and similar"
] | 1573914900 | ["14 8\n1 2\n2 7\n3 4\n6 3\n5 7\n3 8\n6 8\n11 12", "200000 3\n7 9\n9 8\n4 5"] | NoteIn the first example, the given graph is not harmonious (for instance, $$$1 < 6 < 7$$$, node $$$1$$$ can reach node $$$7$$$ through the path $$$1 \rightarrow 2 \rightarrow 7$$$, but node $$$1$$$ can't reach node $$$6$$$). However adding the edge $$$(2, 4)$$$ is sufficient to make it harmonious.In the second e... | PASSED | 1,700 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$3 \le n \le 200\ 000$$$ and $$$1 \le m \le 200\ 000$$$). The $$$i$$$-th of the next $$$m$$$ lines contains two integers $$$u_i$$$ and $$$v_i$$$ ($$$1 \le u_i, v_i \le n$$$, $$$u_i \neq v_i$$$), that mean that there's an edge between nodes $$$u$$$ and $$$v$$$.... | ["1", "0"] | #include<stdio.h>
#define min(A, B) ((A)<(B)?(A):(B))
#define max(A, B) ((A)>(B)?(A):(B))
int p[200000], low[200000], high[200000], size[200000];
int get_p(int a){
if(p[a]==a) return a;
return p[a]=get_p(p[a]);
}
int main(){
int n, m, i, u, v, st=0, j;
scanf("%d %d", &n, &m);
for(i=0;i<n;++i){
low[i]=high[i]... | |
You're given an undirected graph with $$$n$$$ nodes and $$$m$$$ edges. Nodes are numbered from $$$1$$$ to $$$n$$$.The graph is considered harmonious if and only if the following property holds: For every triple of integers $$$(l, m, r)$$$ such that $$$1 \le l < m < r \le n$$$, if there exists a path going from n... | Print the minimum number of edges we have to add to the graph to make it harmonious. | C | 04fd1a55027cce56a491b984ce3a1d6d | 1122c489f586cdb5ddc44549252d8006 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"greedy",
"graphs",
"constructive algorithms",
"dsu",
"sortings",
"dfs and similar"
] | 1573914900 | ["14 8\n1 2\n2 7\n3 4\n6 3\n5 7\n3 8\n6 8\n11 12", "200000 3\n7 9\n9 8\n4 5"] | NoteIn the first example, the given graph is not harmonious (for instance, $$$1 < 6 < 7$$$, node $$$1$$$ can reach node $$$7$$$ through the path $$$1 \rightarrow 2 \rightarrow 7$$$, but node $$$1$$$ can't reach node $$$6$$$). However adding the edge $$$(2, 4)$$$ is sufficient to make it harmonious.In the second e... | PASSED | 1,700 | standard input | 1 second | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$3 \le n \le 200\ 000$$$ and $$$1 \le m \le 200\ 000$$$). The $$$i$$$-th of the next $$$m$$$ lines contains two integers $$$u_i$$$ and $$$v_i$$$ ($$$1 \le u_i, v_i \le n$$$, $$$u_i \neq v_i$$$), that mean that there's an edge between nodes $$$u$$$ and $$$v$$$.... | ["1", "0"] | #include<stdio.h>
#include<stdlib.h>
int dsu[200005];
int par(int x){
if(dsu[x] < 0) return x;
return dsu[x] = par(dsu[x]);
}
void join(int x, int y){
int px, py;
px = par(x);
py = par(y);
if(px == py) return;
if(dsu[px] > dsu[py])join(py, px);
else {
dsu[px] += dsu[py];
dsu[py] = x;
}
}
i... | |
One night, having had a hard day at work, Petya saw a nightmare. There was a binary search tree in the dream. But it was not the actual tree that scared Petya. The horrifying thing was that Petya couldn't search for elements in this tree. Petya tried many times to choose key and look for it in the tree, and each time h... | Print k real numbers which are the expectations of answers for the keys specified in the input. The answer should differ from the correct one with the measure of absolute or relative error not exceeding 10β-β9. | C | afe77e7b2dd6d7940520d9844ab30cfd | b4064ced3ec6a3bfc185b6c308947c56 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"probabilities",
"sortings",
"binary search",
"dfs and similar",
"trees"
] | 1305903600 | ["7\n-1 8\n1 4\n1 12\n2 2\n2 6\n3 10\n3 14\n1\n1", "3\n-1 5\n1 3\n1 7\n6\n1\n2\n4\n6\n8\n9"] | NoteIn the first sample the search of key 1 with one error results in two paths in the trees: (1, 2, 5) and (1, 3, 6), in parentheses are listed numbers of nodes from the root to a leaf. The keys in the leaves of those paths are equal to 6 and 10 correspondingly, that's why the answer is equal to 8. | PASSED | 2,200 | standard input | 3 seconds | The first line contains an odd integer n (3ββ€βnβ<β105), which represents the number of tree nodes. Next n lines contain node descriptions. The (iβ+β1)-th line contains two space-separated integers. The first number is the number of parent of the i-st node and the second number is the key lying in the i-th node. The ... | ["8.0000000000", "7.0000000000\n7.0000000000\n7.0000000000\n3.0000000000\n3.0000000000\n3.0000000000"] | #include <stdio.h>
#include <stdlib.h>
typedef struct {
int x;
int y;
int i;
} node;
typedef struct {
int l;
int r;
long long s;
int n;
} range;
int a[100000][2][2], f[100000];
range b[100000], v[100000];
int p, q, r;
int s[200000], t[100000];
long long rmq[200000][2];
int cmp(con... | |
One night, having had a hard day at work, Petya saw a nightmare. There was a binary search tree in the dream. But it was not the actual tree that scared Petya. The horrifying thing was that Petya couldn't search for elements in this tree. Petya tried many times to choose key and look for it in the tree, and each time h... | Print k real numbers which are the expectations of answers for the keys specified in the input. The answer should differ from the correct one with the measure of absolute or relative error not exceeding 10β-β9. | C | afe77e7b2dd6d7940520d9844ab30cfd | 55790af0d69052f052fab2129b4ffa5b | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"probabilities",
"sortings",
"binary search",
"dfs and similar",
"trees"
] | 1305903600 | ["7\n-1 8\n1 4\n1 12\n2 2\n2 6\n3 10\n3 14\n1\n1", "3\n-1 5\n1 3\n1 7\n6\n1\n2\n4\n6\n8\n9"] | NoteIn the first sample the search of key 1 with one error results in two paths in the trees: (1, 2, 5) and (1, 3, 6), in parentheses are listed numbers of nodes from the root to a leaf. The keys in the leaves of those paths are equal to 6 and 10 correspondingly, that's why the answer is equal to 8. | PASSED | 2,200 | standard input | 3 seconds | The first line contains an odd integer n (3ββ€βnβ<β105), which represents the number of tree nodes. Next n lines contain node descriptions. The (iβ+β1)-th line contains two space-separated integers. The first number is the number of parent of the i-st node and the second number is the key lying in the i-th node. The ... | ["8.0000000000", "7.0000000000\n7.0000000000\n7.0000000000\n3.0000000000\n3.0000000000\n3.0000000000"] | # include <stdio.h>
# include <string.h>
typedef struct { int izq, der, value, vmostizq, vmostder, hijos[2], nhijos; double avarage; } NODO;
NODO arbol[200002];
int root;
void getmostValues( int node ){
if( node == -1) return;
getmostValues( arbol[ node ].izq );
getmostValues( arbol[ node ].der );
if( ... | |
One night, having had a hard day at work, Petya saw a nightmare. There was a binary search tree in the dream. But it was not the actual tree that scared Petya. The horrifying thing was that Petya couldn't search for elements in this tree. Petya tried many times to choose key and look for it in the tree, and each time h... | Print k real numbers which are the expectations of answers for the keys specified in the input. The answer should differ from the correct one with the measure of absolute or relative error not exceeding 10β-β9. | C | afe77e7b2dd6d7940520d9844ab30cfd | d1b7e8af7b86671c2b62aa0a986d71b1 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"probabilities",
"sortings",
"binary search",
"dfs and similar",
"trees"
] | 1305903600 | ["7\n-1 8\n1 4\n1 12\n2 2\n2 6\n3 10\n3 14\n1\n1", "3\n-1 5\n1 3\n1 7\n6\n1\n2\n4\n6\n8\n9"] | NoteIn the first sample the search of key 1 with one error results in two paths in the trees: (1, 2, 5) and (1, 3, 6), in parentheses are listed numbers of nodes from the root to a leaf. The keys in the leaves of those paths are equal to 6 and 10 correspondingly, that's why the answer is equal to 8. | PASSED | 2,200 | standard input | 3 seconds | The first line contains an odd integer n (3ββ€βnβ<β105), which represents the number of tree nodes. Next n lines contain node descriptions. The (iβ+β1)-th line contains two space-separated integers. The first number is the number of parent of the i-st node and the second number is the key lying in the i-th node. The ... | ["8.0000000000", "7.0000000000\n7.0000000000\n7.0000000000\n3.0000000000\n3.0000000000\n3.0000000000"] | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
void intIntSort(int d[],int m[],int s){int i=-1,j=s,k,t;if(s<=1)return;k=(d[0]+d[s-1])/2;for(;;){while(d[++i]<k);while(d[--j]>k);if(i>=j)break;t=d[i];d[i]=d[j];d[j]=t;t=m[i];m[i]=m[j];m[j]=t;}intIntSor... | |
Valera runs a 24/7 fast food cafe. He magically learned that next day n people will visit his cafe. For each person we know the arrival time: the i-th person comes exactly at hi hours mi minutes. The cafe spends less than a minute to serve each client, but if a client comes in and sees that there is no free cash, than ... | Print a single integer β the minimum number of cashes, needed to serve all clients next day. | C | cfad2cb472e662e037f3415a84daca57 | b70c1c7efcae28ac6d0e24da0923c6b0 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1351179000 | ["4\n8 0\n8 10\n8 10\n8 45", "3\n0 12\n10 11\n22 22"] | NoteIn the first sample it is not enough one cash to serve all clients, because two visitors will come into cafe in 8:10. Therefore, if there will be one cash in cafe, then one customer will be served by it, and another one will not wait and will go away.In the second sample all visitors will come in different times, s... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer n (1ββ€βnββ€β105), that is the number of cafe visitors. Each of the following n lines has two space-separated integers hi and mi (0ββ€βhiββ€β23;Β 0ββ€βmiββ€β59), representing the time when the i-th person comes into the cafe. Note that the time is given in the chronological order. All... | ["2", "1"] |
#include<stdio.h>
int main()
{
int count=1,max=0,n,hr,min;
int i,j,k;
scanf("%d",&n);
int arr[n][2];
for (i=0;i<n;i++)
{
scanf("%d %d",&hr,&min);
arr[i][0]=hr;
arr[i][1]=min;
}
for (i=0;i<n;i++)
{
if (arr[i-1][0]==arr[i][0] && arr[i-1][1]==arr[i][1])
{
count=1;
}
else
{ fo... | |
Valera runs a 24/7 fast food cafe. He magically learned that next day n people will visit his cafe. For each person we know the arrival time: the i-th person comes exactly at hi hours mi minutes. The cafe spends less than a minute to serve each client, but if a client comes in and sees that there is no free cash, than ... | Print a single integer β the minimum number of cashes, needed to serve all clients next day. | C | cfad2cb472e662e037f3415a84daca57 | 6551d6bed82ec0e63f7da112b4eebe3f | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1351179000 | ["4\n8 0\n8 10\n8 10\n8 45", "3\n0 12\n10 11\n22 22"] | NoteIn the first sample it is not enough one cash to serve all clients, because two visitors will come into cafe in 8:10. Therefore, if there will be one cash in cafe, then one customer will be served by it, and another one will not wait and will go away.In the second sample all visitors will come in different times, s... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer n (1ββ€βnββ€β105), that is the number of cafe visitors. Each of the following n lines has two space-separated integers hi and mi (0ββ€βhiββ€β23;Β 0ββ€βmiββ€β59), representing the time when the i-th person comes into the cafe. Note that the time is given in the chronological order. All... | ["2", "1"] |
#include<stdio.h>
#include<string.h>
int main ()
{ int n,i,count=1,maxcnt =1;
int m[100000],h[100000];
scanf("%d",&n);
for ( i=0;i<n;++i)
{
scanf("%d %d",&m[i],&h[i]);
}
for ( i=0;i<n-1;i++)
{ if ( h[i]==h[i+1]&& m[i]==m[i+1])
{
count ++;}
else
{ count =1;}
if (count > ma... | |
Valera runs a 24/7 fast food cafe. He magically learned that next day n people will visit his cafe. For each person we know the arrival time: the i-th person comes exactly at hi hours mi minutes. The cafe spends less than a minute to serve each client, but if a client comes in and sees that there is no free cash, than ... | Print a single integer β the minimum number of cashes, needed to serve all clients next day. | C | cfad2cb472e662e037f3415a84daca57 | 5c92a1a2e21019049156789c3174fe7c | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1351179000 | ["4\n8 0\n8 10\n8 10\n8 45", "3\n0 12\n10 11\n22 22"] | NoteIn the first sample it is not enough one cash to serve all clients, because two visitors will come into cafe in 8:10. Therefore, if there will be one cash in cafe, then one customer will be served by it, and another one will not wait and will go away.In the second sample all visitors will come in different times, s... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer n (1ββ€βnββ€β105), that is the number of cafe visitors. Each of the following n lines has two space-separated integers hi and mi (0ββ€βhiββ€β23;Β 0ββ€βmiββ€β59), representing the time when the i-th person comes into the cafe. Note that the time is given in the chronological order. All... | ["2", "1"] | #include <stdio.h>
int main(void) {
// your code goes here
int n,i,j,k=0,max;
scanf("%d",&n);
int a[n][2],s[n];
for(i=0;i<n;i++)
s[i]=0;
for(i=0;i<n;i++)
scanf("%d %d",&a[i][0],&a[i][1]);
for(i=0;i<n-1;i++)
{
for(j=i+1;j<n;j++)
{
if(a[i][0]!=-1){... | |
Valera runs a 24/7 fast food cafe. He magically learned that next day n people will visit his cafe. For each person we know the arrival time: the i-th person comes exactly at hi hours mi minutes. The cafe spends less than a minute to serve each client, but if a client comes in and sees that there is no free cash, than ... | Print a single integer β the minimum number of cashes, needed to serve all clients next day. | C | cfad2cb472e662e037f3415a84daca57 | 04968b9c4e5edbb93862b57517de3d78 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1351179000 | ["4\n8 0\n8 10\n8 10\n8 45", "3\n0 12\n10 11\n22 22"] | NoteIn the first sample it is not enough one cash to serve all clients, because two visitors will come into cafe in 8:10. Therefore, if there will be one cash in cafe, then one customer will be served by it, and another one will not wait and will go away.In the second sample all visitors will come in different times, s... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer n (1ββ€βnββ€β105), that is the number of cafe visitors. Each of the following n lines has two space-separated integers hi and mi (0ββ€βhiββ€β23;Β 0ββ€βmiββ€β59), representing the time when the i-th person comes into the cafe. Note that the time is given in the chronological order. All... | ["2", "1"] | #include<stdio.h>
int main()
{
int count = 1;
int n;
scanf("%d", &n);
int h1 = -1;
int m1 = -1;
int h2, m2;
int i;
int max =0;
for(i=0; i<n; i++)
{
scanf("%d%d", &h2, &m2);
if(h1 == h2 && m1 == m2)
count++;
else
count = 1;
if(max<count)
{
max = count;
}
h1 = h2;
m1 = m2;
}
printf... | |
Valera runs a 24/7 fast food cafe. He magically learned that next day n people will visit his cafe. For each person we know the arrival time: the i-th person comes exactly at hi hours mi minutes. The cafe spends less than a minute to serve each client, but if a client comes in and sees that there is no free cash, than ... | Print a single integer β the minimum number of cashes, needed to serve all clients next day. | C | cfad2cb472e662e037f3415a84daca57 | 9e168d02c885f06bf2338171f0f4fdc9 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1351179000 | ["4\n8 0\n8 10\n8 10\n8 45", "3\n0 12\n10 11\n22 22"] | NoteIn the first sample it is not enough one cash to serve all clients, because two visitors will come into cafe in 8:10. Therefore, if there will be one cash in cafe, then one customer will be served by it, and another one will not wait and will go away.In the second sample all visitors will come in different times, s... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer n (1ββ€βnββ€β105), that is the number of cafe visitors. Each of the following n lines has two space-separated integers hi and mi (0ββ€βhiββ€β23;Β 0ββ€βmiββ€β59), representing the time when the i-th person comes into the cafe. Note that the time is given in the chronological order. All... | ["2", "1"] | #include<stdio.h>
struct a
{
int x,y;
};
int main(void)
{
int n,count = 1,i,max = 1;
struct a p[150000];
scanf("%d",&n);
for(i = 0 ; i < n ; i ++)
scanf("%d%d",&p[i].x,&p[i].y);
p[i].x = p[i-1].x + 1;
for(i = 0 ; i < n ; i ++)
{
if(p[i].x==p[i+1].x && p[i].y == p[i+1].y)... | |
Valera runs a 24/7 fast food cafe. He magically learned that next day n people will visit his cafe. For each person we know the arrival time: the i-th person comes exactly at hi hours mi minutes. The cafe spends less than a minute to serve each client, but if a client comes in and sees that there is no free cash, than ... | Print a single integer β the minimum number of cashes, needed to serve all clients next day. | C | cfad2cb472e662e037f3415a84daca57 | f1cf80b9208adf47f77a26d30f66e713 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1351179000 | ["4\n8 0\n8 10\n8 10\n8 45", "3\n0 12\n10 11\n22 22"] | NoteIn the first sample it is not enough one cash to serve all clients, because two visitors will come into cafe in 8:10. Therefore, if there will be one cash in cafe, then one customer will be served by it, and another one will not wait and will go away.In the second sample all visitors will come in different times, s... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer n (1ββ€βnββ€β105), that is the number of cafe visitors. Each of the following n lines has two space-separated integers hi and mi (0ββ€βhiββ€β23;Β 0ββ€βmiββ€β59), representing the time when the i-th person comes into the cafe. Note that the time is given in the chronological order. All... | ["2", "1"] | #include <stdio.h>
int main()
{
int n,i,j,k=1,a,b,m,p,f=1;
scanf("%d",&n);
scanf("%d %d\n",&m,&p);
for(i=1;i<n;i++){
scanf("%d %d",&a,&b);
if(a==m && b==p){
f++;
}
else{
m=a;
p=b;
if(f>k){
k=f;
... | |
Valera runs a 24/7 fast food cafe. He magically learned that next day n people will visit his cafe. For each person we know the arrival time: the i-th person comes exactly at hi hours mi minutes. The cafe spends less than a minute to serve each client, but if a client comes in and sees that there is no free cash, than ... | Print a single integer β the minimum number of cashes, needed to serve all clients next day. | C | cfad2cb472e662e037f3415a84daca57 | 631645df2f86c492558db64045395072 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1351179000 | ["4\n8 0\n8 10\n8 10\n8 45", "3\n0 12\n10 11\n22 22"] | NoteIn the first sample it is not enough one cash to serve all clients, because two visitors will come into cafe in 8:10. Therefore, if there will be one cash in cafe, then one customer will be served by it, and another one will not wait and will go away.In the second sample all visitors will come in different times, s... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer n (1ββ€βnββ€β105), that is the number of cafe visitors. Each of the following n lines has two space-separated integers hi and mi (0ββ€βhiββ€β23;Β 0ββ€βmiββ€β59), representing the time when the i-th person comes into the cafe. Note that the time is given in the chronological order. All... | ["2", "1"] | #include<stdio.h>
int main()
{
int n,i=1,x,y,count=1,h,m,count1=0,p;
scanf("%d",&n);
while(i<=n) {
scanf("%d%d",&h,&m);
if(h==x&&m==y) {
count++;
}
else {
if(count>count1) {
p=count-count1;
count1=count1+p;
}... | |
Valera runs a 24/7 fast food cafe. He magically learned that next day n people will visit his cafe. For each person we know the arrival time: the i-th person comes exactly at hi hours mi minutes. The cafe spends less than a minute to serve each client, but if a client comes in and sees that there is no free cash, than ... | Print a single integer β the minimum number of cashes, needed to serve all clients next day. | C | cfad2cb472e662e037f3415a84daca57 | 63d14376bbf702c8de8e4056d6cb5782 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1351179000 | ["4\n8 0\n8 10\n8 10\n8 45", "3\n0 12\n10 11\n22 22"] | NoteIn the first sample it is not enough one cash to serve all clients, because two visitors will come into cafe in 8:10. Therefore, if there will be one cash in cafe, then one customer will be served by it, and another one will not wait and will go away.In the second sample all visitors will come in different times, s... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer n (1ββ€βnββ€β105), that is the number of cafe visitors. Each of the following n lines has two space-separated integers hi and mi (0ββ€βhiββ€β23;Β 0ββ€βmiββ€β59), representing the time when the i-th person comes into the cafe. Note that the time is given in the chronological order. All... | ["2", "1"] | #include<stdio.h>
int main()
{
long long int n,i,c=1,max=0;
scanf("%I64d",&n);
long long int h[n],m[n];
for(i=0; i<n; i++)
{
scanf("%I64d %I64d",&h[i],&m[i]);
if(h[i]==h[i-1]&&m[i]==m[i-1])
{
c++;
}
else
{
if(c>max)
... | |
Valera runs a 24/7 fast food cafe. He magically learned that next day n people will visit his cafe. For each person we know the arrival time: the i-th person comes exactly at hi hours mi minutes. The cafe spends less than a minute to serve each client, but if a client comes in and sees that there is no free cash, than ... | Print a single integer β the minimum number of cashes, needed to serve all clients next day. | C | cfad2cb472e662e037f3415a84daca57 | 8ecfaf334571d8373ea35ab7b83d8086 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1351179000 | ["4\n8 0\n8 10\n8 10\n8 45", "3\n0 12\n10 11\n22 22"] | NoteIn the first sample it is not enough one cash to serve all clients, because two visitors will come into cafe in 8:10. Therefore, if there will be one cash in cafe, then one customer will be served by it, and another one will not wait and will go away.In the second sample all visitors will come in different times, s... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer n (1ββ€βnββ€β105), that is the number of cafe visitors. Each of the following n lines has two space-separated integers hi and mi (0ββ€βhiββ€β23;Β 0ββ€βmiββ€β59), representing the time when the i-th person comes into the cafe. Note that the time is given in the chronological order. All... | ["2", "1"] | #include<stdio.h>
int main()
{
static int a[100][100];
int i,n,b,c,max=0;
scanf("%d",&n);
for (i=0;i<n;i++)
{
scanf("%d %d",&b,&c);
a[b][c]++;
if (a[b][c]>max)
max=a[b][c];
}
printf("%d ",max);
}
| |
Valera runs a 24/7 fast food cafe. He magically learned that next day n people will visit his cafe. For each person we know the arrival time: the i-th person comes exactly at hi hours mi minutes. The cafe spends less than a minute to serve each client, but if a client comes in and sees that there is no free cash, than ... | Print a single integer β the minimum number of cashes, needed to serve all clients next day. | C | cfad2cb472e662e037f3415a84daca57 | ede8181d1c08ad3d8260f88dd62ed084 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1351179000 | ["4\n8 0\n8 10\n8 10\n8 45", "3\n0 12\n10 11\n22 22"] | NoteIn the first sample it is not enough one cash to serve all clients, because two visitors will come into cafe in 8:10. Therefore, if there will be one cash in cafe, then one customer will be served by it, and another one will not wait and will go away.In the second sample all visitors will come in different times, s... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer n (1ββ€βnββ€β105), that is the number of cafe visitors. Each of the following n lines has two space-separated integers hi and mi (0ββ€βhiββ€β23;Β 0ββ€βmiββ€β59), representing the time when the i-th person comes into the cafe. Note that the time is given in the chronological order. All... | ["2", "1"] | #include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
int myarray[n][2];
int i,j,cnt=1,max=0;
for(i=0; i<n; i++)
{
for(j=0; j<2; j++)
{
scanf("%d",&myarray[i][j]);
}
}
for(i=0; i<n; i++)
{
if(myarray[i][0]==myarray[i+1][0]&&myarray[i][1]==... | |
Valera runs a 24/7 fast food cafe. He magically learned that next day n people will visit his cafe. For each person we know the arrival time: the i-th person comes exactly at hi hours mi minutes. The cafe spends less than a minute to serve each client, but if a client comes in and sees that there is no free cash, than ... | Print a single integer β the minimum number of cashes, needed to serve all clients next day. | C | cfad2cb472e662e037f3415a84daca57 | 4633d29593910d4d29523130add42878 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1351179000 | ["4\n8 0\n8 10\n8 10\n8 45", "3\n0 12\n10 11\n22 22"] | NoteIn the first sample it is not enough one cash to serve all clients, because two visitors will come into cafe in 8:10. Therefore, if there will be one cash in cafe, then one customer will be served by it, and another one will not wait and will go away.In the second sample all visitors will come in different times, s... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer n (1ββ€βnββ€β105), that is the number of cafe visitors. Each of the following n lines has two space-separated integers hi and mi (0ββ€βhiββ€β23;Β 0ββ€βmiββ€β59), representing the time when the i-th person comes into the cafe. Note that the time is given in the chronological order. All... | ["2", "1"] | #include<stdio.h>
int main()
{
long long int n,h[100000],m[100000],i,j,count=1,max=1;
scanf("%I64d",&n);
for(i=0;i<n;i++)
{
scanf("%I64d %I64d",&h[i],&m[i]);
}
for(i=0;i<n;i++)
{
if(i>0)
{
if(h[i]==h[i-1] && m[i]==m[i-1])
{
cou... | |
Valera runs a 24/7 fast food cafe. He magically learned that next day n people will visit his cafe. For each person we know the arrival time: the i-th person comes exactly at hi hours mi minutes. The cafe spends less than a minute to serve each client, but if a client comes in and sees that there is no free cash, than ... | Print a single integer β the minimum number of cashes, needed to serve all clients next day. | C | cfad2cb472e662e037f3415a84daca57 | 6ee5695d3694936916e3e2db08e866fa | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1351179000 | ["4\n8 0\n8 10\n8 10\n8 45", "3\n0 12\n10 11\n22 22"] | NoteIn the first sample it is not enough one cash to serve all clients, because two visitors will come into cafe in 8:10. Therefore, if there will be one cash in cafe, then one customer will be served by it, and another one will not wait and will go away.In the second sample all visitors will come in different times, s... | PASSED | 1,000 | standard input | 2 seconds | The first line contains a single integer n (1ββ€βnββ€β105), that is the number of cafe visitors. Each of the following n lines has two space-separated integers hi and mi (0ββ€βhiββ€β23;Β 0ββ€βmiββ€β59), representing the time when the i-th person comes into the cafe. Note that the time is given in the chronological order. All... | ["2", "1"] | #include<stdio.h>
int main()
{
int a,b,i,j,e,c1=0,c=1,max=1,ara1[100009],ara2[100009];
scanf("%d",&a);
for(i=0; i<a; i++)
{
scanf("%d %d",&ara1[i],&ara2[i]);
}
for(i=0; i<a-1; i++)
{
if(ara1[i]==ara1[i+1]&&ara2[i]==ara2[i+1])
{
c++;
... | |
Quite recently, a very smart student named Jury decided that lectures are boring, so he downloaded a game called "Black Square" on his super cool touchscreen phone.In this game, the phone's screen is divided into four vertical strips. Each second, a black square appears on some of the strips. According to the rules of ... | Print a single integer β the total number of calories that Jury wastes. | C | db9065d975878227a749083f0036a169 | ed5b01f81579fa2f09aeb821e9d8b709 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1400686200 | ["1 2 3 4\n123214", "1 5 3 2\n11221"] | null | PASSED | 800 | standard input | 1 second | The first line contains four space-separated integers a1, a2, a3, a4 (0ββ€βa1,βa2,βa3,βa4ββ€β104). The second line contains string s (1ββ€β|s|ββ€β105), where the Ρ-th character of the string equals "1", if on the i-th second of the game the square appears on the first strip, "2", if it appears on the second strip, "3", if ... | ["13", "13"] | //
// Created by botayhard on 08.02.19.
//
#include<stdio.h>
#include<string.h>
int main() {
unsigned long long int a[5], res = 0;
char s[1000001];
scanf("%lld %lld %lld %lld", &a[1], &a[2], &a[3], &a[4]);
scanf("%s", s);
for (int i = strlen(s); i > -1; i--){
if (s[i] == '1') {res+=a[1];}
... | |
Quite recently, a very smart student named Jury decided that lectures are boring, so he downloaded a game called "Black Square" on his super cool touchscreen phone.In this game, the phone's screen is divided into four vertical strips. Each second, a black square appears on some of the strips. According to the rules of ... | Print a single integer β the total number of calories that Jury wastes. | C | db9065d975878227a749083f0036a169 | 0241e60a03ad6148e0e8702505e98f49 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1400686200 | ["1 2 3 4\n123214", "1 5 3 2\n11221"] | null | PASSED | 800 | standard input | 1 second | The first line contains four space-separated integers a1, a2, a3, a4 (0ββ€βa1,βa2,βa3,βa4ββ€β104). The second line contains string s (1ββ€β|s|ββ€β105), where the Ρ-th character of the string equals "1", if on the i-th second of the game the square appears on the first strip, "2", if it appears on the second strip, "3", if ... | ["13", "13"] | #include<stdio.h>
#include<string.h>
int main()
{
int ch[1000];
char arr[100000];
int cp[4]= { 0,0,0,0 };
long long int a,b,c,d,e,i=0,tep=0,temp=0,j=0,k=0,l=0,m=0,n=0;
for(j=1; j<=4; j++)
scanf("%d",&ch[j]);
scanf("%s",arr);
b=strlen(arr);
k=0;
i=0;
for(i=0;i<b;i++)
... | |
Quite recently, a very smart student named Jury decided that lectures are boring, so he downloaded a game called "Black Square" on his super cool touchscreen phone.In this game, the phone's screen is divided into four vertical strips. Each second, a black square appears on some of the strips. According to the rules of ... | Print a single integer β the total number of calories that Jury wastes. | C | db9065d975878227a749083f0036a169 | 672bc892b7e5a4b8ae7c3dcb243836a5 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1400686200 | ["1 2 3 4\n123214", "1 5 3 2\n11221"] | null | PASSED | 800 | standard input | 1 second | The first line contains four space-separated integers a1, a2, a3, a4 (0ββ€βa1,βa2,βa3,βa4ββ€β104). The second line contains string s (1ββ€β|s|ββ€β105), where the Ρ-th character of the string equals "1", if on the i-th second of the game the square appears on the first strip, "2", if it appears on the second strip, "3", if ... | ["13", "13"] | #include<stdio.h>
#include<string.h>
int main ()
{
int s,i;
int t[10000];
char c[100000];
s=0;
for (i=0;i<=3;i++)
{
scanf("%d",&t[i]);
}
scanf("%s",&c);
for (i=0;i<strlen(c);i++)
{
switch (c[i]){
case '1': s=s+t[0];
break;
case '2': s=s+t[1];
break;
case '3': s=s+t[2];
break;
case '4': s=s+t[3];
break;
... | |
Quite recently, a very smart student named Jury decided that lectures are boring, so he downloaded a game called "Black Square" on his super cool touchscreen phone.In this game, the phone's screen is divided into four vertical strips. Each second, a black square appears on some of the strips. According to the rules of ... | Print a single integer β the total number of calories that Jury wastes. | C | db9065d975878227a749083f0036a169 | 145b96550b8ca48c3dc566f4ff225554 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1400686200 | ["1 2 3 4\n123214", "1 5 3 2\n11221"] | null | PASSED | 800 | standard input | 1 second | The first line contains four space-separated integers a1, a2, a3, a4 (0ββ€βa1,βa2,βa3,βa4ββ€β104). The second line contains string s (1ββ€β|s|ββ€β105), where the Ρ-th character of the string equals "1", if on the i-th second of the game the square appears on the first strip, "2", if it appears on the second strip, "3", if ... | ["13", "13"] | #include<stdio.h>
#include<string.h>
int main()
{
int a[4],cal=0;
for(int i=0;i<4;i++)
scanf("%d",&a[i]);
char s[100000];
scanf("%s",s);
for(int i=0;i<strlen(s);i++)
{
if(s[i]=='1')
cal+=a[0];
if(s[i]=='2')
cal+=a[1];
if(s[i]=='3')
cal+=a[2... | |
Quite recently, a very smart student named Jury decided that lectures are boring, so he downloaded a game called "Black Square" on his super cool touchscreen phone.In this game, the phone's screen is divided into four vertical strips. Each second, a black square appears on some of the strips. According to the rules of ... | Print a single integer β the total number of calories that Jury wastes. | C | db9065d975878227a749083f0036a169 | b8cd2486912926bd77020cd499cfe2ab | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1400686200 | ["1 2 3 4\n123214", "1 5 3 2\n11221"] | null | PASSED | 800 | standard input | 1 second | The first line contains four space-separated integers a1, a2, a3, a4 (0ββ€βa1,βa2,βa3,βa4ββ€β104). The second line contains string s (1ββ€β|s|ββ€β105), where the Ρ-th character of the string equals "1", if on the i-th second of the game the square appears on the first strip, "2", if it appears on the second strip, "3", if ... | ["13", "13"] | #include<stdio.h>
#include<string.h>
int main()
{
int a[10],l,i,c=0;
char str[1000000];
for(i=0;i<4;i++)
{
scanf("%d",&a[i]);
}
scanf("%s",str);
l=strlen(str);
for(i=0;i<l;i++)
{
if(str[i]=='1')
{
c+=a[0];
}
else if(str[i]=='2')
... | |
Quite recently, a very smart student named Jury decided that lectures are boring, so he downloaded a game called "Black Square" on his super cool touchscreen phone.In this game, the phone's screen is divided into four vertical strips. Each second, a black square appears on some of the strips. According to the rules of ... | Print a single integer β the total number of calories that Jury wastes. | C | db9065d975878227a749083f0036a169 | a24570600443b881fb36094650a94114 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1400686200 | ["1 2 3 4\n123214", "1 5 3 2\n11221"] | null | PASSED | 800 | standard input | 1 second | The first line contains four space-separated integers a1, a2, a3, a4 (0ββ€βa1,βa2,βa3,βa4ββ€β104). The second line contains string s (1ββ€β|s|ββ€β105), where the Ρ-th character of the string equals "1", if on the i-th second of the game the square appears on the first strip, "2", if it appears on the second strip, "3", if ... | ["13", "13"] | #include<stdio.h>
int main()
{
int a[4],i,temp,s=0;
char c[100000];
for(i=0;i<4;i++)
scanf("%d",&a[i]);
scanf("%s",c);
for(i=0;c[i]!='\0';i++)
{
if(c[i]-48==1)
{
temp=c[i]-48;
s=s+a[temp-1];
... | |
Quite recently, a very smart student named Jury decided that lectures are boring, so he downloaded a game called "Black Square" on his super cool touchscreen phone.In this game, the phone's screen is divided into four vertical strips. Each second, a black square appears on some of the strips. According to the rules of ... | Print a single integer β the total number of calories that Jury wastes. | C | db9065d975878227a749083f0036a169 | c3c669ba61c2ff0e16427ff1f9d970f9 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1400686200 | ["1 2 3 4\n123214", "1 5 3 2\n11221"] | null | PASSED | 800 | standard input | 1 second | The first line contains four space-separated integers a1, a2, a3, a4 (0ββ€βa1,βa2,βa3,βa4ββ€β104). The second line contains string s (1ββ€β|s|ββ€β105), where the Ρ-th character of the string equals "1", if on the i-th second of the game the square appears on the first strip, "2", if it appears on the second strip, "3", if ... | ["13", "13"] | /*
* @Author: Kabid
* @Date: 2020-04-16 00:45:39
*/
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#define in(x) scanf("%d", &x);
#define ins(x) scanf("%s", &x);
#define out(x) printf("%d", x);
#define _ putchar(' ');
#define lin puts("");
int t,i,j,k,l,x=0;
int c=0... | |
Quite recently, a very smart student named Jury decided that lectures are boring, so he downloaded a game called "Black Square" on his super cool touchscreen phone.In this game, the phone's screen is divided into four vertical strips. Each second, a black square appears on some of the strips. According to the rules of ... | Print a single integer β the total number of calories that Jury wastes. | C | db9065d975878227a749083f0036a169 | 0c72378e823e20a78440ebfb6e59fd0f | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1400686200 | ["1 2 3 4\n123214", "1 5 3 2\n11221"] | null | PASSED | 800 | standard input | 1 second | The first line contains four space-separated integers a1, a2, a3, a4 (0ββ€βa1,βa2,βa3,βa4ββ€β104). The second line contains string s (1ββ€β|s|ββ€β105), where the Ρ-th character of the string equals "1", if on the i-th second of the game the square appears on the first strip, "2", if it appears on the second strip, "3", if ... | ["13", "13"] | #include<stdio.h>
#include<string.h>
int main(){
int n,i,j,sum=0,A[4];
char str[100000];
scanf("%d %d %d %d",&A[0],&A[1],&A[2],&A[3]);
scanf("%s",str);
//printf("%d %d %d %d",A[0],A[1],A[2],A[3]);
for(i=0;i<=strlen(str)-1;i++){
if(str[i]=='1')
sum=sum+A[0];
else if(str[i]=='2')
sum=sum+A[1];
... | |
Quite recently, a very smart student named Jury decided that lectures are boring, so he downloaded a game called "Black Square" on his super cool touchscreen phone.In this game, the phone's screen is divided into four vertical strips. Each second, a black square appears on some of the strips. According to the rules of ... | Print a single integer β the total number of calories that Jury wastes. | C | db9065d975878227a749083f0036a169 | 9fb768b93c6fd51c25ed20182d45d600 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1400686200 | ["1 2 3 4\n123214", "1 5 3 2\n11221"] | null | PASSED | 800 | standard input | 1 second | The first line contains four space-separated integers a1, a2, a3, a4 (0ββ€βa1,βa2,βa3,βa4ββ€β104). The second line contains string s (1ββ€β|s|ββ€β105), where the Ρ-th character of the string equals "1", if on the i-th second of the game the square appears on the first strip, "2", if it appears on the second strip, "3", if ... | ["13", "13"] | #include<stdio.h>
#include<string.h>
int main()
{
long int a[4],sum=0;
char s[100000];
for(int i=0; i<4; i++)
scanf("%ld",&a[i]);
scanf("%s",s);
for(int k=0;k<strlen(s);k++)
{
sum=sum+a[s[k]-'1'];
}
printf("%ld",sum);
return 0;
}
| |
Quite recently, a very smart student named Jury decided that lectures are boring, so he downloaded a game called "Black Square" on his super cool touchscreen phone.In this game, the phone's screen is divided into four vertical strips. Each second, a black square appears on some of the strips. According to the rules of ... | Print a single integer β the total number of calories that Jury wastes. | C | db9065d975878227a749083f0036a169 | f51a91d36b851e9acd1dae2e7c565a73 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1400686200 | ["1 2 3 4\n123214", "1 5 3 2\n11221"] | null | PASSED | 800 | standard input | 1 second | The first line contains four space-separated integers a1, a2, a3, a4 (0ββ€βa1,βa2,βa3,βa4ββ€β104). The second line contains string s (1ββ€β|s|ββ€β105), where the Ρ-th character of the string equals "1", if on the i-th second of the game the square appears on the first strip, "2", if it appears on the second strip, "3", if ... | ["13", "13"] | #include <stdio.h>
#include <stdlib.h>
#include<string.h>
int main()
{ int a,q,w,s,l,j=0;
scanf("%d %d %d %d",&a,&q,&w,&s);
char b[100001];
scanf("%s",&b);
l=strlen(b);
for(int i=0;i<l;i++){
if(b[i]=='1'){
j+=a;
}
else if(b[i]=='2'){
j+=q;
}
else if(b[i]=='3'){
j+=... | |
Quite recently, a very smart student named Jury decided that lectures are boring, so he downloaded a game called "Black Square" on his super cool touchscreen phone.In this game, the phone's screen is divided into four vertical strips. Each second, a black square appears on some of the strips. According to the rules of ... | Print a single integer β the total number of calories that Jury wastes. | C | db9065d975878227a749083f0036a169 | daf731c928f1a5f8cab2c0c00c13123f | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1400686200 | ["1 2 3 4\n123214", "1 5 3 2\n11221"] | null | PASSED | 800 | standard input | 1 second | The first line contains four space-separated integers a1, a2, a3, a4 (0ββ€βa1,βa2,βa3,βa4ββ€β104). The second line contains string s (1ββ€β|s|ββ€β105), where the Ρ-th character of the string equals "1", if on the i-th second of the game the square appears on the first strip, "2", if it appears on the second strip, "3", if ... | ["13", "13"] | #include<stdio.h>
int main()
{
int a,b,c,d,cal=0,i;
char str[100100];
scanf("%d %d %d %d\n",&a,&b,&c,&d);
if(a==0 && b==0 && c==0 && d==0)
{
printf("%d",cal);
return 0;
}
gets(str);
for(i=0;str[i]!='\0';i++)
{
if(str[i]=='1')
{
cal=c... | |
Quite recently, a very smart student named Jury decided that lectures are boring, so he downloaded a game called "Black Square" on his super cool touchscreen phone.In this game, the phone's screen is divided into four vertical strips. Each second, a black square appears on some of the strips. According to the rules of ... | Print a single integer β the total number of calories that Jury wastes. | C | db9065d975878227a749083f0036a169 | b667be6cf9464834e794bae336f59ab4 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1400686200 | ["1 2 3 4\n123214", "1 5 3 2\n11221"] | null | PASSED | 800 | standard input | 1 second | The first line contains four space-separated integers a1, a2, a3, a4 (0ββ€βa1,βa2,βa3,βa4ββ€β104). The second line contains string s (1ββ€β|s|ββ€β105), where the Ρ-th character of the string equals "1", if on the i-th second of the game the square appears on the first strip, "2", if it appears on the second strip, "3", if ... | ["13", "13"] | #include<string.h>
#include<stdio.h>
int main(){
int a[4],n,cal=0;
char str[100000];
for(int j=0;j<4;j++){
scanf("%d",&a[j]);
}
scanf("%s",str);
n=strlen(str);
for(int i=0;i<n;i++){
if(str[i]=='1')
cal=cal+a[0];
if(str[i]=='2')
cal=cal+a[... | |
Quite recently, a very smart student named Jury decided that lectures are boring, so he downloaded a game called "Black Square" on his super cool touchscreen phone.In this game, the phone's screen is divided into four vertical strips. Each second, a black square appears on some of the strips. According to the rules of ... | Print a single integer β the total number of calories that Jury wastes. | C | db9065d975878227a749083f0036a169 | f457a1da8ab7ea7453f5f3c4c432738a | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1400686200 | ["1 2 3 4\n123214", "1 5 3 2\n11221"] | null | PASSED | 800 | standard input | 1 second | The first line contains four space-separated integers a1, a2, a3, a4 (0ββ€βa1,βa2,βa3,βa4ββ€β104). The second line contains string s (1ββ€β|s|ββ€β105), where the Ρ-th character of the string equals "1", if on the i-th second of the game the square appears on the first strip, "2", if it appears on the second strip, "3", if ... | ["13", "13"] | #include <stdio.h>
int main()
{
int a1, a2, a3, a4;
scanf("%d%d%d%d", &a1, &a2, &a3, &a4);
int cal = 0;
char s[100001];
scanf("%s", s);
int i=0;
while(s[i]!= 0)
{
if(s[i] == '1') cal+=a1;
if(s[i] == '2') cal+=a2;
if(s[i] == '3') cal+=a3;
if(s[i] == '4') ... | |
Quite recently, a very smart student named Jury decided that lectures are boring, so he downloaded a game called "Black Square" on his super cool touchscreen phone.In this game, the phone's screen is divided into four vertical strips. Each second, a black square appears on some of the strips. According to the rules of ... | Print a single integer β the total number of calories that Jury wastes. | C | db9065d975878227a749083f0036a169 | 8038ebd4c75ce22a23bcd704c21e1b8e | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1400686200 | ["1 2 3 4\n123214", "1 5 3 2\n11221"] | null | PASSED | 800 | standard input | 1 second | The first line contains four space-separated integers a1, a2, a3, a4 (0ββ€βa1,βa2,βa3,βa4ββ€β104). The second line contains string s (1ββ€β|s|ββ€β105), where the Ρ-th character of the string equals "1", if on the i-th second of the game the square appears on the first strip, "2", if it appears on the second strip, "3", if ... | ["13", "13"] | #include<stdio.h>
#include<string.h>
int main ()
{
int h,c=0,d=0,a=0,b=0,i,A,B,C,D,t;
char s[100000];
scanf("%d",&A);
scanf("%d",&B);
scanf("%d",&C);
scanf("%d",&D);
scanf("%s",s);
h=strlen(s);
for(i=0;i<h;i++){
if(s[i]=='1'){
a++;}
else if(s[i]=='2'){
b++;
}
else if(s[i]=='3'){
c++;
}
e... | |
Quite recently, a very smart student named Jury decided that lectures are boring, so he downloaded a game called "Black Square" on his super cool touchscreen phone.In this game, the phone's screen is divided into four vertical strips. Each second, a black square appears on some of the strips. According to the rules of ... | Print a single integer β the total number of calories that Jury wastes. | C | db9065d975878227a749083f0036a169 | 54692e5a68366eb237131df15bfd40ce | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1400686200 | ["1 2 3 4\n123214", "1 5 3 2\n11221"] | null | PASSED | 800 | standard input | 1 second | The first line contains four space-separated integers a1, a2, a3, a4 (0ββ€βa1,βa2,βa3,βa4ββ€β104). The second line contains string s (1ββ€β|s|ββ€β105), where the Ρ-th character of the string equals "1", if on the i-th second of the game the square appears on the first strip, "2", if it appears on the second strip, "3", if ... | ["13", "13"] | #include <stdio.h>
#include <string.h>
int main() {
static char s[100001];
static int aa[4];
int n, i, sum;
for (i = 0; i < 4; i++)
scanf("%d", &aa[i]);
scanf("%s", s);
n = strlen(s);
sum = 0;
for (i = 0; i < n; i++)
if (s[i] == '1')
sum += aa[0];
else if (s[i] == '2')
sum += aa[1];
else if (s[i... | |
Quite recently, a very smart student named Jury decided that lectures are boring, so he downloaded a game called "Black Square" on his super cool touchscreen phone.In this game, the phone's screen is divided into four vertical strips. Each second, a black square appears on some of the strips. According to the rules of ... | Print a single integer β the total number of calories that Jury wastes. | C | db9065d975878227a749083f0036a169 | 8ef1a3e714f1d990ac837caee81b224b | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1400686200 | ["1 2 3 4\n123214", "1 5 3 2\n11221"] | null | PASSED | 800 | standard input | 1 second | The first line contains four space-separated integers a1, a2, a3, a4 (0ββ€βa1,βa2,βa3,βa4ββ€β104). The second line contains string s (1ββ€β|s|ββ€β105), where the Ρ-th character of the string equals "1", if on the i-th second of the game the square appears on the first strip, "2", if it appears on the second strip, "3", if ... | ["13", "13"] | #include "stdio.h"
#include "string.h"
int main()
{ int i,n;
long long int sum;
char b[100000000]={};
sum=0;
long int a[4]={};
for(i=0;i<4;i++)
{
scanf("%ld",&a[i]);
}
getchar();
scanf("%s",&b[0]);
for(n=0;n<1000000;n++)
{ if(b[n]=='NU... | |
Quite recently, a very smart student named Jury decided that lectures are boring, so he downloaded a game called "Black Square" on his super cool touchscreen phone.In this game, the phone's screen is divided into four vertical strips. Each second, a black square appears on some of the strips. According to the rules of ... | Print a single integer β the total number of calories that Jury wastes. | C | db9065d975878227a749083f0036a169 | f21a0096f3e1818bf2035f7ff44bf8b0 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1400686200 | ["1 2 3 4\n123214", "1 5 3 2\n11221"] | null | PASSED | 800 | standard input | 1 second | The first line contains four space-separated integers a1, a2, a3, a4 (0ββ€βa1,βa2,βa3,βa4ββ€β104). The second line contains string s (1ββ€β|s|ββ€β105), where the Ρ-th character of the string equals "1", if on the i-th second of the game the square appears on the first strip, "2", if it appears on the second strip, "3", if ... | ["13", "13"] | #include<stdio.h>
int main()
{
int i,count=0;
char A[100001];
int B[4];
for(i=0;i<4;i++)
scanf("%d",&B[i]);
scanf("%s",A);
for(i=0;A[i]!='\0';i++)
count=count+B[(A[i]-'0')-1];
printf("%d",count);
return 0;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.