結果
問題 | No.1142 XOR と XOR |
ユーザー |
![]() |
提出日時 | 2020-07-31 22:43:33 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,148 ms / 2,000 ms |
コード長 | 1,286 bytes |
コンパイル時間 | 1,983 ms |
コンパイル使用メモリ | 192,492 KB |
最終ジャッジ日時 | 2025-01-12 11:00:46 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
コンパイルメッセージ
main.cpp: In function ‘void solve()’: main.cpp:17:20: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 17 | int N,M,K;scanf("%d %d %d",&N,&M,&K); | ~~~~~^~~~~~~~~~~~~~~~~~~~~ main.cpp:22:19: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 22 | rep(i,N){scanf("%d",&A[i]);S[i+1]=S[i]^A[i];ct[S[i+1]]++;} | ~~~~~^~~~~~~~~~~~ main.cpp:28:19: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 28 | rep(i,M){scanf("%d",&B[i]);S[i+1]=S[i]^B[i];ct[S[i+1]]++;} | ~~~~~^~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;using ld = long double;#define rep(i, N) for (int i = 0; i < (int)(N); ++i)#define rrep(i, N) for (int i = (int)(N)-1; i >= 0; --i)#define debug(x) cout << #x << "=" << x << endl;constexpr int MOD=1000000007;constexpr ll INF = (1LL << 61) - 1;template <class T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}template <class T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;} return false;}template <typename T> void fail(T v){cout << v << endl;exit(0);}//templatevoid solve(){int N,M,K;scanf("%d %d %d",&N,&M,&K);int A[201010],B[201010],S[201010],ct[1<<10];ll D[1<<10];memset(ct,0,sizeof(ct));memset(D,0,sizeof(D));S[0]=0;rep(i,N){scanf("%d",&A[i]);S[i+1]=S[i]^A[i];ct[S[i+1]]++;}rep(i,N){rep(j,1<<10){D[j^S[i]]+=ct[j];}ct[S[i+1]]--;}memset(ct,0,sizeof(ct));rep(i,M){scanf("%d",&B[i]);S[i+1]=S[i]^B[i];ct[S[i+1]]++;}ll res=0;rep(i,M){rep(j,1<<10){res+=D[j^S[i]^K]*ct[j];if(res>=MOD)res%=MOD;}ct[S[i+1]]--;}cout<<res<<endl;}int main(){//cin.tie(0);//ios::sync_with_stdio(false);//cout << fixed << setprecision(20);solve();return 0;}