結果
| 問題 | No.2170 Left Addition Machine |
| コンテスト | |
| ユーザー |
👑 tails
|
| 提出日時 | 2022-12-22 11:54:42 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,608 bytes |
| 記録 | |
| コンパイル時間 | 1,645 ms |
| コンパイル使用メモリ | 27,008 KB |
| 最終ジャッジ日時 | 2025-01-18 07:48:24 |
| 合計ジャッジ時間 | 6,684 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.c: In function 'mkwd':
main.c:23:20: warning: multi-character character constant [-Wmultichar]
23 | unsigned v='0000';
| ^~~~~~
main.c:7:18: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
7 | #define rep(v,e) for(long v=0;v<e;++v)
| ^~~
main.c:25:9: note: in expansion of macro 'rep'
25 | rep(a,10){
| ^~~
main.c:7:18: note: use option '-std=c99', '-std=gnu99', '-std=c11' or '-std=gnu11' to compile your code
7 | #define rep(v,e) for(long v=0;v<e;++v)
| ^~~
main.c:25:9: note: in expansion of macro 'rep'
25 | rep(a,10){
| ^~~
main.c:7:18: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
7 | #define rep(v,e) for(long v=0;v<e;++v)
| ^~~
main.c:26:17: note: in expansion of macro 'rep'
26 | rep(b,10){
| ^~~
main.c:7:18: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
7 | #define rep(v,e) for(long v=0;v<e;++v)
| ^~~
main.c:27:25: note: in expansion of macro 'rep'
27 | rep(c,10){
| ^~~
main.c:7:18: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
7 | #define rep(v,e) for(long v=0;v<e;++v)
| ^~~
main.c:28:33: note: in expansion of macro 'rep'
28 | rep(d,10){
| ^~~
main.c: In function 'mkt':
main.c:7:18: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
7 | #define rep(v,e) for(long v=0;v<e;++v)
| ^~~
main.c:42:9: note: in expansion of macro 'rep'
42 | rep(i,200001){
| ^~~
main.c: In function 'main':
main.c:56:22: warning: conversion from 'long long unsigned int' to 'unsigned int' changes value from '1844674
ソースコード
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
#define getrp() ({char*mmap();mmap(0l,1l<<25,1,2,0,0ll);})
#define rd_skip() while(*rp++>=48)
#define rd() ({int _v=0,_c;while(_c=*rp++-48,_c>=0)_v=_v*10+_c;_v;})
#define rep(v,e) for(long v=0;v<e;++v)
#define rep3(v,s,e) for(long v=s;v<e;++v)
#define aaa(x) ({ulong _r=x;_r-(_r<MD?0:MD);})
#define aas(x) ({ulong _r=x;_r+(_r<MD?0:MD);})
#define MD 998244353
typedef unsigned long ulong;
unsigned a[200001];
unsigned b[200001];
unsigned t[200001];
int c[200001];
char wbuf[1<<25];
unsigned wd[10000];
void mkwd(){
unsigned v='0000';
long i=0;
rep(a,10){
rep(b,10){
rep(c,10){
rep(d,10){
wd[i++]=v;
v+=1<<24;
}
v+=(1<<16)-(10<<24);
}
v+=(1<<8)-(10<<16);
}
v+=(1<<0)-(10<<8);
}
}
void mkt(){
ulong x=1;
rep(i,200001){
t[i]=x;
x=x*(MD+1>>1)%MD;
}
}
int main(){
mkwd();
mkt();
char*rp=getrp();
long n=rd();
rd_skip();
{
ulong m=0;
a[0]=~0ull;
rep3(i,1,n+1){
ulong x=rd();
a[i]=x;
if(x<=a[i-1]){
b[i]=x;
c[i]=0;
m=1;
}else{
b[i]=(b[i-1]+x*m)%MD;
c[i]=c[i-1]+1;
m=aaa(m*2);
}
}
}
char*wp=wbuf;
while(*rp){
ulong l=rd()-1;
ulong r=rd();
unsigned z;
if(r-l==c[r]-c[l]){
z=(aas((int)(b[r]-b[l+1]))*t[c[l+1]]+a[l+1])%MD;
}else{
z=b[r];
}
if(z>=100000000){
*wp++=z/100000000+'0';
z%=100000000;
*(int*)wp=wd[z/10000];
wp+=4;
*(int*)wp=wd[z%10000];
wp+=4;
}else{
long n=0;
ulong d=0;
while(++n,d=d<<8|0x30|z%10,z/=10);
*(ulong*)wp=d;
wp+=n;
}
*wp++='\n';
}
write(1,wbuf,wp-wbuf);
_exit(0);
}
tails