QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#735608#6346. Record Parityqtoq#WA 0ms3564kbC++172.3kb2024-11-11 20:55:452024-11-11 20:55:45

Judging History

你现在查看的是最新测评结果

  • [2024-11-11 20:55:45]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3564kb
  • [2024-11-11 20:55:45]
  • 提交

answer

#include <bits/stdc++.h>


using namespace std;

template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { os << '{'; string sep; for (const T &x : v) os << sep << x, sep = ", "; return os << '}'; }
 void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }
#ifdef ONPC
  #define deb(...) cerr << '[' << __FILE__ << ':' << __LINE__ << "] (" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
  #pragma GCC optimize("O3,unroll-loops")
  #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
  #define deb(...)
#endif

// c++ short types
#define vt vector
//typedef long long ll;
typedef long double ld;

void whattime() { cout << "finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec" << endl; }
// const int mod = 1e9 + 7;
const int mod = 998244353;
const int inf = 1e9;
const int64_t infll = 1e13;
bool debug = false;
const ld eps = 1e-9;
const ld pi = acos(-1);
mt19937_64 rng((int) chrono::steady_clock::now().time_since_epoch().count());

int64_t det(vt<vt<int64_t>> a) {
  int64_t ans = 1;
  int n = (int)a.size();
  for(int i = 0; i < n; ++i) {
    for(int j = i + 1; j < n; ++j) {
      while(a[j][i] != 0) {
        long long t = a[i][i] / a[j][i];
        if(t) {
          for(int k = i; k < n; ++k) {
            a[i][k] = (a[i][k] - a[j][k] * t) % mod;
          }
        }
        swap(a[i], a[j]);
        ans *= -1;
      }
    }
    ans = ans * a[i][i] % mod;
    if(!ans) {
      return 0;
    }
  }
  return (ans + mod) % mod;
}

void solve() {
  int n; cin >> n;
  vt<int64_t> a(n), b(n);
  for(int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for(int i = 0; i < n; ++i) {
    cin >> b[i];
  }
  if(n > 60) {
    cout << "0\n";
    return ;
  }
  vt<vt<int64_t>> A(n, vt<int64_t>(n));
  for(int i = 0; i < n; ++i) {
    for(int j = 0; j < n; ++j) {
      A[i][j] = (a[i] ^ b[j]) % mod;
    }
  }
  cout << det(A) << '\n';
}

int main()
{
	ios::sync_with_stdio(false); cin.tie(nullptr);

	int tt = 1;;
	if(debug) {
		tt = 1e3;
	} else {
		cin >> tt;
	}

	for(int t = 0; t < tt; ++t) {
		solve();
	}
	
#ifdef ONPC
	whattime();
#endif
	
	return 0;
}


Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3564kb

input:

5 2
4 1 2 5 3

output:

21
0
0
0
0

result:

wrong answer 1st numbers differ - expected: '3', found: '21'