Loading [MathJax]/jax/output/HTML-CSS/fonts/TeX/fontdata.js

Inconsistent output for 2037 B. Intercepted Inputs

Правка en1, от Ayariyanam, 2024-11-17 20:51:26

There is an inconsistency in output in my system and codeforces environment. Following is my implementation. https://mirror.codeforces.com/contest/2037/submission/292083626 Test case 1: 2 1 4 5 3 3 my output is shown as 2 2 but when I run it else anywhere (online and my machine) its giving 1 4. Can anyone help me ```

#include <bits/stdc++.h>
    using namespace std;

    struct custom_hash {
        static uint64_t splitmix64(uint64_t x) {
            x += 0x9e3779b97f4a7c15;
            x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
            x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
            return x ^ (x >> 31);
        }

        size_t operator()(uint64_t x) const {
            static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
            return splitmix64(x + FIXED_RANDOM);
        }
    };

    void solve(){
        int len;
        cin>>len;
        vector<int> v(len);
        for(auto& x: v) cin>>x;
        int target=len-2;
        unordered_map<int, int, custom_hash> umap;
        for(auto x: v){
            if (target%x!=0) continue;
            umap[x]++;
        }
        for (auto& it: umap){
            int num = it.first;
            int second=target/num;
            if ((second==num) && (it.second>1)){
                cout<<num<<" "<<num<<endl;
                return;
            }
            else if (umap.find(second) !=umap.end()){
                cout<<num<<" "<<second<<endl;
                return;
            }
        }
    }

    int main(){
      int testNum;
      cin >> testNum;

      while(testNum--){
        solve();
      }
    }

```

Can anyone help me understand what is going wrong here?

Теги help, wrong ouput

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский Ayariyanam 2024-11-17 20:53:22 6
en2 Английский Ayariyanam 2024-11-17 20:52:49 34
en1 Английский Ayariyanam 2024-11-17 20:51:26 2027 Initial revision (published)