Submission #1251833

#TimeUsernameProblemLanguageResultExecution timeMemory
1251833tranvinhhuy20103개의 봉우리 (IOI25_triples)C++20
Compilation error
0 ms0 KiB
//#include "triples.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; const int nmax = 2e5 + 5; int n; unordered_map <int, vector <int>> m; ll count_triples(vector <int> H) { n = H.size(); ll cnt = 0; for (int j=0; j<n; j++) { int l = j - H[j]; if(l >= 0) { int x = H[l]; int y = H[j] - x; if(y > 0) { if(H[l + x] == y) cnt++; if(y != x && H[l + y] == y) cnt++; } } int r = j + H[j]; if(r < n) { int x = H[r]; int y = H[j] - x; if(y > 0) { if(H[j + x] == y) cnt++; if(y != x && H[j + y] == y) cnt++; } } } for (int k = 0; k < n; ++k) { int hk = H[k]; for (int i : m[k - hk]) { int j1 = i + H[i]; int j2 = i + hk; if (j1 < k && H[j1] == hk) count++; if (j2 < k && j2 != j1 && H[j2] == hk) count++; } m[k + H[k]].push_back(k); } return cnt; } vector<int> construct_range(int M, int K) { return {1, 1, 1}; }

Compilation message (stderr)

triples.cpp: In function 'll count_triples(std::vector<int>)':
triples.cpp:47:45: error: no post-increment operator for type
   47 |             if (j1 < k && H[j1] == hk) count++;
      |                                             ^~
triples.cpp:48:57: error: no post-increment operator for type
   48 |             if (j2 < k && j2 != j1 && H[j2] == hk) count++;
      |                                                         ^~