Submission #844563

# Submission time Handle Problem Language Result Execution time Memory
844563 2023-09-05T14:09:42 Z vjudge1 Spiderman (COCI20_spiderman) C++
21 / 70
1036 ms 10184 KB
#include<bits/stdc++.h>
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	long long a,b,c,d,e,p,h;
	int mp[1000005];
	memset(mp,0,sizeof(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] <= c*2){
			if(arr[i] == c){
				e=h;
			}
			else{
				e=0;
			}
		}
		else{
				e=0;
				d=arr[i];
				d-=c;
				for(long long j=1; d >= (j*j);j++){
					if(d % j == 0 ){
						if(arr[i] % j == c){
							e+=mp[j];
						}
						if(arr[i] % (d / j) == c){
							e+=mp[d / j];
						}
						if(j*j == d){
							e-=mp[j];
						}
					}
					
				}
				if(c == 0){
					e-=1;
				}
			}

		cout<<e<<" ";
	}


	
}
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 4184 KB Output isn't correct
2 Incorrect 7 ms 4188 KB Output isn't correct
3 Correct 272 ms 5912 KB Output is correct
4 Incorrect 787 ms 9428 KB Output isn't correct
5 Correct 311 ms 5408 KB Output is correct
6 Correct 911 ms 8916 KB Output is correct
7 Incorrect 353 ms 5932 KB Output isn't correct
8 Incorrect 351 ms 5624 KB Output isn't correct
9 Incorrect 1036 ms 9256 KB Output isn't correct
10 Incorrect 1033 ms 10184 KB Output isn't correct