Submission #1249976

#TimeUsernameProblemLanguageResultExecution timeMemory
1249976s4dzTriple Peaks (IOI25_triples)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; /* Author: s4dz */ #define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); using ll = long long; using ld = long double; using uint = unsigned int; using ull = unsigned long long; using pii = pair<int, int>; using pli = pair<ll, int>; using pll = pair<ll, ll>; const ll maxn = 1000005; const ll inf = 1e9 + 7; int n, arr[maxn], q, a, b, c; int st[4 * maxn], lazy[4 * maxn]; std::vector<int> construct_range(int M, int K) { } long long count_triples(std::vector<int> H) { ll ans = 0; for(int k = 1; k <= n; k++) { int i = k - H[k]; int j1 = i + H[i]; int j2 = k - H[i]; int temp = H[i]; int hj = max(H[i], H[k] - H[i]); if(i < j1 && j1 < k && H[j1] == hj) ans++; if(j1 != j2 && j2 > i && j2 < k && H[j2] == hj) ans++; } return ans; } int main() { cin >> n; vector<int> H(n + 1); for(int i = 1; i <= n; i++) cin >> H[i]; cout << count_triples(H); }

Compilation message (stderr)

triples.cpp: In function 'std::vector<int> construct_range(int, int)':
triples.cpp:22:1: warning: no return statement in function returning non-void [-Wreturn-type]
   22 | }
      | ^
/usr/bin/ld: /tmp/ccu9KnI4.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccnWlsKc.o:triples.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status