Submission #1256611

#TimeUsernameProblemLanguageResultExecution timeMemory
1256611pandaa73Triple Peaks (IOI25_triples)C++20
8 / 100
2096 ms1864 KiB
#include <bits/stdc++.h> using namespace std; #define lf "\n" #define ff endl #define _ << ' ' << #define all(x) begin(x),end(x) #define rall(x) rbegin(x),rend(x) #define infos(str) do { fprintf(stderr, str"\n"); } while(0) #define infor(str, ...) do { fprintf(stderr, str, __VA_ARGS__); } while(0) #define infof(str, ...) do { fprintf(stderr, str"\n", __VA_ARGS__); } while(0) #ifndef DEBUG #undef infos #undef infor #undef infof #define infos(str) #define infor(str, ...) #define infof(str, ...) #endif using ll = long long; constexpr int LOG = 20; constexpr int MOD = 1e9+7; constexpr int MAXN = 1e5+7; long long count_triples(std::vector<int> H) { ll cnt = 0; auto sort_3 = [&](array<int, 3> arr) -> array<int, 3> { if(arr[0] > arr[1]) swap(arr[0], arr[1]); if(arr[0] > arr[2]) swap(arr[0], arr[2]); if(arr[1] > arr[2]) swap(arr[1], arr[2]); return arr; }; auto check = [&](int i, int j, int k) -> bool { auto a = sort_3({j - i, k - i, k - j}); auto b = sort_3({H[i], H[j], H[k]}); return a == b; }; int N = H.size(); for(int i = 0; i < N; ++i) for(int j = i + 1; j < N; ++j) for(int k = j + 1; k < N; ++k) cnt += check(i, j, k); return cnt; } std::vector<int> construct_range(int M, int K) { return {}; }
#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...