Submission #570154

#TimeUsernameProblemLanguageResultExecution timeMemory
570154KingJtMountains (NOI20_mountains)C++17
0 / 100
2080 ms1492 KiB
#include <bits/stdc++.h> using namespace std; #define F first #define S second #define pb push_back #define lb lower_bound #define ub upper_bound #define bn binary_search #define sz(x) int((x).size()) #define lz(x) long long((x).size()) #define INF 1000000007 typedef long long ll; typedef vector<int> vi; typedef pair<int,int> ii; typedef vector<ll> vl; typedef pair<ll,ll> il; typedef vector<ii> vii; typedef vector<il> vil; typedef vector<vi> vvi; typedef vector<vl> vvl; typedef vector<string> vs; typedef vector<char> vc; typedef vector<bool> vb; typedef vector<pair<int,ii>> gw; typedef vector<pair<ll,il>> lw; typedef vector<vc> vvc; void solve(){ int n; cin>>n; vi in(n); for(int i=0;i<n;i++) cin>>in[i]; ll ans=0; for(int i=1;i<n-1;i++){ ll left=0,right=0; for(int j=0;j<n;j++){ if(j<i&&in[i]>in[j]){ left++; }else if(in[i]>in[j]) right++; } ans+=left*right; } cout<<ans<<endl; } int main(){ ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0); solve(); return 0; }
#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...