Why the output in my local machine different than codeforces server?

Правка en1, от rStarx, 2022-01-21 19:17:08

This code generates '63' as the output for test case 7 of problem https://codeforces.me/problemset/problem/1616/C on my local machine but generates '64' when the codeforces server run it. How is this possible?

#include <bits/stdc++.h>
using namespace std;
#define int     int64_t
#define IOS     ios::sync_with_stdio(0); cin.tie(0);
 
 
signed main() {
    IOS;
    int t; cin >> t;
    while(t--) {
        // cout << "NEW TEST : " << t << "\n";
        int n; cin >> n;
        vector<double> a(n);
        for(auto &num : a) {
            cin >> num;
        }
        int gans = n + 2;
        for(int i=0;i<n;i++) {
            for(int j=i+1;j<n;j++) {
                
                
                double u = a[i];
                double v = a[j];
                double d = (v - u) / (j - i);
                int lans = 0;
                vector<double> new_array(n);
                new_array[i] = u;
                new_array[j] = v;
                for(int k=0;k<n;k++) {
                    if(k == i || k == j)
                        continue;
                    new_array[k] = u + (k - i) * d;
                }
                for(int k=0;k<n;k++) {
                    if(a[k] != new_array[k]) {
                        lans += 1;
                    }
                }
                gans = min(lans, gans);
            }
        }
        if(gans == (n + 2)) {
            gans = 0;
        }
        cout << gans << '\n';
    }
}

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский rStarx 2022-01-21 19:17:08 1597 Initial revision (published)