답안 #198405

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
198405 2020-01-25T22:43:17 Z ZwariowanyMarcin Spiderman (COCI20_spiderman) C++14
63 / 70
136 ms 12152 KB
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define ss(x) (int) x.size()
#define pb push_back
#define LL long long
#define ld long double
#define cat(x) cerr << #x << " = " << x << endl
#define FOR(i, j, n) for(int i = j; i <= n; ++i)
#define boost cin.tie(0), ios_base::sync_with_stdio(0);


using namespace std;		

const int nax = 1e6 + 100;

int n, k;
int a[nax];
int w[nax];

int res[nax];

int main() {
	scanf ("%d%d", &n, &k);
	for (int i = 1; i <= n; ++i) {
		scanf ("%d", a + i);
		w[a[i]]++;
	}
	
	for (int i = 1; i < nax; ++i) {
		if (!w[i] || i <= k) continue;
		for (int j = k; j < nax; j += i)
			res[j] += w[i];
		if (!k) res[i] -= w[i];
	}
	
	for (int i = 1; i <= n; ++i)
		printf ("%d ", res[a[i]]);
	
	
	
			
	return 0;
}

Compilation message

spiderman.cpp: In function 'int main()':
spiderman.cpp:25:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf ("%d%d", &n, &k);
  ~~~~~~^~~~~~~~~~~~~~~~
spiderman.cpp:27:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf ("%d", a + i);
   ~~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 6524 KB Output is correct
2 Correct 19 ms 5624 KB Output is correct
3 Correct 48 ms 7928 KB Output is correct
4 Correct 95 ms 10460 KB Output is correct
5 Correct 77 ms 9464 KB Output is correct
6 Incorrect 136 ms 12024 KB Output isn't correct
7 Correct 67 ms 9560 KB Output is correct
8 Correct 75 ms 9596 KB Output is correct
9 Correct 132 ms 12152 KB Output is correct
10 Correct 135 ms 12024 KB Output is correct