RPLE - Espionage

no tags 

Marcos the little one decided to build and manage an espionage agency, he was happy working as the chief of his agency, hiring spies to spy everybody in the country! But he realized that some of their own spies are spying themselves, of course, this is bad to the business and he don't want this to happen, he wants a program to alert him whenever a spy is spying another spy.


Will consists in T test cases, then, T cases will follow, starting from two integers N and R, each one denoting the number of persons to evaluate and the number of relationships spy-person each one has, then, R lines will follow and will contain two integers R1 and R2, meaning that R1 spies R2.


Will consist in T lines, starting from the string “Scenario #i: “ where i is the number of the test case you're analyzing, print the string “spying” if each spy has as a target a civilian, print “spied” otherwise.


3 2
0 1
2 1
3 3
0 1
2 1
0 2
4 2
2 3
0 1


Scenario #1: spying
Scenario #2: spied
Scenario #3: spying


1 <= N <= 1000

1 <= R <= 10000

Explanation of the second test case:

Spy 0 spies civilian 1, spy 2 spies civilian 1, spy 0 spies spy 2. (Spied case).

hide comments
abhaypatro: 2019-06-03 09:43:57

pay attention to the output format. costed me 1 WA :(

cenation007: 2019-05-28 22:00:13

did it using just array of vectors

sakshamdrose: 2019-03-21 13:29:39

0.01 second ... vector and binary search

rajeev_mnnit: 2017-05-11 14:40:27

Avoid Input break :)

poda_venna: 2016-08-11 20:07:58

Irritating question. Still can't figure out why i got so many WA's.

Arun Vinud: 2015-06-29 02:22:58

Don't break the input!!!

Vamsi Krishna Avula: 2014-12-21 08:31:57

'r' number of pairs, do they lie between 0 and n - 1 (included)?
I got a runtime error based on that assumption, so can someone confirm?
Edit: my fault, they lie between 0 and n - 1

Last edit: 2014-12-21 09:24:23
Abhinav Gupta: 2014-01-25 08:32:29

Nice problem..:)..Done without Maps!!..Maps will do it very fast.

Last edit: 2014-01-25 08:49:24
Rishav Goyal: 2014-01-03 08:43:05

Incomplete Question, but when it do, we are done :P

Himanshu: 2013-10-17 21:23:02

Simple but Naughty........

Added by:david_8k
Time limit:0.189s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:Own Problem used for the RPL contest