Submission #661445

# Submission time Handle Problem Language Result Execution time Memory
661445 2022-11-25T19:00:26 Z developerziya Pairs (IOI07_pairs) C++14
0 / 100
200 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 

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


}

Compilation message

pairs.cpp: In function 'int main()':
pairs.cpp:15:15: warning: 'n' is used uninitialized in this function [-Wuninitialized]
   15 | int ferq1[n*(n-1)/2],ferq2[n*(n-1)/2],ferq3[n*(n-1)/2],ferq[n*(n-1)/2];
      |             ~~^~~
# Verdict Execution time Memory Grader output
1 Runtime error 188 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 174 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 188 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 187 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 Runtime error 188 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 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 193 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 196 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 188 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 185 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 188 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 200 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -