-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRPLD.cpp
More file actions
40 lines (36 loc) · 888 Bytes
/
RPLD.cpp
File metadata and controls
40 lines (36 loc) · 888 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// http://www.spoj.com/problems/RPLD/
#include <stdio.h>
#include <utility>
#include<set>
using namespace std;
typedef pair<int,int> P;
int main(){
//freopen ("input.txt","r",stdin);
int T,N,R,I,C;
bool possible;
set<P> mySet;
set<P>::iterator it;
P myPair;
scanf("%d",&T);
for(int i=0;i<T;i++){
possible=true;
scanf("%d",&N);
scanf("%d",&R);
for(int j=0;j<R;j++){
scanf("%d",&I);
scanf("%d",&C);
myPair=make_pair(I,C);
it=mySet.find(myPair);
if(it!=mySet.end()){
possible=false;
}else{
mySet.insert(myPair);
}
}
if(possible) printf("Scenario #%d: possible\n",i+1);
else printf("Scenario #%d: impossible\n",i+1);
mySet.clear();
}
//fclose (stdin);
return 0;
}