답안 #735177

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
735177 2023-05-03T16:38:39 Z DangerNoodle7591 Spiderman (COCI20_spiderman) C++17
56 / 70
2000 ms 15940 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 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;
    int cev=0;
    //cout<<arr[i]<<" "<<uwu<<endl;
    for(int j=1;j<=sqrt(arr[i]);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 9 ms 724 KB Output is correct
2 Correct 9 ms 596 KB Output is correct
3 Correct 387 ms 2120 KB Output is correct
4 Correct 1101 ms 4620 KB Output is correct
5 Incorrect 659 ms 8984 KB Output isn't correct
6 Execution timed out 2033 ms 10944 KB Time limit exceeded
7 Correct 728 ms 13252 KB Output is correct
8 Correct 822 ms 13288 KB Output is correct
9 Correct 1821 ms 15940 KB Output is correct
10 Correct 1825 ms 15888 KB Output is correct