結果

問題 No.142 単なる配列の操作に関する実装問題
コンテスト
ユーザー testestest
提出日時 2015-12-13 18:39:28
言語 C90
(gcc 12.4.0)
コンパイル:
gcc-12 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 2,177 ms / 5,000 ms
コード長 524 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 336 ms
コンパイル使用メモリ 30,920 KB
最終ジャッジ日時 2026-02-23 20:02:28
ジャッジサーバーID
(参考情報)
judge3 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:2:1: warning: data definition has no type or storage class
    2 | n,p,s,x,y,z,i,j;
      | ^
main.c: In function ‘main’:
main.c:6:1: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch]
    6 | scanf("%d%d%d%d%d",&n,&s,&x,&y,&z);
      | ^~~~~
main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
  +++ |+#include <stdio.h>
    1 | unsigned a[70000],temp[4000];

ソースコード

diff #
raw source code

unsigned a[70000],temp[4000];
n,p,s,x,y,z,i,j;
long t;

main(){
scanf("%d%d%d%d%d",&n,&s,&x,&y,&z);

a[0]=s&1<<1;t=s;
for(i=2;i<=n;i++){
t=(t*x+y)%z;
a[i>>5]|=(t&1)<<(i&31);
}

scanf("%*d");

for(;~scanf("%d%d%d%*d",&s,&x,&y);){

x-=s-1;
p=s&31;z=32-p;
for(i=0,j=s>>5;i<<5<x;i++,j++){temp[i]=a[j]>>p;p?temp[i]|=a[j+1]<<z:0;}
z=32-(x&31);
temp[i-1]=temp[i-1]<<z>>z;

p=y&31;z=32-p;
for(i=0,j=y>>5;i<<5<x;i++,j++){a[j]^=temp[i]<<p;p?a[j+1]^=temp[i]>>z:0;}
}


for(i=1;i<=n;i++)putchar((a[i>>5]>>(i&31))&1?'O':'E');
return 0;
}
0