제출 #1252428

#제출 시각아이디문제언어결과실행 시간메모리
1252428bzzzzzzzzzzTriple Peaks (IOI25_triples)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "triples.h" using namespace std; using ll = long long; std::vector<int> construct_range(int M, int K) { return {1}; } long long count_triples(vector<int> H) { int n = (int)H.size(); ll ans = 0; if (n <= 2000) { for (int i = 0; i < n; i++) { for (int k = i + 2; k < n; k++) { int x = k - i; if (x == H[i]) { if (H[k] < x) { if (H[i + H[k]] == k - (i + H[k])) { ans++; } if (i + H[k] + H[k] != k && H[k - H[k]] == (k - H[k]) - i) { ans++; } } } else if (x == H[k]) { if (H[i] < x) { if (H[i + H[i]] == k - (i + H[i])) { ans++; } if (i + H[i] + H[i] != k && H[k - H[i]] == (k - H[i]) - i) { ans++; } } } else { if (H[i] + H[k] == x) { if (H[i + H[i]] == x) { ans++; } if (i + H[i] + H[i] != k && H[i + H[k]] == x) { ans++; } } } } } } else { for (int k = 0; k < n; k++) { int i = k - H[k]; if (i < 0) { continue; } if (H[i + H[i] == k - (i + H[i])) { ans++; } if (i + H[i] + H[i] != k && (k - H[i]) - i == H[k - H[i]]) { ans++; } } } return ans; }

컴파일 시 표준 에러 (stderr) 메시지

triples.cpp: In function 'long long int count_triples(std::vector<int>)':
triples.cpp:53:45: error: expected ']' before ')' token
   53 |             if (H[i + H[i] == k - (i + H[i])) {
      |                                             ^
      |                                             ]