Submission #735004

# Submission time Handle Problem Language Result Execution time Memory
735004 2023-05-03T11:06:12 Z DangerNoodle7591 Spiderman (COCI20_spiderman) C++17
0 / 70
2000 ms 21012 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 arr[n];
  map<int,int> mp;
  int kac[n];
  
  for(int i=0;i<n;i++){
    cin>>arr[i];mp[arr[i]]++;
    kac[i]=0;
  }
  int yer[N];
  int iii=1;
  for(auto u:mp){
    yer[u.first]=iii;
    iii++;
  }
  for(int owo=0;owo<n;owo++){
    int uwu;
    if(k>arr[owo]){
      uwu=arr[owo];
    }
    if(k==arr[owo]){
      kac[owo]=iii-yer[arr[owo]]-1;continue;
    }
    if(k<arr[owo]){
      uwu=arr[owo]-k;
    }
    for(int i=1;i<=sqrt(uwu);i++){
      if(i*i==uwu&& arr[owo]%i){
        kac[owo]+=mp[i];break;
      }
      if(uwu%i==0){
        kac[owo]+=(mp[i]+mp[uwu/i]);
        if(arr[owo]%i==0)kac[owo]-=mp[i];
        if(arr[owo]%(uwu/i)==0)kac[owo]-=mp[uwu/i];
      }
    }
  }
  
  for(int i=0;i<n;i++){
    cout<<kac[i]<<" ";
  }
  
}

Compilation message

spiderman.cpp: In function 'int main()':
spiderman.cpp:27:9: warning: 'uwu' may be used uninitialized in this function [-Wmaybe-uninitialized]
   27 |     int uwu;
      |         ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 4692 KB Output isn't correct
2 Incorrect 10 ms 4436 KB Output isn't correct
3 Incorrect 383 ms 6476 KB Output isn't correct
4 Incorrect 1126 ms 9952 KB Output isn't correct
5 Incorrect 720 ms 13084 KB Output isn't correct
6 Execution timed out 2056 ms 15064 KB Time limit exceeded
7 Incorrect 898 ms 17568 KB Output isn't correct
8 Incorrect 878 ms 17628 KB Output isn't correct
9 Execution timed out 2048 ms 20088 KB Time limit exceeded
10 Execution timed out 2059 ms 21012 KB Time limit exceeded