結果
問題 | No.1142 XOR と XOR |
ユーザー | saksham garg |
提出日時 | 2020-11-21 16:33:36 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 33 ms / 2,000 ms |
コード長 | 4,197 bytes |
コンパイル時間 | 2,350 ms |
コンパイル使用メモリ | 206,464 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-23 15:45:10 |
合計ジャッジ時間 | 3,799 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 3 ms
6,812 KB |
testcase_01 | AC | 3 ms
6,940 KB |
testcase_02 | AC | 3 ms
6,940 KB |
testcase_03 | AC | 33 ms
6,940 KB |
testcase_04 | AC | 25 ms
6,944 KB |
testcase_05 | AC | 21 ms
6,940 KB |
testcase_06 | AC | 26 ms
6,940 KB |
testcase_07 | AC | 25 ms
6,944 KB |
testcase_08 | AC | 31 ms
6,940 KB |
testcase_09 | AC | 31 ms
6,940 KB |
testcase_10 | AC | 31 ms
6,940 KB |
testcase_11 | AC | 3 ms
6,944 KB |
testcase_12 | AC | 3 ms
6,940 KB |
testcase_13 | AC | 3 ms
6,940 KB |
testcase_14 | AC | 17 ms
6,940 KB |
testcase_15 | AC | 18 ms
6,940 KB |
testcase_16 | AC | 4 ms
6,944 KB |
testcase_17 | AC | 19 ms
6,940 KB |
testcase_18 | AC | 7 ms
6,940 KB |
testcase_19 | AC | 25 ms
6,940 KB |
testcase_20 | AC | 18 ms
6,944 KB |
testcase_21 | AC | 11 ms
6,944 KB |
testcase_22 | AC | 9 ms
6,940 KB |
testcase_23 | AC | 24 ms
6,940 KB |
testcase_24 | AC | 27 ms
6,944 KB |
testcase_25 | AC | 16 ms
6,944 KB |
testcase_26 | AC | 25 ms
6,940 KB |
testcase_27 | AC | 20 ms
6,944 KB |
ソースコード
//FIRST THINK THEN CODE. #include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i,a,b) for(ll i=a;i<b;++i) #define rrep(i,a,b) for(ll i=a;i>b;--i) #define FOR(i,n) for(ll i=0;i<n;i++) #define vi vector<int> #define vl vector<ll> #define ld long double #define vld vector<ld> #define vvi vector<vector<int>> #define vvl vector<vector<long long>> #define vvld vector<vector<ld>> #define pii pair<int,int> #define pll pair<long,long> #define vpii vector<pii> #define vpll vector<pll> #define ff first #define ss second #define pb push_back #define pf push_front #define mp make_pair #define lb lower_bound #define ub upper_bound #define bs binary_search #define d1(x) cout<<(x)<<endl #define d2(x,y) cout<<(x)<<" "<<(y)<<endl #define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl #define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl #define PI 3.1415926535897932384626433832795 #define fix(f,n) fixed<<setprecision(n)<<f #define all(x) x.begin(),x.end() #define rev(p) reverse(p.begin(),p.end()); #define endl "\n" #define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define popcount(x) __builtin_popcountll(x) #define sz(x) ((ll)x.size()) const ll M = 1000000007; const ll MM = 998244353; ll begtime = clock(); #define end_routine() cerr << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n"; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); //#define trace(...) #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << endl; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...); } template<typename T, typename F> void chmax( T &a, F b) { if (b > a)a = b; } template<typename T, typename F> void chmin( T &a, F b) { if (b < a)a = b; } /* if you want to multiply 2 64 bit numbers mod c. i.e a*b%c. this function will help in preventing "overflow". */ ll mulmod(ll a, ll b, ll c) { ll ans = 0; ll y = a % c; while (b) { if (b & 1) { (ans += y) %= c; } y = y * 2 % c; b >>= 1; } return ans; } ll powM(ll a, ll b, ll m) { if (b < 0)return 0; if (a <= 0)return 0; a %= m; ll ans = 1LL; while (b) { if (b & 1)ans = ans * a % m; //ans = mulmod(ans, a, m); a = a * a % m; //a = mulmod(a, a, m); b >>= 1; } return ans; } ll powMbig(ll a, ll b, ll m) { if (a <= 0)return 0; a %= m; ll ans = 1LL; while (b) { if (b & 1)//ans = ans * a % m; ans = mulmod(ans, a, m); //a = a * a % m; a = mulmod(a, a, m); b >>= 1; } return ans; } ll poww(ll a, ll b) { ll ans = 1; while (b) { if (b & 1)ans = ans * a; a = a * a; b >>= 1; } return ans; } string tostring(ll x) { stringstream sss; sss << x; string ans = sss.str(); return ans; } const ll N = 1e6 + 5; ll gandu(ll c) { return (c * (c - 1) / 2); } int main() { IOS; #ifndef ONLINE_JUDGE freopen("input1.txt", "r", stdin); freopen("output1.txt", "w", stdout); #endif ll n, m, k; cin >> n >> m >> k; vl a(n); ll s1 = 0; vl f1(2100); f1[0] = 1; FOR(i, n) { ll x; cin >> x; s1 ^= x; f1[s1]++; } ll s2 = 0; vl f2(2100); f2[s2] = 1; FOR(i, m) { ll x; cin >> x; s2 ^= x; f2[s2]++; } vl f3(2100), f4(2100); for (ll i = 0; i < 1025; i++) { for (ll j = i; j < 1025; j++) { if (i == j)(f3[0] += gandu(f1[i])); else (f3[i ^ j] += f1[i] * f1[j] ); // if (f3[i ^ j] > M)f3[i ^ j] -= M; } } //FOR(i, 4)d2(i, f3[i]); for (ll i = 0; i < 1025; i++) { for (ll j = i; j < 1025; j++) { if (i == j)(f4[0] += gandu(f2[i])); else (f4[i ^ j] += f2[i] * f2[j] ); //if (f4[i ^ j] > M)f4[i ^ j] -= M; } } ll ans = 0; FOR(i, 1024)f3[i] %= M, f4[i] %= M; for (ll i = 0; i < 1025; i++) { ans = (ans + f3[i] * f4[i ^ k]) % M; } cout << ans << endl; end_routine(); return 0; }