Submission #661440

# Submission time Handle Problem Language Result Execution time Memory
661440 2022-11-25T18:47:45 Z developerziya Pairs (IOI07_pairs) C++14
29 / 100
211 ms 524288 KB
#include<stdio.h>
#include<iostream>
#include<vector>
using namespace std;
int main (){
/*
lovhe novu b  INT
heyvanlarin sayi n INT
en boyuk mesafe d LONG LONG 
lohhenin olcusu m INT 
kordinatlar ---->A[i] B[i][i] C[i][i] INT 

*/
long long b,n,m,i,j;
long long say=0;
long long s=0;
long long d;
cin>>b>>n>>d>>m;
int A[n];
long long ferq [n*(n-1)/2];
if(b==1){
	for(i=0;i<n;i++) cin>>A[i];
    for(i=0;i<n;i++){
    	for(j=i+1;j<n;j++) {
    	
    		ferq[s]=A[i]-A[j];
		
    		s++;
		}
	}
for(i=0;i<s;i++){
	if(ferq[i]<0) ferq[i]=-1*ferq[i]	;
	 if(ferq[i]<=d) say++;
}
cout<<say;
}	
long long ferq1[n*(n-1)/2],ferq2[n*(n-1)/2],ferq3[n*(n-1)/2];
int r,t,Y[n],X[n],Z[n],q;
if(b==2){
	
	for(i=0;i<n;i++){
	cin>>r>>t;	
	Y[i]=r;
	X[i]=t;
	} 
    for(i=0;i<n;i++){
    	for(j=i+1;j<n;j++) {
    		ferq1[s]=X[i]-X[j];
		    ferq2[s]=Y[i]-Y[j];
    		s++;
		}
	}
for(i=0;i<s;i++) ferq[i]=abs(ferq1[i])+abs(ferq2[i]);

for(i=0;i<s;i++)	if(ferq[i]<=d) say++;
cout<<say;
}
/*
long long ferq1[n*(n-1)/2],ferq2[n*(n-1)/2];
int r,t,Y[n],X[n],q;
*/
if(b==3){
	for(i=0;i<n;i++){
	cin>>r>>t>>q;	
	Y[i]=r;
	X[i]=t;
	Z[i]=q;
	} 
    for(i=0;i<n;i++){
    	for(j=i+1;j<n;j++) {
    		ferq1[s]=X[i]-X[j];
		    ferq2[s]=Y[i]-Y[j];
		    ferq3[s]=Z[i]-Z[j];
    		s++;
		}
	}
for(i=0;i<s;i++) ferq[i]=abs(ferq1[i])+abs(ferq2[i])+abs(ferq3[i]);

for(i=0;i<s;i++)	if(ferq[i]<=d) say++;
cout<<say;
}


}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 15956 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 189 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 194 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 193 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 10 ms 15828 KB Output is correct
2 Correct 10 ms 15828 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 191 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 199 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 192 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 10 ms 15828 KB Output is correct
2 Correct 10 ms 15828 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 190 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 191 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 211 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -