Submission #1249817

#TimeUsernameProblemLanguageResultExecution timeMemory
1249817kduckpTriple Peaks (IOI25_triples)C++20
Compilation error
0 ms0 KiB
#include "triples.h" #include <vector> #include <algorithm> using namespace std; long long count_triples(std::vector<int> H) { long long res = 0; int n = H.size(); if (n <= 100) { for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++) for (int k = j + 1; k < n; k++) { vector<int> height = {H[i], H[j], H[k]}; vector<int> dist = {j - i, k - i, k - j}; sort(height.begin(), height.end()); sort(dist.begin(), dist.end()); if (height == dist) res++; } return res; } bool small_value = true; for (int h : H) if (h > 10) { small_value = false; break; } if (small_value) { vector<vector<int>> pos(11); for (int i = 0; i < n; ++i) pos[H[i]].push_back(i); int res = 0; for(int i = 1; i <= 30; i++) { for(int j = i + 1; j <= 30; j++) { for(int k = j + 1; k <= 30; k++) { vector<int> idx = {j - i, k - i, k - j}; sort(idx.begin(), idx.end()); vector<int> height = {H[i], H[j], H[k]}; sort(height.begin(), height.end()); if(idx == height)res++; } } } cout<<res; } return 0; } std::vector<int> construct_range(int M, int K) { return {1, 1, 2}; }

Compilation message (stderr)

triples.cpp: In function 'long long int count_triples(std::vector<int>)':
triples.cpp:49:9: error: 'cout' was not declared in this scope
   49 |         cout<<res;
      |         ^~~~
triples.cpp:4:1: note: 'std::cout' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
    3 | #include <algorithm>
  +++ |+#include <iostream>
    4 | using namespace std;