Submission #1040413

# Submission time Handle Problem Language Result Execution time Memory
1040413 2024-08-01T03:41:28 Z tamir1 Pairs (IOI07_pairs) C++17
30 / 100
68 ms 9740 KB
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ordered_set tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
using namespace __gnu_pbds;
ordered_set s;
ll b,n,m,d,i,j,x[100010],y[100010],z[100010];
ll ans;
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin >> b >> n >> d >> m;
	if(b==1) for(i=1;i<=n;i++) cin >> x[i],s.insert(x[i]);
	if(b==2) for(i=1;i<=n;i++) cin >> x[i] >> y[i];
	if(b==3) for(i=1;i<=n;i++) cin >> x[i] >> y[i] >> z[i];
	if(b==1){
		for(i=1;i<=n;i++){
			ans=ans+s.order_of_key(x[i]+d+1)-s.order_of_key(x[i]-d)-1;
		}
	}
	cout << ans/2;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2520 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 67 ms 9264 KB Output is correct
2 Correct 43 ms 9124 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 64 ms 9512 KB Output is correct
2 Correct 37 ms 9684 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 68 ms 9740 KB Output is correct
2 Correct 54 ms 9564 KB Output is correct
3 Correct 50 ms 9672 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Incorrect 0 ms 2396 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 3144 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 3160 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 3676 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 3420 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 3440 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 3576 KB Output isn't correct
2 Halted 0 ms 0 KB -