Submission #1252955

#TimeUsernameProblemLanguageResultExecution timeMemory
1252955nickolasarapidisTriple Peaks (IOI25_triples)C++17
Compilation error
0 ms0 KiB
#include "triples.h" #include <bits/stdc++.h> using namespace std; #define F first #define S second long long count_triples(std::vector<int> H){ int N = H.size(); long long ans = 0; for(int i = 0; i < N; i++){ for(int j = i + 1; j < N; j++){ dij = j - i; if(dij == H[i]){ if(j + H[j] < N and H[j + H[j]] == H[i] + H[j]) ans++; } else if(dij == H[j]){ if(j + H[i] < N and H[j + H[i]] == H[i] + H[j]) ans++; } else{ if(j + min(H[i], H[j]) < N and H[j + min(H[i], H[j])] == dij) ans++; } } } return ans; } vector<int> construct_range(int M, int K){ vector<int> ans(M); int cnt = 1; for(int i = 0; i < M; i++){ if(cnt == 1 or cnt == 3){ ans[i] = 1; } else{ ans[i] = 2; } if(cnt == 3) cnt = 1; else cnt++; } return ans; }

Compilation message (stderr)

triples.cpp: In function 'long long int count_triples(std::vector<int>)':
triples.cpp:13:13: error: 'dij' was not declared in this scope; did you mean 'div'?
   13 |             dij = j - i;
      |             ^~~
      |             div