Submission #844513

# Submission time Handle Problem Language Result Execution time Memory
844513 2023-09-05T13:45:30 Z vjudge1 Spiderman (COCI20_spiderman) C++
0 / 70
1780 ms 20812 KB
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long a,b,c,d,e,p,h;
	map <long long, int> mp;
	vector <long long> arr;
	cin>>a>>c;
	p=a;
	h=0;
	while(a--){
		cin>>b;
		mp[b]++;
		arr.push_back(b);
		if(b > c){
			h++;
		}

		
	}
	for(long long i=0;p>i;i++){
		if(arr[i] <= 2*c){
			if(arr[i] == c){
				e=h;
			}
			else{
				e=0;
			}
		}
		else{
				e=0;
				d=arr[i];
				d-=c;
				if(mp[d] != 0  && (arr[i] % (d) == c)){
					e+=mp[d];
				}
				for(long long j=2; sqrt(d) >= j;j++){
					if(d % j == 0){
						e+=mp[j];
						e+=mp[d / j];
					}
					if(j == (d/j)){
						e-=mp[j];
					}
				}
			}
		cout<<e<<" ";
	}


	
}
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 1116 KB Output isn't correct
2 Incorrect 8 ms 604 KB Output isn't correct
3 Incorrect 349 ms 2124 KB Output isn't correct
4 Incorrect 1018 ms 4664 KB Output isn't correct
5 Incorrect 611 ms 11124 KB Output isn't correct
6 Incorrect 1763 ms 12576 KB Output isn't correct
7 Incorrect 690 ms 17372 KB Output isn't correct
8 Incorrect 715 ms 17164 KB Output isn't correct
9 Incorrect 1780 ms 20812 KB Output isn't correct
10 Incorrect 1692 ms 19672 KB Output isn't correct