Submission #1251513

#TimeUsernameProblemLanguageResultExecution timeMemory
1251513chr34Triple Peaks (IOI25_triples)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define endl "\n" #define dbg(x) cout << #x << " = " << (x) << endl; const int INF = 1e18; const int MAXN = 1e6 + 10; const int MOD = 1e9 + 7; bool check(vector<int> first, vector<int> second){ sort(first.begin(), first.end()); sort(second.begin(), second.end()); for(int i = 0; i < 3; ++i){ if(first[i] != second[i]) return false; } return true; } int count_triples(vector<int> h){ int n = h.size(); int ans = 0; 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> first = {j - i, k - j, k - i}; vector<int> second = {h[i], h[j], h[k]}; if(check(first, second)) ans++; } } } return ans; } int32_t main(){ ios::sync_with_stdio(false); cin.tie(nullptr); //freopen("input.in", "r", stdin); //freopen("input.out", "w", stdout); int subtask; cin >> subtask; int n; cin >> n; vector<int> h(n); for(int i = 0; i < n; ++i) cin >> h[i]; cout<<count_triples(h); return 0; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccoAKTbW.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc3FDre6.o:triples.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccoAKTbW.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