제출 #1250050

#제출 시각아이디문제언어결과실행 시간메모리
1250050s4dz3개의 봉우리 (IOI25_triples)C++20
11 / 100
13 ms1964 KiB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
std::vector<int> construct_range(int M, int K)
{
    return{};
}
long long count_triples(vector<int> H)
{
    int n = H.size();
    ll ans = 0;
    for (int k = 0; k < n; k++)
    {
        int c = H[k];
        int i = k - c;
        if (i < 0 || i >= n) continue;

        int a = H[i];
        if (a > c - a) continue;

        int need = c - a;
        int j1   = i + a;
        int j2   = k - a;
        if (i < j1 && j1 < k && H[j1] == need) ans++;
        if (j2 != j1 && i < j2 && j2 < k && H[j2] == need) 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...