제출 #1306996

#제출 시각아이디문제언어결과실행 시간메모리
1306996MunkhErdene3개의 봉우리 (IOI25_triples)C++17
0 / 100
2094 ms3524 KiB
#include "triples.h" #include <bits/stdc++.h> #ifdef LOCAL #define dbg std::cout #else struct DebugDummy { template<typename T> DebugDummy& operator<<(const T&) { return *this; } }; DebugDummy dbg; #endif using namespace std; #define _ << ' ' << using ll = long long; long long count_triples(std::vector<int> H) { vector<ll> a({H.begin(), H.end()}); ll n = a.size(); ll ans = 0; for(ll i = 0; i < n; i++) { for(ll j = i + 2; j < n; j++){ auto [mx, mn] = make_pair(a[i], a[j]); if(mn > mx) swap(mx, mn); ll d = j - i; if(mx > d) continue; if(mx == d) { ll cand1 = i + mn; ll cand2 = j - mn; if(cand1 == cand2) { if(j - cand1 == a[cand1] && cand1 != j) {ans++; dbg << i _ cand1 _ j << '\n';} continue; } if(j - cand1 == a[cand1] && cand1 != j) {ans++; dbg << i _ cand1 _ j << '\n';} if(cand2 - i == a[cand2] && cand2 != i) {ans++; dbg << i _ cand2 _ j << '\n';} } else { if(a[i] + a[j] != d) continue; ll cand1 = i + mn; ll cand2 = i + mx; dbg << i _ j _ a[i] _ a[j] _ cand1 _ cand2 _ a[cand1] _ a[cand2] _ d<< '\n'; if(cand1 == cand2) { if(a[cand1] == d && j - cand1 == cand2) {ans++; dbg << i _ cand1 _ j << '\n';} continue; } if(a[cand1] == d && j - cand1 == mx) {ans++; dbg << i _ cand1 _ j << '\n';} if(a[cand2] == d && j - cand2 == mn) {ans++; dbg << i _ cand2 _ j << '\n';} } } } return ans; } std::vector<int> construct_range(int M, int K) { return {1, 1, 1}; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...