Submission #844218

# Submission time Handle Problem Language Result Execution time Memory
844218 2023-09-05T11:36:48 Z vjudge1 Spiderman (COCI20_spiderman) C++17
14 / 70
2000 ms 4740 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);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 20 ms 344 KB Output is correct
2 Correct 19 ms 348 KB Output is correct
3 Execution timed out 2037 ms 1832 KB Time limit exceeded
4 Execution timed out 2003 ms 4552 KB Time limit exceeded
5 Execution timed out 2041 ms 1880 KB Time limit exceeded
6 Execution timed out 2045 ms 4712 KB Time limit exceeded
7 Execution timed out 2037 ms 2132 KB Time limit exceeded
8 Execution timed out 2021 ms 2128 KB Time limit exceeded
9 Execution timed out 2001 ms 4736 KB Time limit exceeded
10 Execution timed out 2023 ms 4740 KB Time limit exceeded