結果
問題 | No.142 単なる配列の操作に関する実装問題 |
ユーザー |
![]() |
提出日時 | 2021-10-28 08:18:59 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,486 ms / 5,000 ms |
コード長 | 1,205 bytes |
コンパイル時間 | 4,599 ms |
コンパイル使用メモリ | 253,204 KB |
最終ジャッジ日時 | 2025-01-25 08:00:35 |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 5 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:37:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 37 | scanf("%d %d %d %d",&s,&t,&u,&hoge); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>#include <bits/stdc++.h>#include <atcoder/all>using namespace atcoder;using mint = modint1000000007;using namespace std;#define rep(i,n) for (int i = 0; i < (n); ++i)#define Inf 1000000000000000000unsigned long long temp[2000];int main(){long long N,S,X,Y,Z;cin>>N>>S>>X>>Y>>Z;vector<long long> a(N);a[0] = S;rep(i,N-1){a[i+1] = X * a[i] + Y;a[i+1] %= Z;}int sz = (N+63)/64;vector<unsigned long long> v(sz,0);rep(i,N){if(a[i]%2==1){v[i/64] |= 1ULL<<(i%64);}}v.push_back(0);int Q;cin>>Q;rep(_,Q){int s,t,u,hoge;scanf("%d %d %d %d",&s,&t,&u,&hoge);s--;t--;u--;hoge--;int len = t-s+1;rep(i,(len+63)/64)temp[i] = 0;rep(i,len/64){temp[i] = (v[s/64 + i]>>(s%64));if(s%64!=0)temp[i] ^= (v[s/64+1 + i]<<(64-s%64));}rep(i,len%64){int ind = s + len/64 * 64 + i;if((v[ind/64]>>(ind%64))&1)temp[len/64] |= 1ULL<<i;}rep(i,(len+63)/64){//cout<<(bitset<64>)temp[i]<<endl;v[u/64 + i] ^= temp[i]<<(u%64);if(u%64!=0)v[u/64 + i + 1] ^= temp[i]>>(64-u%64);}}rep(i,N){int b = (v[i/64]>>(i%64))&1;if(b==0)printf("E");else printf("O");}cout<<endl;return 0;}