답안 #638140

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
638140 2022-09-04T18:43:54 Z Mr_Ph Spiderman (COCI20_spiderman) C++14
0 / 70
2000 ms 72796 KB
///Never gonna give you up.
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
typedef long long ll;
typedef long long int lli;
typedef unsigned long long ull;
using namespace std;
using namespace __gnu_pbds;
template<class x>
using ordered_set = tree<x, null_type,less<x>, rb_tree_tag,tree_order_statistics_node_update>;
const ll mod=(ll)1e9+7;
const ll mod1=998244353;
///the defines :)
#define endl '\n'
#define vi vector<int>
#define vll vector<ll>
#define ent(arr) for(int i=0;i<arr.size();i++)cin>>arr[i];
#define all(arr) arr.begin(),arr.end()
#define allr(arr) arr.rbegin(),arr.rend()
#define sz size()
#define int long long
///the end of the defines ;)
void bla()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("notsus.txt","w",stdout);
#endif
}
ll power(ll x,ll y)
{
    if(y==0)
        return 1;
    if(y==1)
        return x%mod;
    ll r=power(x%mod,(y%mod)/2)%mod;
    if(y%2)
        return ((r%mod)*(r%mod)*(x%mod));
    else
        return ((r%mod)*(r%mod));
}
ll lcm(ll a,ll b)
{
    return max(a,b)/__gcd(a,b)*min(a,b);
}
void preprocess(){}
void solve()
{
    int n,k;
    cin>>n>>k;
    map<int,int>mp;
    vi arr(n);
    ent(arr);
    map<int,int>mp1;
    int x=*max_element(all(arr));
    for(int i=0;i<n;i++)mp[arr[i]]++;
    for(int i=k+1;i<=x;i++)
    {
      for(int j=k;j<=x;j+=i)
        mp1[j]+=mp[i];
    }
    for(int i=0;i<n;i++)
      cout<<mp1[arr[i]]<<" "; 
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    preprocess();
    //bla();
    int t=1;
    //cin>>t;
    while(t--)
        solve();
}

Compilation message

spiderman.cpp: In function 'void solve()':
spiderman.cpp:18:31: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 | #define ent(arr) for(int i=0;i<arr.size();i++)cin>>arr[i];
      |                              ~^~~~~~~~~~~
spiderman.cpp:54:5: note: in expansion of macro 'ent'
   54 |     ent(arr);
      |     ^~~
spiderman.cpp: In function 'void bla()':
spiderman.cpp:27:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |     freopen("input.txt","r",stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
spiderman.cpp:28:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   28 |     freopen("notsus.txt","w",stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2078 ms 41212 KB Time limit exceeded
2 Execution timed out 2059 ms 50584 KB Time limit exceeded
3 Execution timed out 2088 ms 58616 KB Time limit exceeded
4 Execution timed out 2043 ms 54352 KB Time limit exceeded
5 Execution timed out 2086 ms 70608 KB Time limit exceeded
6 Execution timed out 2066 ms 72796 KB Time limit exceeded
7 Execution timed out 2084 ms 44456 KB Time limit exceeded
8 Execution timed out 2041 ms 54132 KB Time limit exceeded
9 Execution timed out 2083 ms 64608 KB Time limit exceeded
10 Execution timed out 2068 ms 59192 KB Time limit exceeded