# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1053498 | 2024-08-11T12:38:54 Z | Dennis_Jason | Pairs (IOI07_pairs) | C++14 | 14 ms | 2136 KB |
#include <bits/stdc++.h> #define NMAX 100001 #define int long long #define pb push_back #define eb emplace_back #define MOD 1000000007 #define nl '\n' #define INF 1000000007 #define LLONG_MAX 9223372036854775807 #define pii pair<int,int> #define tpl tuple<int,int,int,int> //#pragma GCC optimize("O3") using namespace std; ifstream fin("aib.in"); ofstream fout("aib.out"); /* * * ----------------DEMONSTRATION------------------- ---------------------END------------------------ */ /*-------------Initialize------------*/ int b,n,d,m; int v[NMAX]; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin>>b>>n>>d>>m; if(b==1) { for(int i=1;i<=n;++i) { cin>>v[i]; } sort(v+1,v+1+n); int res=0; for(int i=1;i<=n;++i) { int st=i+1; int dr=n; int ans=-1; while(st<=dr) { int mid=(st+dr)/2; if(abs(v[i]-v[mid])<=d) { ans=mid; st=mid+1; } else dr=mid-1; } if(ans==-1) continue; res+=(ans-i); } cout<<res; } return 0; }
Compilation message
# | 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 | 0 ms | 484 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 1628 KB | Output is correct |
2 | Correct | 9 ms | 1636 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 14 ms | 1884 KB | Output is correct |
2 | Correct | 13 ms | 2080 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 13 ms | 1884 KB | Output is correct |
2 | Correct | 14 ms | 1884 KB | Output is correct |
3 | Correct | 13 ms | 2136 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 | 0 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 | 0 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 | 0 ms | 348 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 | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |