답안 #844491

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
844491 2023-09-05T13:32:17 Z vjudge1 Spiderman (COCI20_spiderman) C++
0 / 70
143 ms 21964 KB
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long a,b,c,d,e,p,h;
	map <long long, long long> 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;
				int bol[300005];
				memset(bol,0,sizeof(bol));
				if(mp[1] != 0  && (arr[i] % (1) == c)){
					e+=mp[1];
					bol[1]=1;
				}
				if(bol[d] == 0 && mp[d] != 0  && (arr[i] % (d) == c)){
					e+=mp[d];
					bol[d]=1;
				}
				for(long long j=2; sqrt(d) >= j;j++){
					if(d % j == 0 && bol[j] == 0){
						e+=mp[j];
						bol[j]=1;
					}
					if(d % j== 0 && bol[d/j] == 0){
						e+=mp[d/j];
						bol[d/j]=1;
					}
				}
			}
		cout<<e<<" ";
	}


	
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 3164 KB Execution killed with signal 11
2 Runtime error 3 ms 2908 KB Execution killed with signal 11
3 Runtime error 27 ms 4808 KB Execution killed with signal 11
4 Runtime error 77 ms 9336 KB Execution killed with signal 11
5 Runtime error 54 ms 17096 KB Execution killed with signal 11
6 Runtime error 132 ms 21964 KB Execution killed with signal 11
7 Runtime error 54 ms 17092 KB Execution killed with signal 11
8 Runtime error 53 ms 17092 KB Execution killed with signal 11
9 Runtime error 127 ms 18876 KB Execution killed with signal 11
10 Runtime error 143 ms 19136 KB Execution killed with signal 11