結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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, 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);
    }

    int q;
    cin >> q;
    while(--q >= 0){
        int s, t, u, v;
        cin >> s >> t >> u >> v;

        while(s <= t){
            int m = t - s + 1;
            m = min(m, (s / 64 + 1) * 64 - s);
            m = min(m, (u / 64 + 1) * 64 - u);

            unsigned long long b = (a[s/64] >> (s % 64)) & ((1 << m) - 1);
            a[u/64] ^= b << (u % 64);

            s += m;
            u += m;
        }
    }

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

    return 0;
}
0