Submission #1258424

#TimeUsernameProblemLanguageResultExecution timeMemory
1258424algoritTriple Peaks (IOI25_triples)C++20
Compilation error
0 ms0 KiB
#ifndef ZO_H_INCLUDED
#define ZO_H_INCLUDED
#include <bits/stdc++.h>
#include <random>
#include <time.h>
#define int long long
#define ll long long
#define fi first
#define se second
#define ii pair<int,int>
using namespace std;
//long long count_triples(std::vector<int> H){
//    int n = H.size();
//    vector <vector<int>> z[n];
//    for (int i = 0; i < n; i++){
//        for (int j = i + 1; j < n; j++){
//            for (int k = j + 1; k < n; k++){
//                int d1 = j - i, d2 = k - i, d3 = k - j;
//                vector <int> tmp = {d1,d3,d2};
//                z[i].push_back(tmp);
//                // cout << d1 << " " << d2 << " " << d3 << "\n";
//            }
//        }
//    }
//    dist(i,j) + dist(j,k) = dist(i,k)
//    -> d1 + d3 = d2
//    for (d1) -> for (d3):
//        a[i], a[i + d1], a[i + d1 + d3] = d1 , d3, d1 + d3
//
//    xet a[i]
//    j = i + a[i] -> co a[j]
//    TH1: k = j + a[j] -> co a[k] | ok
//    TH2: k = i + a[j] -> co a[k] | ok
//
//    xet a[i]
//    k = i + a[i]
//    TH1: i + a[k]
//    TH2: k - a[k]
//
////    xet a[i]
////    TH1:
////    k - j = a[i]
////    j - i = a[j]
////    k - i = a[k]
////
////    TH2:
////    k - j = a[i]
////    k = a[i] + j
////    j - i = a[k]
////    k - i = a[j]
//    for (int i = 0; i < n; i++) sort(z[i].begin(), z[i].end());
//    for (int i = 0; i < n; i++){
//        for (auto x : z[i]){
//            cout << i << " -> ";
//            for (auto t : x) cout << t << " ";
//            cout << "\n";
//        }
//        cout << "\n";
//    }
//    return 10;
//}
int n;
map <array<int,3>, bool> mps;
void ct3(int i, int j, int k){
    // cout << i << " " << j << " " << k << "\n";
    assert(i < j && j < k && i >=0 && k < n);
    array<int,3> f = {i,j,k};
//    if (mps[f] == true){
//        for (auto x : gg) cout << x << " ";
//        cout << "\n";
//    }
//    assert(mps[f] == false);
    mps[f] = true;
}
long long count_triples(std::vector<int> H){
    n = H.size();
    mps.clear();
    for (int j = 1; j < n - 1; j++){
        if (true){
            int i = j - H[j];
            int k = j + H[i];
            if (i >= 0 && k < n && H[k] == k - i) ct3(i,j,k);
        }
        if (true){
            int i = j - H[j];
            int k = i + H[i];
            if (i >= 0 && k < n && j < k && H[k] == k - j) ct3(i,j,k);
        }
        if (true){
            int k = j + H[j];
            int i = j - H[k];
            if (i >= 0 && k < n && H[i] == k - i) ct3(i,j,k);
        }
        if (true){
            int k = j + H[j];
            int i = k - H[k];
            if (i >= 0 && k < n && i < j && H[i] == j - i) ct3(i,j,k);
        }
        for (int k = j + 1; k < n; k++){
            int i = k - H[j];
            if (i >= j) break;
            if (i >= 0 && i < j && H[i] + H[k] == k - i) ct3(i,j,k);
        }
    }

    return (int)mps.size();
}
std::vector<int> construct_range(int M, int K){
    return {};
}
#endif // ZO_H_INCLUDED

Compilation message (stderr)

/usr/bin/ld: /tmp/ccGzW1VZ.o: in function `main':
grader.cpp:(.text.startup+0x18a): undefined reference to `construct_range(int, int)'
/usr/bin/ld: grader.cpp:(.text.startup+0x37b): undefined reference to `count_triples(std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status