Submission #1251172

#TimeUsernameProblemLanguageResultExecution timeMemory
1251172wng_Triple Peaks (IOI25_triples)C++20
0 / 100
2094 ms1968 KiB
#include <bits/stdc++.h> #include "triples.h" using namespace std; using ll = long long; ll count_triples(vector<int> H) { int N = H.size(); ll res = 0; for (int i = 0; i < N; i++) { for (int j = i + 1; j < N; j++) { int d1 = j - i; int h1 = H[i]; int h2 = H[j]; if (h1 == d1) { int d2 = h2; int k = j + d2; if (k < N && H[k] == d1 + d2) res++; } if (h1 == d1) { int d2 = h2 - d1; if (d2 > 0) { int k = j + d2; if (k < N && H[k] == d2) res++; } } if (h2 == d1) { int d2 = h1; int k = j + d2; if (k < N && H[k] == d1 + d2) res++; } { int d2 = h1; if (h2 == d1 + d2) { int k = j + d2; if (k < N && H[k] == d1) res++; } } if (h2 == d1) { int d2 = h1 - d1; if (d2 > 0) { int k = j + d2; if (k < N && H[k] == d2) res++; } } { int d2 = h2; if (h1 == d1 + d2) { int k = j + d2; if (k < N && H[k] == d1) res++; } } } } return res; } std::vector<int> construct_range(int M, int K) { return {1, 1, 1}; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...