# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
844428 | 2023-09-05T13:09:29 Z | vjudge1 | Spiderman (COCI20_spiderman) | C++17 | 1095 ms | 11532 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]; for (int i = 0; i < n; ++i) { if (arr[i]==k){ cout<<alr<<" "; continue; } if (arr[i]<k){ cout<<0<<" "; continue; } arr[i]-=k; int ans = 0; for (int j = 1; j*j <= arr[i]; j++){ if (arr[i]%j) continue; if (j>k) ans+=say[j]; if (arr[i]/j>k && arr[i]/j!=j) ans+=say[arr[i]/j]; } cout<<ans<<" "; } cout<<endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 8280 KB | Output is correct |
2 | Correct | 7 ms | 8284 KB | Output is correct |
3 | Incorrect | 288 ms | 9292 KB | Output isn't correct |
4 | Correct | 823 ms | 11532 KB | Output is correct |
5 | Incorrect | 322 ms | 9208 KB | Output isn't correct |
6 | Incorrect | 953 ms | 11500 KB | Output isn't correct |
7 | Correct | 370 ms | 9296 KB | Output is correct |
8 | Correct | 371 ms | 9052 KB | Output is correct |
9 | Correct | 1084 ms | 11476 KB | Output is correct |
10 | Correct | 1095 ms | 11340 KB | Output is correct |