Submission #259951

# Submission time Handle Problem Language Result Execution time Memory
259951 2020-08-08T20:52:40 Z thecodingwizard Pairs (IOI07_pairs) C++11
30 / 100
154 ms 7920 KB
#include <bits/stdc++.h>

using namespace std;

#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <class T> using Tree = tree<T, null_type, less<T>,
     rb_tree_tag, tree_order_statistics_node_update>;

int b, n, d, m; 

int main() {
    cin >> b >> n >> d >> m;
    if (b == 1) {
        Tree<pair<int, int>> TS;
        long long ans = 0;
        vector<int> nums;
        for (int i = 0; i < n; i++) {
            int x; cin >> x;
            nums.push_back(x);
        }
        sort(nums.begin(), nums.end());
        int ct = 0;
        for (int x : nums) {
            ans += ct-TS.order_of_key(make_pair(x-d, 0));
            TS.insert(make_pair(x, ct++));
        }
        cout << ans << endl;
    } else if (b == 2) {

    } else {

    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 122 ms 6996 KB Output is correct
2 Correct 116 ms 7404 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 154 ms 7152 KB Output is correct
2 Correct 142 ms 7024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 150 ms 7024 KB Output is correct
2 Correct 149 ms 7796 KB Output is correct
3 Correct 141 ms 7920 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -