Skip to content

Commit

Permalink
ABC359B Couples
Browse files Browse the repository at this point in the history
  • Loading branch information
Vicfred committed Jun 24, 2024
1 parent fb27e7d commit 3ee80dc
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions atcoder/abc359b_couples.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Vicfred
// https://atcoder.jp/contests/abc359/tasks/abc359_b
// brute force, implementation
#include <iostream>
#include <vector>

using namespace std;

int main() {
int N;
cin >> N;
vector<int> A(2 * N);
for (int i = 0; i < 2 * N; ++i) {
cin >> A[i];
}
int answer = 0;
for(int i = 1; i <= N; ++i) {
for(int idx = 0; idx < 2 * N; ++idx) {
if(A[idx] == i and A[idx + 2] == i) {
answer += 1;
break;
}
}
}
cout << answer << endl;
return 0;
}

0 comments on commit 3ee80dc

Please sign in to comment.