結果

問題 No.142 単なる配列の操作に関する実装問題
ユーザー mamekinmamekin
提出日時 2016-10-10 17:35:55
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,549 bytes
コンパイル時間 1,014 ms
コンパイル使用メモリ 105,536 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-01 18:56:28
合計ジャッジ時間 15,468 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

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

    vector<unsigned long long> tmp(n/64+1);
    int q;
    cin >> q;
    while(--q >= 0){
        int s, t, u, v;
        cin >> s >> t >> u >> v;

        int l = u / 64;
        int r = v / 64;
        for(int i=l; i<=r; ++i)
            tmp[i] = a[i];
        
        while(s <= t){
            int len = t - s + 1;
            len = min(len, (s / 64 + 1) * 64 - s);
            len = min(len, (u / 64 + 1) * 64 - u);

            unsigned long long b = (a[s/64] >> (s % 64)) & ((1LL << len) - 1);
            tmp[u/64] ^= b << (u % 64);
            s += len;
            u += len;
        }

        for(int i=l; i<=r; ++i)
            a[i] = tmp[i];
    }

    for(int i=1; i<=n; ++i){
        if(a[i/64] & (1LL << (i % 64)))
            cout << 'O';
        else
            cout << 'E';
    }
    cout << endl;

    return 0;
}
0