Submission #890823

#TimeUsernameProblemLanguageResultExecution timeMemory
890823Sir_Ahmed_ImranPairs (IOI07_pairs)C++17
30 / 100
331 ms293976 KiB
///~~~LOTA~~~/// #include <bits/stdc++.h> using namespace std; #define nl '\n' #define ff first #define ss second #define ll long long #define append push_back #define all(x) (x).begin(),(x).end() void solvefor1(){ ll r; int n,m,o,p; cin>>n>>o>>m; int dp[m+1]={0}; vector<int> v; for(int i=0;i<n;i++){ cin>>p; dp[p]++; v.append(p); } for(int i=1;i<=m;i++) dp[i]+=dp[i-1]; r=0; for(auto& i:v) r+=dp[min(m,i+o)]-dp[max(0,i-o-1)]-1; cout<<r/2; } void solvefor2(){ } void solvefor3(){ } void solve(){ int t; cin>>t; if(t==1) solvefor1(); if(t==2) solvefor2(); if(t==3) solvefor3(); } int main(){ ios_base::sync_with_stdio(false);cin.tie(NULL); 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...
#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...