답안 #844438

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
844438 2023-09-05T13:12:29 Z vjudge1 Spiderman (COCI20_spiderman) C++17
49 / 70
155 ms 19300 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;
int32_t main(){
	int n,k;cin>>n>>k;
	vector<int> arr(n);
	vector<int> say(1000023,0);
	for (int i = 0; i < n; i++){
		cin>>arr[i];
		say[arr[i]]++;
	}
	int alr = 0;
	for (int i = k+1; i < say.size(); i++){
		alr+=say[i];
	}
	alr*=say[k];
	vector<int> ans(say.size());
	for (int i = k+1; i < say.size(); i++){
		for (int j = i; j < say.size(); j+=i){
			ans[j]+=say[i];
		}
	}
	for (int i = 0; i < n; ++i)
	{
		if (arr[i]==k){
			cout<<alr<<" ";
			continue;
		}
		if (arr[i]<k){
			cout<<0<<" ";
			continue;
		}
		arr[i]-=k;
		cout<<ans[arr[i]]<<" ";
	}
	cout<<endl;
}

Compilation message

spiderman.cpp: In function 'int32_t main()':
spiderman.cpp:13:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |  for (int i = k+1; i < say.size(); i++){
      |                    ~~^~~~~~~~~~~~
spiderman.cpp:18:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |  for (int i = k+1; i < say.size(); i++){
      |                    ~~^~~~~~~~~~~~
spiderman.cpp:19:21: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |   for (int j = i; j < say.size(); j+=i){
      |                   ~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 15960 KB Output is correct
2 Correct 32 ms 16120 KB Output is correct
3 Incorrect 56 ms 17028 KB Output isn't correct
4 Correct 101 ms 19300 KB Output is correct
5 Incorrect 69 ms 16868 KB Output isn't correct
6 Incorrect 113 ms 19284 KB Output isn't correct
7 Correct 62 ms 16868 KB Output is correct
8 Correct 74 ms 16976 KB Output is correct
9 Correct 155 ms 19092 KB Output is correct
10 Correct 138 ms 19064 KB Output is correct