Please sign in first.
Submission #49547718
Source Code Expand
/**
* @the_hyp0cr1t3
* 21.01.2024 17:58
**/
#include <bits/stdc++.h>
using i64 = long long;
constexpr int N = 30;
int main() {
std::cin.tie(nullptr)->sync_with_stdio(false);
std::vector<std::array<int, 3>> triples;
for (int i = 1; i <= 10; i++)
for (int j = 1; j <= 10; j++)
for (int k = 1; k <= 10; k++)
if (j - i == k - j) triples.push_back({i, j, k});
int n;
std::cin >> n;
std::vector<int> a(n);
for (auto &x : a)
std::cin >> x;
i64 ans = 1LL * n * (n + 1) / 2;
for (int i = 0; i < n; i++) {
std::vector<int> p(triples.size());
for (int j = i; j < n and j - i < N; j++) {
for (int t = 0; t < triples.size(); t++)
p[t] += (a[j] == triples[t][p[t]]);
if (std::ranges::max(p) == 3) break;
ans--;
}
}
std::cout << ans << '\n';
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - Arithmetic Progression Subsequence |
| User | the_hyp0cr1t3 |
| Language | C++ 20 (gcc 12.2) |
| Score | 500 |
| Code Size | 942 Byte |
| Status | AC |
| Exec Time | 104 ms |
| Memory | 3608 KiB |
Compile Error
Main.cpp: In function ‘int main()’:
Main.cpp:30:31: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<std::array<int, 3> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
30 | for (int t = 0; t < triples.size(); t++)
| ~~^~~~~~~~~~~~~~~~
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 500 / 500 | ||||
| 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, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt, 01_test_14.txt, 01_test_15.txt, 02_handmade_01.txt, 02_handmade_02.txt, 02_handmade_03.txt, 02_handmade_04.txt, 02_handmade_05.txt, 02_handmade_06.txt, 02_handmade_07.txt, 02_handmade_08.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_01.txt | AC | 1 ms | 3416 KiB |
| 00_sample_02.txt | AC | 1 ms | 3356 KiB |
| 00_sample_03.txt | AC | 1 ms | 3412 KiB |
| 01_test_01.txt | AC | 1 ms | 3528 KiB |
| 01_test_02.txt | AC | 1 ms | 3380 KiB |
| 01_test_03.txt | AC | 34 ms | 3480 KiB |
| 01_test_04.txt | AC | 39 ms | 3416 KiB |
| 01_test_05.txt | AC | 24 ms | 3408 KiB |
| 01_test_06.txt | AC | 42 ms | 3532 KiB |
| 01_test_07.txt | AC | 37 ms | 3576 KiB |
| 01_test_08.txt | AC | 37 ms | 3528 KiB |
| 01_test_09.txt | AC | 37 ms | 3508 KiB |
| 01_test_10.txt | AC | 37 ms | 3552 KiB |
| 01_test_11.txt | AC | 43 ms | 3544 KiB |
| 01_test_12.txt | AC | 43 ms | 3548 KiB |
| 01_test_13.txt | AC | 44 ms | 3504 KiB |
| 01_test_14.txt | AC | 43 ms | 3568 KiB |
| 01_test_15.txt | AC | 43 ms | 3508 KiB |
| 02_handmade_01.txt | AC | 67 ms | 3548 KiB |
| 02_handmade_02.txt | AC | 67 ms | 3580 KiB |
| 02_handmade_03.txt | AC | 71 ms | 3520 KiB |
| 02_handmade_04.txt | AC | 70 ms | 3536 KiB |
| 02_handmade_05.txt | AC | 79 ms | 3516 KiB |
| 02_handmade_06.txt | AC | 79 ms | 3572 KiB |
| 02_handmade_07.txt | AC | 104 ms | 3608 KiB |
| 02_handmade_08.txt | AC | 104 ms | 3496 KiB |