Submission #65393

# Submission time Handle Problem Language Result Execution time Memory
65393 2018-08-07T13:42:35 Z KieranHorgan Pairs (IOI07_pairs) C++17
30 / 100
45 ms 6528 KB
#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 time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 4 ms 424 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 664 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 36 ms 1808 KB Output is correct
2 Correct 26 ms 2240 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 45 ms 3156 KB Output is correct
2 Correct 40 ms 4020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 42 ms 4900 KB Output is correct
2 Correct 39 ms 5764 KB Output is correct
3 Correct 37 ms 6528 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 6528 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 6528 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 6528 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 6528 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 6528 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 6528 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 6528 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 6528 KB Output isn't correct
2 Halted 0 ms 0 KB -