Submission #259921

# Submission time Handle Problem Language Result Execution time Memory
259921 2020-08-08T19:45:15 Z thecodingwizard Pairs (IOI07_pairs) C++11
6 / 100
167 ms 6256 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<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());
        for (int x : nums) {
            ans += TS.order_of_key(x+1)-TS.order_of_key(x-d);
            TS.insert(x);
        }
        cout << ans << endl;
    } else if (b == 2) {

    } else {

    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Incorrect 1 ms 256 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 50 ms 1404 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 167 ms 6256 KB Output is correct
2 Correct 144 ms 6256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 151 ms 6252 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 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 384 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 1 ms 288 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 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -