結果
| 問題 | No.2308 [Cherry 5th Tune B] もしかして、真? |
| コンテスト | |
| ユーザー |
👑 tails
|
| 提出日時 | 2023-05-24 17:29:24 |
| 言語 | C90(gcc15) (gcc 15.2.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,475 bytes |
| 記録 | |
| コンパイル時間 | 119 ms |
| コンパイル使用メモリ | 26,880 KB |
| 最終ジャッジ日時 | 2026-02-24 01:14:00 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.c:16:14: error: expected ';' before 'void'
16 | static inline
| ^
| ;
17 | void fw_add(int a,int v){
| ~~~~
main.c: In function 'fw_build':
main.c:26:9: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
26 | for(int a=1;a<fwlim-1;++a){
| ^~~
main.c:26:9: note: use option '-std=c99', '-std=gnu99', '-std=c11' or '-std=gnu11' to compile your code
main.c: At top level:
main.c:31:14: error: expected ';' before 'int'
31 | static inline
| ^
| ;
32 | int fw_kth(int k){
| ~~~
main.c: In function 'fw_kth':
main.c:36:9: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
36 | for(int m=fwlim;m>>=1;){
| ^~~
main.c: In function 'main':
main.c:56:21: error: expected ';' before 'i'
56 | rep(i,n)fw[i]=1;
| ^
main.c:7:32: note: in definition of macro 'rep'
7 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
| ^
main.c:56:21: error: 'i' undeclared (first use in this function)
56 | rep(i,n)fw[i]=1;
| ^
main.c:7:36: note: in definition of macro 'rep'
7 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
| ^
main.c:56:21: note: each undeclared identifier is reported only once for each function it appears in
56 | rep(i,n)fw[i]=1;
| ^
main.c:7:36: note: in definition of macro 'rep'
7 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
| ^
main.c:58:21: error: expected ';' before 'i'
58 | rep(i,n){
| ^
main.c:7:32: note: in definition of macro 'rep'
7 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
| ^
main.c:68:21: error: expected ';' before
ソースコード
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
#define rd_init() char*rp=({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(typeof(e) v=0;v<e;++v)
typedef unsigned long ulong;
#define FWSIZE (1<<18)
int fw[FWSIZE];
int fwsize;
int fwlim;
static inline
void fw_add(int a,int v){
if(a==0){
fw[0]+=v;
}else{
while(fw[a]+=v,a+=a&-a,a<fwsize);
}
}
void fw_build(){
for(int a=1;a<fwlim-1;++a){
fw[a+(a&-a)]+=fw[a];
}
}
static inline
int fw_kth(int k){
k-=fw[0];
if(k<0)return 0;
int a=0;
for(int m=fwlim;m>>=1;){
if(fw[a+m]<=k){
k-=fw[a+m];
a+=m;
}
}
return a+1;
}
char wbuf[1<<25];
char x[1<<18],y[1<<18];
int main(){
rd_init();
rd_skip();
char*wp=wbuf;
while(*rp){
int n=rd();
fwsize=n;
for(fwlim=1;fwlim<n;fwlim<<=1);
rep(i,n)fw[i]=1;
fw_build();
rep(i,n){
int c=*rp;
if(c=='T'){
rp+=5;
x[i]=1;
}else{
rp+=6;
x[i]=0;
}
}
rep(i,n-1){
int c=*rp;
y[i+1]=c;
rp+=c=='o'?3:4;
}
rep(i,n-1){
int s=rd();
int a=fw_kth(s-1);
int b=fw_kth(s);
fw_add(b,-1);
if(y[b]=='a') x[a]&=x[b];
if(y[b]=='o') x[a]|=x[b];
if(y[b]=='x') x[a]^=x[b];
if(y[b]=='i') x[a]=!x[a]|x[b];
}
if(x[0]){
*(ulong*)wp=0x0a65757254l; // "True\n"
wp+=5;
}else{
*(ulong*)wp=0x0a65736c6146l; // "False\n"
wp+=6;
}
}
write(1,wbuf,wp-wbuf);
_exit(0);
}
tails