結果

問題 No.142 単なる配列の操作に関する実装問題
ユーザー masamasa
提出日時 2015-02-02 00:16:20
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 869 bytes
コンパイル時間 2,651 ms
コンパイル使用メモリ 64,728 KB
実行使用メモリ 23,684 KB
最終ジャッジ日時 2023-09-05 10:03:28
合計ジャッジ時間 16,503 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3,256 ms
19,552 KB
testcase_01 TLE -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>

using namespace std;
template <class T>
void show(T &a, string sep = " ") {
	for (auto it = a.begin(); it != a.end(); it++) {
		cout << *it << sep;
	}
	cout << endl;
}

int main() {
	long long n, s, x, y, z, q;

	cin >> n >> s >> x >> y >> z;
	vector<long long> a(n, 0);
	a[0] = s;
	for (int i = 0; i < n; i++) {
		a[i + 1] = (x * a[i] + y) % z;
	}
	// show(a);

	cin >> q;
	long long ss, tt, uu, vv;
	for (int i = 0; i < q; i++) {
		cin >> ss >> tt >> uu >> vv;
		vector<int> b(a.begin() + ss - 1, a.begin() + tt);
		// show(b);
		// printf("%d %lld %d\n", b.size(), vv - uu, b[0]);

		for (int j = uu - 1; j <= vv - 1; j++) {
			a[j] += b[j - uu + 1];
		}
		// show(a);
	}

	for (int i = 0; i < n; i++) {
		cout << (a[i] % 2 ? "O" : "E");
	}
	cout << endl;
	return 0;
}
0