Submission #73607018
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
typedef long long ll;
typedef unsigned long long ull;
typedef long double lld;
#define mp make_pair
#define A first
#define B second
#ifdef LOCAL
#include "debug.h"
#else
#define debug(x)
#endif
#define int long long
#define MOD 1000000007LL
void solve() {
int n; cin >> n;
vi arr(n * 2 + 1);
for (int i = 1; i <= n * 2; i++) cin >> arr[i];
if (n < 3) {
cout << 0 << "\n";
return;
}
int ans = 0;
for (int i = 1; i <= (n * 2 - 2); i++) {
if (arr[i] == arr[i + 2]) ans++;
}
cout << ans << "\n";
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
#ifdef LOCAL
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
freopen("error.txt", "w", stderr);
#endif
int tt = 1;
//cin >> tt;
auto start = std::chrono::high_resolution_clock::now();
while (tt--) solve();
auto stop = std::chrono::high_resolution_clock::now();
auto duration = std::chrono::duration_cast<std::chrono::microseconds>(stop - start);
cerr << duration.count() << endl;
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | D - Couples |
| User | LokeshGN |
| Language | C++23 (GCC 15.2.0) |
| Score | 150 |
| Code Size | 1348 Byte |
| Status | AC |
| Exec Time | 1 ms |
| Memory | 3716 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 150 / 150 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt |
| All | 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_01.txt | AC | 1 ms | 3548 KiB |
| 00_sample_02.txt | AC | 1 ms | 3488 KiB |
| 00_sample_03.txt | AC | 1 ms | 3652 KiB |
| 01_test_01.txt | AC | 1 ms | 3548 KiB |
| 01_test_02.txt | AC | 1 ms | 3492 KiB |
| 01_test_03.txt | AC | 1 ms | 3716 KiB |
| 01_test_04.txt | AC | 1 ms | 3712 KiB |
| 01_test_05.txt | AC | 1 ms | 3488 KiB |
| 01_test_06.txt | AC | 1 ms | 3488 KiB |
| 01_test_07.txt | AC | 1 ms | 3552 KiB |
| 01_test_08.txt | AC | 1 ms | 3548 KiB |
| 01_test_09.txt | AC | 1 ms | 3488 KiB |
| 01_test_10.txt | AC | 1 ms | 3488 KiB |