-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathradir.cpp
More file actions
43 lines (38 loc) · 868 Bytes
/
radir.cpp
File metadata and controls
43 lines (38 loc) · 868 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
42
43
#include <iostream>
#include <cstring>
#define ll long long
#define ld long double
#define u unsigned
using namespace std;
int p,n;
bool hasCard[5][14];
bool check() {
for (int i = 1; i <= 4; ++i) {
for (int j = 2; j <= 12; ++j) {
if (hasCard[i][j-1] && hasCard[i][j] && hasCard[i][j+1]) {
return true;
}
}
}
return false;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
memset(hasCard, false, sizeof(hasCard));
cin >> n >> p;
for (int i = 0; i < p; ++i) {
int suit, number;
cin >> suit >> number;
hasCard[suit][number] = true;
}
if (n == p) {cout << (check() ? "1" : "neibb"); return 0;}
for (int i = 1; i <= n-p; ++i) {
int suit, number;
cin >> suit >> number;
hasCard[suit][number] = true;
if (check()) { cout << i; return 0;}
}
cout << "neibb";
return 0;
}