Submission #1263009

#TimeUsernameProblemLanguageResultExecution timeMemory
1263009nerrrminTriple Peaks (IOI25_triples)C++20
0 / 100
2093 ms3400 KiB
#include "triples.h" #include<bits/stdc++.h> #define pb push_back using namespace std; const int maxn = 2e5 + 10; int n; long long a[maxn]; long long count_triples(std::vector<int> H) { n = H.size(); for (int i = 1; i <= n; ++ i) { a[i] = H[i-1]; } long long ans = 0; for (int i = 1; i <= n; ++ i) { for (int j = i + 2; j <= n; ++ j) { int dist = j - i; if(a[i] == dist || a[j] == dist) { int other = a[i] + a[j] - dist; int pos = i + other; if(i < pos && pos < j && a[pos] == j - pos)ans ++; pos = j - other; if(i < pos && pos < j && a[pos] == pos - i)ans ++; } else { if(a[i] + a[j] == dist) { int pos = i + a[i]; if(i < pos && pos < j && a[pos] == dist)ans ++; pos = j - a[i]; if(i < pos && pos < j && a[pos] == dist)ans ++; } } } } return ans; } 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...