답안 #731626

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
731626 2023-04-27T16:59:21 Z vjudge1 Spiderman (COCI20_spiderman) C++14
14 / 70
2000 ms 4684 KB
#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)(2e5+5))
#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);
    for(int i = 1; i <= n; ++i)cin >> v[i];
    for(int i = 1; i <= n; ++i){
        int cur = 0;
        for(int j = 1; j <= n; ++j){
            if(j == i)continue;
            if(v[i] % v[j] == k)cur++;
        }
        cout << cur << ' ';
    }
    cout << endl;
}

Compilation message

spiderman.cpp: In function 'void fileio(std::string)':
spiderman.cpp:32:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |         freopen((s+string(".in")).c_str(),"r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
spiderman.cpp:33:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   33 |         freopen((s+string(".out")).c_str(),"w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 21 ms 340 KB Output is correct
2 Correct 21 ms 348 KB Output is correct
3 Execution timed out 2051 ms 1696 KB Time limit exceeded
4 Execution timed out 2029 ms 4420 KB Time limit exceeded
5 Execution timed out 2031 ms 1748 KB Time limit exceeded
6 Execution timed out 2056 ms 4580 KB Time limit exceeded
7 Execution timed out 2055 ms 1752 KB Time limit exceeded
8 Execution timed out 2039 ms 1748 KB Time limit exceeded
9 Execution timed out 2062 ms 4608 KB Time limit exceeded
10 Execution timed out 2044 ms 4684 KB Time limit exceeded