-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDatabase.cpp
More file actions
41 lines (34 loc) · 912 Bytes
/
Copy pathDatabase.cpp
File metadata and controls
41 lines (34 loc) · 912 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
41
//**********************************************************************************
// pbm : https://www.spoj.com/problems/RPLD/
//**********************************************************************************
#include "bits/stdc++.h"
#include<iostream>
using ll = long long;
using ld = long double;
using namespace std;
#define endl "\n";
#define ff first
#define ss second
int testCase = 0;
void solve(){
ll n, r; cin >> n >> r;
set<pair<ll, ll>> db;
int flag = 1;
for(int i = 0; i < r; ++i){
ll id, subjectCode;
cin >> id >> subjectCode;
if(db.find({id, subjectCode}) != db.end()){
flag = 0;
}
db.insert({id, subjectCode});
}
cout << "Scenario #" << ++testCase << ": " << (flag == 1 ? "possible" : "impossible") << endl;
}
int main() {
int T = 1;
cin >> T;
while(T--){
solve();
}
return 0;
}