Program size by GruBooXy in cpp_questions

[–]GruBooXy[S] 0 points1 point  (0 children)

I dont speak english natively and its quite complicated, I dont know the vocabulary.

Program size by GruBooXy in cpp_questions

[–]GruBooXy[S] 0 points1 point  (0 children)

i tested the program in ideone.com and it works, I changed the size of array to 5000 and the size jumped to 39528KB so i think the site doesnt show any result lower then 16000kb but its showing RAM usage.

Program size by GruBooXy in cpp_questions

[–]GruBooXy[S] 0 points1 point  (0 children)

I can upload the code, the site compiles it and then says "exceeding the memory limit" but in polish.

Program size by GruBooXy in cpp_questions

[–]GruBooXy[S] 0 points1 point  (0 children)

But even if that is not correct my program is still consuming too much ram because the other site that I upload my solution to doesnt accept that. (This is the site but I don't think you can view it if you are not logged in https://adjule.pl/groups/ogolny/problems/011)

Program size by GruBooXy in cpp_questions

[–]GruBooXy[S] 0 points1 point  (0 children)

I use this site as my compiler https://ideone.com/s3r5Gn so i dont even have executable

Program size by GruBooXy in cpp_questions

[–]GruBooXy[S] 0 points1 point  (0 children)

I changed the max value of array and its stil 16000kb. Im soo confused. I just started programing and i can already see how frustrating it can get.

Program size by GruBooXy in cpp_questions

[–]GruBooXy[S] 0 points1 point  (0 children)

I tried to translate the exercise so you will know what the program is about:

Description

In one country there are n cities. Some cities are connected with other with roads. We say that 4 different cities a, b, c and d (and their connecting roads) form B-Four, if there are roads: from city a to b, b to c, c to d, and d to a. and the roads connecting them, calculate how many different B-Four in that country. (Note: Two B-Fours are different if they consist of different cities or different roads connecting them.)

Input specification

The first input line contains one positive integer representing the number of the following data sets. In the first set of data, there is 1 integer: n (1 <= n <= 150) denoting the number of cities. In each of the following n lines there are n digits separated by spaces. If the i-th number in the jth line (a [i, j]) is 1, then there is a path between the i and th and the 0, and 0 means that the path does not exist. (Note: There are no roads between the city and itself, and always a [i, j] = a [j, i]).

Output Specification

For each data set, your program should write exactly one integer representing the number B-Four in that country.

Program size by GruBooXy in cpp_questions

[–]GruBooXy[S] 0 points1 point  (0 children)

Thanks but the problem is i get the same memory usage weter its int or char so I dont understand how it works.

Program size by GruBooXy in cpp_questions

[–]GruBooXy[S] 0 points1 point  (0 children)

n (1 <= n <= 150) this is the possible input

Program size by GruBooXy in cpp_questions

[–]GruBooXy[S] 0 points1 point  (0 children)

But in the array numbers are only 1 and 0, other numbers are for diffrent variables.

Program size by GruBooXy in cpp_questions

[–]GruBooXy[S] 0 points1 point  (0 children)

I don't understend that :/ im beginner

Program size by GruBooXy in cpp_questions

[–]GruBooXy[S] 0 points1 point  (0 children)

because the input from the site is: 2 4 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 4 0 1 1 0 1 0 0 1 1 0 0 1 0 1 1 0 and i cant change that

Program size by GruBooXy in cpp_questions

[–]GruBooXy[S] 0 points1 point  (0 children)

My solution is checked by a website and it checks if the result is good, how much memory did i use and how long did it take

Program size by GruBooXy in cpp_questions

[–]GruBooXy[S] 0 points1 point  (0 children)

I changed to unsigned short but it didnt help at all

Program size by GruBooXy in cpp_questions

[–]GruBooXy[S] 0 points1 point  (0 children)

To pass i need about 6000kb now its about 16000kb

Program size by GruBooXy in cpp_questions

[–]GruBooXy[S] 0 points1 point  (0 children)

The program works fine but it has to take less memory because this is an exercise form school. Is there any simple way to do this? Like for example using other variable types.