# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
334022 | 2020-12-08T06:20:13 Z | ronnith | Spiderman (COCI20_spiderman) | C++14 | 1286 ms | 8428 KB |
#include <bits/stdc++.h> typedef long long ll; #define mk make_pair #define f first #define s second using namespace std; int main(){ int n, k; scanf("%d%d", &n,&k); int h[n]; int mx = 0; for(int i = 0;i < n;i ++){ scanf("%d", &h[i]); mx = max(mx, h[i]); } int fr[mx + 1]; fill(fr, fr + mx + 1, 0); int cnt = 0; for(int i = 0;i < n;i ++){ if(h[i] > k){ fr[h[i]] ++; cnt ++; } } for(int i = 0;i < n;i ++){ int fac = h[i] - k; if(fac == 0){ printf("%d ", cnt); } else { int ans = 0; for(int j = 1;j * j <= fac;j ++){ if(fac % j == 0){ ans += fr[j]; if(j * j != fac)ans += fr[fac / j]; } } if(fac % h[i] == 0)ans --; printf("%d ", ans); } } puts(""); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 10 ms | 4204 KB | Output isn't correct |
2 | Incorrect | 9 ms | 4204 KB | Output isn't correct |
3 | Correct | 338 ms | 5612 KB | Output is correct |
4 | Incorrect | 986 ms | 8320 KB | Output isn't correct |
5 | Correct | 384 ms | 5484 KB | Output is correct |
6 | Correct | 1130 ms | 8428 KB | Output is correct |
7 | Incorrect | 433 ms | 5484 KB | Output isn't correct |
8 | Incorrect | 436 ms | 5484 KB | Output isn't correct |
9 | Incorrect | 1286 ms | 8188 KB | Output isn't correct |
10 | Incorrect | 1282 ms | 8300 KB | Output isn't correct |