# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
844254 | vjudge1 | Spiderman (COCI20_spiderman) | C++17 | 175 ms | 17044 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<iostream>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<map>
#include<set>
#include<climits>
#include<numeric>
#include<queue>
#include<unordered_map>
#include<string>
#include<climits>
#include<unordered_set>
#include<bitset>
#include<cstring>
#include<cmath>
#include<stack>
#if 1
#define pb push_back
#define st first
#define nd second
#define endl '\n'
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define MAXN ((int)(1e6+23))
#define int long long int
using namespace std;
const int inf = 1e17 + 5;
#endif
void fileio(string s){
#ifndef ONLINE_JUDGE
freopen((s+string(".in")).c_str(),"r",stdin);
freopen((s+string(".out")).c_str(),"w",stdout);
#endif
}
signed main(){
//fileio("test");
//fio;
int n, k;
cin >> n >> k;
vector<int>v(n + 1);
map<int, int>m;
int z = 0;
for(int i = 1; i <= n; ++i){
cin >> v[i];
m[v[i]]++;
if(v[i] > k)z++;
}
vector<int>s(MAXN);
for(auto& p : m){
if(p.st <= k)continue;
for(int i = p.st; i <= MAXN; i += p.st){
s[i] += p.nd;
}
}
for(int i = 1; i <= n; ++i)v[i] -= k;
for(int i = 1; i <= n; ++i){
if(v[i] < 0){
cout << 0 << ' ';
}
else if(v[i] == 0){
cout << z << ' ';
}
else{
int res = s[v[i]];
if(!k)res--;
cout << res << ' ';
}
}
cout << endl;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |