SOLVE

LATER

Bishu and Soldiers

Problem

Editorial

Analytics

Bishu went to fight for Coding Club. There were N soldiers with various powers. There will be Q rounds to fight and in each round Bishu's power will be varied. With power M, Bishu can kill all the soldiers whose power is less than or equal to M(<=M). After each round, All the soldiers who are dead in previous round will reborn.Such that in each round there will be N soldiers to fight. As Bishu is weak in mathematics, help him to count the number of soldiers that he can kill in each round and total sum of their powers.

1<=N<=10000

1<=power of each soldier<=100

1<=Q<=10000

1<=power of bishu<=100

Explanation

In first round bhishu power is 3

So there are 3 soldiers whose power is <=3 and the sum of their power is 1+2+3=6

therefore ans= 3 6

same for the next round

Time Limit:
1.0 sec(s)
for each input file.

Memory Limit:
256 MB

Source Limit:
1024 KB

Marking Scheme:
Marks are awarded when all the testcases pass.

Allowed Languages:
C,
C++,
Clojure,
C#,
D,
Erlang,
F#,
Go,
Groovy,
Haskell,
Java,
Java 8,
JavaScript(Rhino),
JavaScript(Node.js),
Lisp,
Lisp (SBCL),
Lua,
Objective-C,
OCaml,
Octave,
Pascal,
Perl,
PHP,
Python,
Python 3,
R(RScript),
Racket,
Ruby,
Rust,
Scala 2.11.8,
Swift,
Visual Basic

Initializing Code Editor...

{"5771555": "/pagelets/suggested-problems/algorithm/bishu-and-soldiers/", "577156c": "/pagelets/problem-author-tester/algorithm/bishu-and-soldiers/", "5771582": "/pagelets/problems-hint/algorithm/bishu-and-soldiers/", "5771596": "/pagelets/recommended-problems/algorithm/bishu-and-soldiers/", "577152c": "/pagelets/show-submission/algorithm/bishu-and-soldiers/"}

{}

realtime.hackerearth.com

80

19352ce5494c61a1342a7e4c4b5e1603e12ee434

58a29e5cae2309f04b28

/realtime/pusher/auth/