結果
| 問題 | 
                            No.142 単なる配列の操作に関する実装問題
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2022-06-20 10:53:51 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,603 bytes | 
| コンパイル時間 | 1,608 ms | 
| コンパイル使用メモリ | 171,068 KB | 
| 実行使用メモリ | 19,244 KB | 
| 最終ジャッジ日時 | 2024-10-12 21:51:10 | 
| 合計ジャッジ時間 | 12,738 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | WA * 5 | 
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
    unsigned long long n, s, x, y, z, b64 = 63;
    cin >> n >> s >> x >> y >> z;
    vector<unsigned long long> a(n);
    array<unsigned long long, 20000> v{}, temp{};
    a[0] = s;
    for(int i = 1; i < n; i++){
        a[i] = (x * a[i - 1] + y) % z;
    }
    int sz = (n + 63) / 64, q, S, T, U, V;
    for(int i = 0, j = 0, k = 0; i < n; i++){
        v[k] |= (a[i] & 1ULL) << j;
        if(++j == 64) j = 0, k++;
    }
    /*for(int i = 0; i < sz; i++){
        cerr << bitset<64>(v[i]) << ' ';
    }
    cerr << '\n';*/
    cin >> q;
    while(q--){
        cin >> S >> T >> U >> V;
        S--, U--;
        int len = T - S, r = ((len + 63) / 64), smod = S & b64, umod = U & b64;
        temp[len / 64] = 0;
        cerr << smod << ' ';
        for(int i = 0; i < len / 64; i++){
            temp[i] = v[S / 64 + i] >> smod;
            if(smod)temp[i] |= v[S / 64 + i + 1] << 64 - smod;
        }
        for(int i = 0, idx = S + len / 64 * 64; i < (len & b64); i++, idx++){
            if((v[idx / 64] >> (idx & b64)) & 1)temp[len / 64] |= 1ULL << i;
        }
        //cerr << bitset<64>(temp[0]) << '\n';
        for(int i = 0; i < r; i++){
			v[U / 64 + i] ^= temp[i] << umod;
			if(umod) v[U / 64 + i + 1] ^= temp[i] >> 64 - umod;
		}
        /*for(int i = 0; i < sz; i++){
            cerr << bitset<64>(v[i]) << ' ';
        }
        cerr << '\n';*/
    }
    for(int i = 0, j = 0, k = 0; i < n; i++){
        cout << (v[k] >> j & 1 ? 'O' : 'E');
        if(++j == 64)j = 0, k++;
    }
    cout << '\n';
}