Submission #1249990

#TimeUsernameProblemLanguageResultExecution timeMemory
1249990s4dzTriple Peaks (IOI25_triples)C++20
0 / 100
14 ms2628 KiB
#include <bits/stdc++.h> using namespace std; /* Author: s4dz */ #define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); using ll = long long; using ld = long double; using uint = unsigned int; using ull = unsigned long long; using pii = pair<int, int>; using pli = pair<ll, int>; using pll = pair<ll, ll>; const ll maxn = 1000005; const ll inf = 1e9 + 7; int n, arr[maxn], q, a, b, c; int st[4 * maxn], lazy[4 * maxn]; std::vector<int> construct_range(int M, int K) { return{}; } long long count_triples(std::vector<int> H) { H.insert(H.begin(), 0); ll ans = 0; n = H.size() - 1; for(int k = 1; k <= n; k++) { int i = k - H[k]; if(i < 1 || i > n) continue; int j1 = i + H[i]; int j2 = k - H[i]; int hj = max(H[i], H[k] - H[i]); if(i < j1 && j1 < k && j1 <= n && H[j1] == hj) ans++; if(j1 != j2 && j2 > i && j2 < k && j2 <= n && H[j2] == hj) ans++; } return ans; }
#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...