結果
問題 | No.2927 Reverse Polish Equation |
ユーザー | tails |
提出日時 | 2024-10-16 20:16:12 |
言語 | C90 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 16 ms / 2,000 ms |
コード長 | 1,251 bytes |
コンパイル時間 | 308 ms |
コンパイル使用メモリ | 24,704 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-16 20:16:15 |
合計ジャッジ時間 | 2,022 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
5,248 KB |
testcase_01 | AC | 1 ms
5,248 KB |
testcase_02 | AC | 1 ms
5,248 KB |
testcase_03 | AC | 0 ms
5,248 KB |
testcase_04 | AC | 0 ms
5,248 KB |
testcase_05 | AC | 1 ms
5,248 KB |
testcase_06 | AC | 0 ms
5,248 KB |
testcase_07 | AC | 1 ms
5,248 KB |
testcase_08 | AC | 1 ms
5,248 KB |
testcase_09 | AC | 0 ms
5,248 KB |
testcase_10 | AC | 1 ms
5,248 KB |
testcase_11 | AC | 0 ms
5,248 KB |
testcase_12 | AC | 3 ms
5,248 KB |
testcase_13 | AC | 4 ms
5,248 KB |
testcase_14 | AC | 3 ms
5,248 KB |
testcase_15 | AC | 4 ms
5,248 KB |
testcase_16 | AC | 2 ms
5,248 KB |
testcase_17 | AC | 5 ms
5,248 KB |
testcase_18 | AC | 6 ms
5,248 KB |
testcase_19 | AC | 1 ms
5,248 KB |
testcase_20 | AC | 5 ms
5,248 KB |
testcase_21 | AC | 8 ms
5,248 KB |
testcase_22 | AC | 1 ms
5,248 KB |
testcase_23 | AC | 1 ms
5,248 KB |
testcase_24 | AC | 0 ms
5,248 KB |
testcase_25 | AC | 0 ms
5,248 KB |
testcase_26 | AC | 1 ms
5,248 KB |
testcase_27 | AC | 7 ms
5,248 KB |
testcase_28 | AC | 7 ms
5,248 KB |
testcase_29 | AC | 2 ms
5,248 KB |
testcase_30 | AC | 8 ms
5,248 KB |
testcase_31 | AC | 1 ms
5,248 KB |
testcase_32 | AC | 2 ms
5,248 KB |
testcase_33 | AC | 4 ms
5,248 KB |
testcase_34 | AC | 5 ms
5,248 KB |
testcase_35 | AC | 2 ms
5,248 KB |
testcase_36 | AC | 6 ms
5,248 KB |
testcase_37 | AC | 3 ms
5,248 KB |
testcase_38 | AC | 9 ms
5,248 KB |
testcase_39 | AC | 4 ms
5,248 KB |
testcase_40 | AC | 8 ms
5,248 KB |
testcase_41 | AC | 6 ms
5,248 KB |
testcase_42 | AC | 14 ms
5,248 KB |
testcase_43 | AC | 16 ms
5,248 KB |
testcase_44 | AC | 16 ms
5,248 KB |
testcase_45 | AC | 13 ms
5,248 KB |
コンパイルメッセージ
main.c: In function ‘main’: main.c:14:18: warning: initialization of ‘char *’ from incompatible pointer type ‘long int (*)(long int)’ [-Wincompatible-pointer-types] 14 | char*fwp=f; | ^ main.c:15:9: warning: implicit declaration of function ‘memcpy’ [-Wimplicit-function-declaration] 15 | memcpy(fwp,"\xf3\x0f\x1e\xfa",4); | ^~~~~~ main.c:1:1: note: include ‘<string.h>’ or provide a declaration of ‘memcpy’ +++ |+#include <string.h> 1 | #pragma GCC optimize("Ofast") main.c:15:9: warning: incompatible implicit declaration of built-in function ‘memcpy’ [-Wbuiltin-declaration-mismatch] 15 | memcpy(fwp,"\xf3\x0f\x1e\xfa",4); | ^~~~~~ main.c:15:9: note: include ‘<string.h>’ or provide a declaration of ‘memcpy’ main.c:6:59: warning: implicit declaration of function ‘write’ [-Wimplicit-function-declaration] 6 | #define wt1(v) ({char wbuf[64],*wp=wbuf+sizeof wbuf;wt(v);write(1,wp,wbuf+sizeof wbuf-wp);}) | ^~~~~ main.c:62:25: note: in expansion of macro ‘wt1’ 62 | wt1(b); | ^~~ main.c:67:9: warning: implicit declaration of function ‘_exit’ [-Wimplicit-function-declaration] 67 | _exit(0); | ^~~~~ main.c:67:9: warning: incompatible implicit declaration of built-in function ‘_exit’ [-Wbuiltin-declaration-mismatch]
ソースコード
#pragma GCC optimize("Ofast") #pragma GCC target("avx2") #define rd() ({long _v=0,_c;while(_c=*rp++-48,_c>=0)_v=_v*10+_c;_v;}) #define wt(v) ({ulong _z=v;do*--wp=_z%10+48;while(_z/=10);}) #define wt1(v) ({char wbuf[64],*wp=wbuf+sizeof wbuf;wt(v);write(1,wp,wbuf+sizeof wbuf-wp);}) #define repeat(e) for(typeof(e)_=e;_--;) typedef unsigned long ulong; int main(){ void*mmap(); long(*f)(long)=mmap(0l,1l<<21,7,34,-1,0l); char*fwp=f; memcpy(fwp,"\xf3\x0f\x1e\xfa",4); fwp+=4; char*rp=mmap(0l,1l<<25,1,2,0,0l); int q=rd(); long y=rd(); repeat(q){ int c=*rp; if(c>='0'&&c<='9'){ *fwp++=0x48; *fwp++=0xb8; *(long*)fwp=rd(); fwp+=8; *fwp++=0x50; }else if(c=='X'){ rp+=2; *fwp++=0x57; }else{ if(c=='+'){ rp+=2; memcpy(fwp,"\x58\x5a\x48\x01\xd0\x50",6); fwp+=6; }else{ rp+=4; if(rp[-3]=='a'){ memcpy(fwp,"\x58\x5a\x48\x39\xc2\x48\x0f\x4d\xc2\x50",10); }else{ memcpy(fwp,"\x58\x5a\x48\x39\xc2\x48\x0f\x4c\xc2\x50",10); } fwp+=10; } } } *fwp++=0x58; *fwp++=0xc3; { long a=-1; long b=y; while(a+1<b){ long m=a+b>>1; long v=f(m); if(v<y){ a=m; }else{ b=m; } } if(f(b)==y){ wt1(b); }else{ write(1,"-1",2); } } _exit(0); }