Submission #1258423

#TimeUsernameProblemLanguageResultExecution timeMemory
1258423algoritTriple 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; //} 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)

triples.cpp: In function 'long long int count_triples(std::vector<long long int>)':
triples.cpp:63:5: error: 'n' was not declared in this scope
   63 |     n = H.size();
      |     ^
triples.cpp:64:5: error: 'mps' was not declared in this scope
   64 |     mps.clear();
      |     ^~~
triples.cpp:69:51: error: 'ct3' was not declared in this scope
   69 |             if (i >= 0 && k < n && H[k] == k - i) ct3(i,j,k);
      |                                                   ^~~
triples.cpp:74:60: error: 'ct3' was not declared in this scope
   74 |             if (i >= 0 && k < n && j < k && H[k] == k - j) ct3(i,j,k);
      |                                                            ^~~
triples.cpp:79:51: error: 'ct3' was not declared in this scope
   79 |             if (i >= 0 && k < n && H[i] == k - i) ct3(i,j,k);
      |                                                   ^~~
triples.cpp:84:60: error: 'ct3' was not declared in this scope
   84 |             if (i >= 0 && k < n && i < j && H[i] == j - i) ct3(i,j,k);
      |                                                            ^~~
triples.cpp:89:58: error: 'ct3' was not declared in this scope
   89 |             if (i >= 0 && i < j && H[i] + H[k] == k - i) ct3(i,j,k);
      |                                                          ^~~