Submission #65393

#TimeUsernameProblemLanguageResultExecution timeMemory
65393KieranHorganPairs (IOI07_pairs)C++17
30 / 100
45 ms6528 KiB
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define ll long long #define int long long #define ld double #define pii pair<int,int> #define rand() abs((rand()<<15)|rand()) #define randll() abs(((long long)rand()<<30) int B, N, D, M; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> B >> N >> D >> M; if(B == 1) { vector<int> a(N); for(auto &x: a) cin >> x; sort(a.begin(), a.end()); int ans = 0; for(auto x: a) ans += upper_bound(a.begin(), a.end(), x+D)-lower_bound(a.begin(), a.end(), x-D)-1; cout << ans/2 << endl; } }
#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...