답안 #634132

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
634132 2022-08-23T21:11:29 Z BidoTeima Spiderman (COCI20_spiderman) C++17
56 / 70
181 ms 17988 KB
/// isA AC
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void ACPLS()
{
#ifndef ONLINE_JUDGE
    freopen("output.txt", "w", stdout);
    freopen("input.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
void moo(string fileName){
    freopen((fileName+".in").c_str(),"r",stdin);
    freopen((fileName+".out").c_str(),"w",stdout);
}
#define tc         \
    int tttttt,subtask;    \
    cin >> tttttt /*>> subtask*/; \
    while (tttttt--)
#define sumrange(l, r, arr) (l == 0 ? arr[r] : arr[r] - arr[l - 1])
#define all(v) v.begin(), v.end()
ll f[(int)1e6+5], ans[(int)1e6+5];
int main()
{
    //ACPLS();    
    int n,k;
    cin>>n>>k;
    int a[n];
    for(int&i:a)cin>>i, f[i]++;
    for(int i = k + 1; i <= 1e6; i++){
        for(int j = k; j <= 1e6; j += i){
            ans[j] += f[i];
        }
    }
    for(int i : a)cout<<ans[i]<<' ';
}   

Compilation message

spiderman.cpp: In function 'void ACPLS()':
spiderman.cpp:8:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     freopen("output.txt", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
spiderman.cpp:9:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     freopen("input.txt", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
spiderman.cpp: In function 'void moo(std::string)':
spiderman.cpp:16:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |     freopen((fileName+".in").c_str(),"r",stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
spiderman.cpp:17:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |     freopen((fileName+".out").c_str(),"w",stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 10964 KB Output is correct
2 Correct 49 ms 9844 KB Output is correct
3 Correct 90 ms 11924 KB Output is correct
4 Correct 143 ms 13240 KB Output is correct
5 Incorrect 88 ms 16460 KB Output isn't correct
6 Incorrect 172 ms 17988 KB Output isn't correct
7 Correct 86 ms 16528 KB Output is correct
8 Correct 98 ms 16464 KB Output is correct
9 Correct 181 ms 17872 KB Output is correct
10 Correct 180 ms 17740 KB Output is correct