結果

問題 No.142 単なる配列の操作に関する実装問題
ユーザー imgry22imgry22
提出日時 2015-02-02 00:54:01
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,347 bytes
コンパイル時間 1,847 ms
コンパイル使用メモリ 144,880 KB
実行使用メモリ 21,108 KB
最終ジャッジ日時 2023-09-05 10:29:07
合計ジャッジ時間 16,989 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T1, class T2> inline void minup(T1& m, T2 x){ if(m>x) m=static_cast<T2>(x); }
template<class T1, class T2> inline void maxup(T1& m, T2 x){ if(m<x) m=static_cast<T2>(x); }

#define INF 1000000000
#define MOD 1000000007
#define EPS 1E-12

const int MAX_N = 2000000;
ll a[MAX_N];
ll b[MAX_N];
int n, s, q;
ll x, y, z;
ll t, u, v;

void generate(int n)
{
  a[0] = s;
  rep(i, n) a[i+1] = (x * a[i] % z + y) % z;
}

int main()
{
  cin >> n >> s >> x >> y >> z >> q;
  x %= z;
  y %= z;

  generate(n);

  while(q--){
    cin >> s >> t >> u >> v;
    s -= 1;  t -= 1;
    u -= 1;  v -= 1;

    int m = t - s;
    erep(i, 0, m) b[i] = a[i+s];
    erep(i, u, v) a[i] += b[i-u];
  }

  rep(i, n) cout << (a[i] & 1LL ? "O" : "E") << (i>=n-1 ? "\n" : "");

  return 0;
}
0