Submission #756645

#TimeUsernameProblemLanguageResultExecution timeMemory
756645SanguineChameleonPairs (IOI07_pairs)C++17
30 / 100
28 ms1572 KiB
#include <bits/stdc++.h> using namespace std; void just_do_it(); int main() { #ifdef KAMIRULEZ freopen("kamirulez.inp", "r", stdin); freopen("kamirulez.out", "w", stdout); #endif ios_base::sync_with_stdio(0); cin.tie(0); just_do_it(); return 0; } namespace sub1 { const int maxN = 1e5 + 20; int pos[maxN]; int N, D, M; void solve() { cin >> N >> D >> M; for (int i = 1; i <= N; i++) { cin >> pos[i]; } sort(pos + 1, pos + N + 1); long long res = 0; for (int i = 1; i <= N; i++) { res += upper_bound(pos + 1, pos + N + 1, pos[i] + D) - lower_bound(pos + 1, pos + N + 1, pos[i] - D); } res = (res - N) / 2; cout << res; } } namespace sub2 { void solve() { assert(false); } } namespace sub3 { void solve() { assert(false); } } void just_do_it() { int B; cin >> B; if (B == 1) { sub1::solve(); } if (B == 2) { sub2::solve(); } if (B == 3) { sub3::solve(); } }
#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...