답안 #735203

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
735203 2023-05-03T17:23:23 Z DangerNoodle7591 Spiderman (COCI20_spiderman) C++17
56 / 70
1161 ms 6384 KB
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define ll long long
#define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);
//#define mod 1000000007
#define N 1000005
//#define big 1000000000000000007
int mp[N];
int main(){
  lalala;
  int n,k;cin>>n>>k;
  int cnt=0;
  int arr[n];
  //map<int,int> mp;
  for(int i=0;i<n;i++){
    cin>>arr[i];
    mp[arr[i]]++;
    if(arr[i]>k)cnt++;
  }
  for(int i=0;i<n;i++){
    if(arr[i]<k){cout<<"0 ";continue;}
    if(arr[i]==k){cout<<cnt<<" ";continue;}
    int uwu=arr[i]-k,   cev=0;
    //cout<<arr[i]<<" "<<uwu<<endl;
    for(int j=1;j<=sqrt(uwu);j++){
      if(uwu%j)continue;
      //cout<<cev<<" "<<j<<" "<<uwu/j<<" "<<mp[j]<<" "<<mp[uwu/j]<<endl;
      if(arr[i]%j==k){
        cev+=mp[j];
      }
      if(j*j!=uwu && arr[i]%(uwu/j)==k)cev+=mp[uwu/j];
    }cout<<cev<<" ";
  }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 2644 KB Output is correct
2 Correct 7 ms 1748 KB Output is correct
3 Correct 328 ms 3424 KB Output is correct
4 Correct 910 ms 4788 KB Output is correct
5 Incorrect 361 ms 4756 KB Output isn't correct
6 Incorrect 991 ms 6384 KB Output isn't correct
7 Correct 390 ms 4876 KB Output is correct
8 Correct 394 ms 4860 KB Output is correct
9 Correct 1161 ms 6180 KB Output is correct
10 Correct 1125 ms 6148 KB Output is correct