Submission #874896

# Submission time Handle Problem Language Result Execution time Memory
874896 2023-11-18T04:10:49 Z veehj Pairs (IOI07_pairs) C++17
30 / 100
41 ms 3128 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
#define F first
#define S second
#define pb push_back
#define sz(a) (int)a.size()
#define all(x) (x).begin(), (x).end()
ll b, n, d, m;

void f2(){
    vector<pair<ll, ll>> v(n);
    for(auto& u : v) cin >> u.F >> u.S;
    
}

void f1(){
    vector<ll> v(n);
    for(auto& u : v) cin >> u;
    sort(all(v));
    ll ans=0;
    for(ll i=0; i<n; i++){
        ans+=upper_bound(all(v), v[i]+d)-v.begin();
        ans-=i+1;
    }
    cout << ans << endl;
}

int main() {
    cin >> b >> n >> d >> m;
    if(b==1) f1();
    if(b==2) f2();
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 21 ms 1372 KB Output is correct
2 Correct 21 ms 1372 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 35 ms 1880 KB Output is correct
2 Correct 32 ms 1884 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 36 ms 1884 KB Output is correct
2 Correct 34 ms 1884 KB Output is correct
3 Correct 33 ms 1876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 32 ms 2652 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 41 ms 3128 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -