Submission #988393

# Submission time Handle Problem Language Result Execution time Memory
988393 2024-05-24T15:17:57 Z huutuan Pairs (IOI07_pairs) C++14
30 / 100
16 ms 2136 KB
#include<bits/stdc++.h>

using namespace std;

#define int long long

const int N=1e5+10;
int b, n, d, m;

namespace sub1{
   int a[N];
   void solve(){
      for (int i=1; i<=n; ++i) cin >> a[i];
      sort(a+1, a+n+1);
      int ans=0;
      for (int i=1, j=1; i<=n; ++i){
         while (a[i]-a[j]>d) ++j;
         ans+=i-j;
      }
      cout << ans << '\n';
   }
}

int32_t main(){
   ios_base::sync_with_stdio(false);
   cin.tie(nullptr);
   cin >> b >> n >> d >> m;
   if (b==1){
      sub1::solve();
   }
   return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 484 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 1628 KB Output is correct
2 Correct 10 ms 1628 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 15 ms 1884 KB Output is correct
2 Correct 14 ms 1880 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 15 ms 1884 KB Output is correct
2 Correct 14 ms 1884 KB Output is correct
3 Correct 16 ms 2136 KB Output is correct
# 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 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 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 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 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 1 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 348 KB Output isn't correct
2 Halted 0 ms 0 KB -