結果
| 問題 |
No.896 友達以上恋人未満
|
| コンテスト | |
| ユーザー |
kotamanegi
|
| 提出日時 | 2019-09-27 22:25:34 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 2,747 bytes |
| コンパイル時間 | 1,227 ms |
| コンパイル使用メモリ | 149,212 KB |
| 実行使用メモリ | 78,080 KB |
| 最終ジャッジ日時 | 2024-11-30 14:59:57 |
| 合計ジャッジ時間 | 6,076 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 6 RE * 1 |
ソースコード
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 1e-5
#define LONG_INF 1000000000000000000LL
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL
#define MOD 998244353LL
#define seg_size 262144*4
#define REP(a,b) for(long long a = 0;a < b;++a)
long long x[1001];
long long y[1001];
long long a[1001];
long long b[1001];
long long z[(1 << 23) + 1];
long long cnt[(1 << 20) + 1];
bool visited[(1 << 20) + 1];
long long mod;
long long calc_ans(long long now) {
if (now < (1 << 20) && visited[now] == 1) {
return cnt[now];
}
long long ans = 0;
for (long long q = 1; now * q < mod; ++q) {
ans += z[now * q];
}
if (now < 1 << 20) {
visited[now] = 1;
cnt[now] = ans;
}
return ans;
}
int main(){
#define int long long
long long m, n, mulX, addX, mulY, addY;
iostream::sync_with_stdio(false);
cin.tie(0);
cin >> m >> n >> mulX >> addX >> mulY >> addY >> mod;
REP(i, m) {
cin >> x[i];
}
REP(i, m) {
cin >> y[i];
}
REP(i, m) {
cin >> a[i];
}
REP(i, m) {
cin >> b[i];
}
long long now_x = x[m - 1];
long long now_y = y[m - 1];
long long now_a = a[m - 1];
long long now_b = b[m - 1];
for (int i = 0; i < n; ++i) {
if (i < m) {
now_x = x[i];
now_y = y[i];
now_a = a[i];
now_b = b[i];
}
else {
now_x = (now_x * mulX + addX) & (mod - 1);
now_y = (now_y * mulY + addY) & (mod - 1);
now_a = ((now_a * mulX + addX + mod - 1) & (mod - 1)) + 1;
now_b = ((now_b * mulY + addY + mod - 1) & (mod - 1)) + 1;
}
z[now_x] += now_y;
}
long long final_go = 0;
for (int i = 0; i < m; ++i) {
now_x = x[i];
now_y = y[i];
now_a = a[i];
now_b = b[i];
long long hoge = calc_ans(now_a) - calc_ans(now_a * now_b);
cout << hoge << endl;
final_go ^= hoge;
}
for (int i = m; i < n; ++i) {
now_x = (now_x * mulX + addX) & (mod - 1);
now_y = (now_y * mulY + addY) & (mod - 1);
now_a = ((now_a * mulX + addX + mod - 1) & (mod - 1)) + 1;
now_b = ((now_b * mulY + addY + mod - 1) & (mod - 1)) + 1;
long long hoge = calc_ans(now_a) - calc_ans(now_a * now_b);
final_go ^= hoge;
}
cout << final_go << endl;
}
kotamanegi