QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#735606#6348. Egor Has a Problemqtoq#WA 1ms3696kbC++172.3kb2024-11-11 20:55:242024-11-11 20:55:27

Judging History

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

  • [2024-11-11 20:55:27]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3696kb
  • [2024-11-11 20:55:24]
  • 提交

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;
}


詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3696kb

input:

6
2 6 11 21 47 120

output:

998243807
0
0
0
0
0

result:

wrong answer Token "998243807" doesn't correspond to pattern "NO|YES"