Submission #633676

# Submission time Handle Problem Language Result Execution time Memory
633676 2022-08-23T03:42:56 Z Spade1 Pairs (IOI07_pairs) C++14
30 / 100
24 ms 2188 KB
#include<bits/stdc++.h>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define ll long long
#define ld long double
#define st first
#define nd second
#define pb push_back
#define INF INT_MAX
using namespace std;

const int N = 2e5 + 10;

int a[N], fw[N];
pii c[N], d[N];

void solve() {
    int b, n, d, m; cin >> b >> n >> d >> m;
    ll ans = 0;
    if (b == 1) {
        for (int i = 0; i < n; ++i) cin >> a[i];
        sort(a, a+n);
        int l = 0;
        for (int i = 1; i < n; ++i) {
            while (a[i] - a[l] > d) l++;
            ans += (i-l);
        }
    }
    else if (b == 2) {
        for (int i = 0; i < n; ++i) cin >> c[i].st >> c[i].nd;

    }
    else if (b == 3) {

    }
    cout << ans << '\n';
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(NULL);
    int t = 1;
//    cin >> t;
    while (t--) {
        solve();
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 1092 KB Output is correct
2 Correct 11 ms 1104 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 24 ms 1580 KB Output is correct
2 Correct 16 ms 1492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 18 ms 1580 KB Output is correct
2 Correct 17 ms 1552 KB Output is correct
3 Correct 16 ms 1576 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Incorrect 1 ms 332 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 1612 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 1828 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 2188 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -