dario-dsa's blog

By dario-dsa, history, 9 years ago, In English

Hi ,
I solved A1 like everybody else but now I have problems with A2 and A3. My main idea is not that special, try every number for P and generate all possible q and stop if you enter in the circle with map, so that idea is O(N^2) and that is not good. Can anyone help me and say some suggestion for that problem.
Task link

Full text and comments »

  • Vote: I like it
  • +5
  • Vote: I do not like it

By dario-dsa, history, 9 years ago, In English

Is there anything strange in that or i am missing something?
Link on the results
And that
More preciously on sheisactually14.

Full text and comments »

  • Vote: I like it
  • +5
  • Vote: I do not like it

By dario-dsa, 9 years ago, In English

Join us on Saturday, March 28th, 2015 for the eight round of COCI(Croatian Olympiad in informatics)!
Click here to see when the coding begins in your timezone!
Good luck to everyone.

Full text and comments »

  • Vote: I like it
  • +9
  • Vote: I do not like it

By dario-dsa, 9 years ago, In English

Can anyone try to explain me how to solve this interesting problem.
http://www.spoj.com/SPOJ/problems/WALK1/
Thanks

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By dario-dsa, 10 years ago, In English

Hi, can someone help me with this interesting math task from Spoj.
Task link

Full text and comments »

  • Vote: I like it
  • -3
  • Vote: I do not like it

By dario-dsa, 10 years ago, In English

Hi, I have problem with understanding the solution for really good problem Water on spoj from Poland. On each filed you have to put 10^5 liters of water and see how it go and use BFS. But I have problem with understanding the BFS call, which cell will go first and in which order. Can anyone help figure it out. Thanks.

Full text and comments »

  • Vote: I like it
  • -3
  • Vote: I do not like it

By dario-dsa, 10 years ago, In English

Hi, can anyone help with this task http://www.spoj.com/problems/METEORS/ . First i thought about binary search and segment tree with lazy propagation but that wouldn't work. Can anyone give me hole perspective to this problem? Thanks.

Full text and comments »

  • Vote: I like it
  • +5
  • Vote: I do not like it

By dario-dsa, 10 years ago, In English

I am trying to solve BRCKTS on spoj.com. Evaluator always give me wrong answer. So I am wondering can anyone give me some advice or some tricky test case to try me code. I will be happy on support. Thanks. http://pastebin.com/07Ey03wS

Details: I am using standard segment tree for lgN querys but I think I made some mistake in postavi function which change values of binary tree when I change bracket. In function ini I on the begining create a binary tree with all important informations to do queries. In function moguce I check is there possibility that that string is valid. Can some help me?

Full text and comments »

  • Vote: I like it
  • +3
  • Vote: I do not like it

By dario-dsa, 10 years ago, In English

hi, a Croatian Olympiad in Informatics will be held at time.

  1. Where do I register for the contest? Everyone with an account on evaluator.hsin.hr can compete. There is no additional registration for the contest.

  2. Who is eligible for participating in COCI? Everyone (but not teams).

  3. Should I use %lld or %I64d for long long input/output in C++? %lld.

  4. How fast is the CPU of the evaluator? model name : Intel(R) Xeon(R) CPU E5520 @ 2.27GHz 4 cores

  5. What are the input / output file names? You don’t read the input from files, you don’t print the results to files. Use standard input and standard output (stdin/stdout).

  6. My code received "Non-zero exit code (#).". What does that mean? It means your program crashed on our machine. You may want to use the test interface to see more details about the error.

  7. What compiler and flags are used to compile my source? We are using the following compilers and flags: Language Compiler Flags C gcc 4.7.2 -std=c99 -O2 -static -s -lm C++ g++ 4.7.2 -O2 -static -s -lm C++11 g++ 4.8.2 -std=c++0x -O2 -static -s -lm Pascal fpc 2.6.2 -O1 -XS Java javac 1.6.0_27 Python python 2.7.3

Full text and comments »

  • Vote: I like it
  • +24
  • Vote: I do not like it

By dario-dsa, 10 years ago, In English

Hi, I am having problem with solving this task from my math homework. If number p is prime and p^2+8 is also prime. Prove that p^3+4 is also prime number.

Full text and comments »

  • Vote: I like it
  • -4
  • Vote: I do not like it

By dario-dsa, 10 years ago, In English

HI, I am having problem with figure it a fast way to solve this problem so can anyone help me?
http://codeforces.com/contest/243/problem/A

Full text and comments »

  • Vote: I like it
  • -8
  • Vote: I do not like it

By dario-dsa, 10 years ago, In English

KQUERY
Can anyone help me to solve this problem? I have trouble to put it in BIT way on thinking.
Thanks

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By dario-dsa, 10 years ago, In English

I have a problem with this task. http://www.spoj.com/problems/LINEUP/ It looks pretty easy but my solution fail. Can anyone help to figure it out? Thanks very much for any help. :-)

#include <cstdio>
#include <string.h>
using namespace std;

int n;
int prob[21][21];

char vec_rijesio[1<<13];
int memo[1<<13];
int rijesi( int d, int s ) {
   if ( d == 11 )
     {
       return 0;
     }
   if ( vec_rijesio[s] ) return memo[s];
   vec_rijesio[s] = 1;
   int &ret = memo[s];
   ret = 0;

   for ( int i=0; i<11; ++i )
      if ( ( s & (1<<i) ) == 0 ) {
         int tmp = prob[d][i] + rijesi(d + 1, s|(1<<i));
         if ( tmp > ret ) ret = tmp;
      }

   return ret;
}

int main() {
   scanf( "%d", &n );
   for(int o=0;o<n;++o)
   {
   for ( int i=0; i<11; ++i )
      for ( int j=0; j<11; ++j ) {
         int x;
         scanf( "%d", &x );
         prob[i][j] = x;
      }

   int ret = rijesi( 0, 0 );
   printf( "%d\n", ret);
   memset (memo,0,sizeof(memo));
   memset (vec_rijesio,0,sizeof(vec_rijesio));
   }
   return 0;
}

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By dario-dsa, 10 years ago, In English

 Central European Olympiad in Informatics 2013 will be accompanied by an Internet online contest.

The tasks will be exactly the ones used during the real competition and will be graded using the same test data. Everybody is welcome and we are happy to invite you and all your friends/colleagues/students to participate!

1st Competition Day ... Tuesday, October 15, 14:00-19:00 GMT/UTC

2nd Competition Day ... Thursday, October 17, 14:00-19:00 GMT/UTC

There will be three tasks on each day of competition. The tasks will be algorithmic in nature and reasonably hard to solve. You may use Pascal, C or C++ as your programming language of choice.

The online Contest System is located at http://evaluator.hsin.hr, and each Competition Day will be available in the contests pick list 24 hours before the start of competition.

Full text and comments »

  • Vote: I like it
  • +28
  • Vote: I do not like it

By dario-dsa, 11 years ago, In English

Matrix is very powerful tool in programming and algorithm. So I want to ask someone to clarify me some tasks with that power of matrix and I heard some way of fast power of matrix and so I want that too to clarify for me. Thanks very much and I am grateful for anyone who would help me. C++

Full text and comments »

  • Vote: I like it
  • -16
  • Vote: I do not like it

By dario-dsa, 11 years ago, In English

Hi, can anyone help me with this task http://www.spoj.com/problems/INVCNT/ . First I try to think in BIT-way but I can't. Can anyone explain the solution of this task with BIT. BIT- Binary indexed tree

Full text and comments »

  • Vote: I like it
  • -3
  • Vote: I do not like it

By dario-dsa, 11 years ago, In English

Can someone give me the code for fast IO in c++? Thanks very much.

Full text and comments »

  • Vote: I like it
  • -14
  • Vote: I do not like it

By dario-dsa, 11 years ago, In English

The Croatia selected a team for this year programing competition IOI 2013 and CEOI 2013 which will be held in Primošten, Croatia. This year the best programer is Domagoj Ćevid. He won last year silver medal(IOI 2012) and gold medal at mathematical world competition 2012. The youngest programmer in the team is Ivan Lazarić. He won 3 place in the final competition and he is national winner in his category. Only Domagoj had experience at big programming competition but I am sure that we will have a great score like the last or previous year.


This year selected are:
1. Domagoj Ćevid
2. mislav
3. IvL
4. Mislav Bradač

Full text and comments »

  • Vote: I like it
  • +10
  • Vote: I do not like it

By dario-dsa, 11 years ago, In English

Can anyone tell me a difference between bfs and bfs 0-1? Thanks very much.

Full text and comments »

  • Vote: I like it
  • -8
  • Vote: I do not like it

By dario-dsa, 12 years ago, In English

Once detective Saikat was solving a murder case. While going to the crime scene he took the stairs and saw that a number is written on every stair. He found it suspicious and decides to remember all the numbers that he has seen till now. While remembering the numbers he found that he can find some pattern in those numbers. So he decides that for each number on the stairs he will note down the sum of all the numbers previously seen on the stairs which are smaller than the present number. Calculate the sum of all the numbers written on his notes diary. Input

First line gives T, number of test cases.

2T lines follow.

First line gives you the number of stairs N

Next line gives you N numbers written on the stairs. Output

For each test case output one line giving the final sum for each test case. Constraints

T<=10

1<=N<=10^5

All numbers will be between 0 and 10^6. Example

Input: 1 5 1 5 3 6 4

Output: 15

Can anyone help me with it?

Full text and comments »

  • Vote: I like it
  • -8
  • Vote: I do not like it