#include<bits/stdc++.h>
using namespace std;
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T> using ordset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
/*
less<T> can be changed to:
1. less_equal<T>
2. greater<T>
ordered_set functions:
1. *(os.find_by_order(x)) -> return the value at position x (0 base)
2. os.order_of_key(x) -> return the number of elements less than x
*/
typedef long long ll;
#define endl '\n'
#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
const int MOD=1000000007;
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define fios(); ios_base::sync_with_stdio(0);cin.tie(0);
#define fraction(x); cout.unsetf(ios::floatfield); cout.precision(x); cout.setf(ios::fixed,ios::floatfield);
#define file(); freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
int count_triples(vector<int32_t> a){
//subtask 2
int n=a.size();
int cnt=0;
for(int i=0;i<n;i++){
for(int j=i+1;j<n&&j-i<=10;j++){
for(int k=j+1;k<n&&k-i<=10;k++){
vector<int> v={j-i,k-i,k-j};
vector<int> v2={a[i],a[j],a[k]};
sort(all(v));
sort(all(v2));
if(v[0]==v2[0]&&v[1]==v2[1]&&v[2]==v2[2]) cnt++;
}
}
}
return cnt;
}
vector<int32_t> construct_range(int32_t M, int32_t K){
vector<int> ans(M);
for(int i=0;i<M;i++){
if(i%3==0) ans[i]=1;
else if(i%3==1) ans[i]=1;
else ans[i]=2;
}
return ans;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |