Skip to content

Commit 6a1357a

Browse files
committed
aceito
1 parent 7b689c3 commit 6a1357a

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

Exercicios/taligado.cpp

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,29 @@
11
#include <iostream>
22
#include <vector>
3+
#include <algorithm>
34

45
using namespace std;
6+
#define MAXN 100001
7+
typedef vector<int> vi;
58

69
int n, m;
10+
vi v[MAXN];
711

8-
int main(){
12+
int main() {
13+
ios::sync_with_stdio(0);
14+
cin.tie(0);
15+
16+
cin >> n >> m;
17+
int t, a, b;
18+
19+
while(m--) {
20+
cin >> t >> a >> b;
921

10-
cin >> n >> m;
22+
if (t) {
23+
v[a].push_back(b);
24+
v[b].push_back(a);
25+
} else {
26+
cout << (find(v[a].begin(), v[a].end(), b) != v[a].end()) << endl;
27+
}
28+
}
1129
}

0 commit comments

Comments
 (0)