結果
問題 | No.1419 Power Moves |
ユーザー | tails |
提出日時 | 2021-03-10 13:55:29 |
言語 | C (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 1,120 bytes |
コンパイル時間 | 452 ms |
コンパイル使用メモリ | 32,000 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-12 04:27:52 |
合計ジャッジ時間 | 2,088 ms |
ジャッジサーバーID (参考情報) |
judge5 / 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 | 1 ms
5,248 KB |
testcase_04 | AC | 1 ms
5,248 KB |
testcase_05 | AC | 1 ms
5,248 KB |
testcase_06 | AC | 1 ms
5,248 KB |
testcase_07 | AC | 1 ms
5,248 KB |
testcase_08 | AC | 1 ms
5,248 KB |
testcase_09 | AC | 2 ms
5,248 KB |
testcase_10 | AC | 1 ms
5,248 KB |
testcase_11 | AC | 1 ms
5,248 KB |
testcase_12 | AC | 2 ms
5,248 KB |
testcase_13 | AC | 2 ms
5,248 KB |
testcase_14 | AC | 2 ms
5,248 KB |
testcase_15 | AC | 3 ms
5,248 KB |
testcase_16 | AC | 2 ms
5,248 KB |
testcase_17 | AC | 1 ms
5,248 KB |
testcase_18 | AC | 1 ms
5,248 KB |
testcase_19 | AC | 1 ms
5,248 KB |
testcase_20 | AC | 2 ms
5,248 KB |
testcase_21 | AC | 2 ms
5,248 KB |
testcase_22 | AC | 1 ms
5,248 KB |
testcase_23 | AC | 1 ms
5,248 KB |
testcase_24 | AC | 2 ms
5,248 KB |
testcase_25 | AC | 1 ms
5,248 KB |
testcase_26 | AC | 2 ms
5,248 KB |
testcase_27 | AC | 2 ms
5,248 KB |
testcase_28 | AC | 2 ms
5,248 KB |
testcase_29 | AC | 2 ms
5,248 KB |
testcase_30 | AC | 3 ms
5,248 KB |
testcase_31 | AC | 2 ms
5,248 KB |
testcase_32 | AC | 2 ms
5,248 KB |
testcase_33 | AC | 2 ms
5,248 KB |
コンパイルメッセージ
main.c:41:1: warning: return type defaults to 'int' [-Wimplicit-int] 41 | main(){ | ^~~~ main.c: In function 'main': main.c:50:17: warning: implicit declaration of function 'sprintf' [-Wimplicit-function-declaration] 50 | sprintf(s[i],"%10d\n",q); | ^~~~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'sprintf' +++ |+#include <stdio.h> 1 | #pragma GCC optimize("Ofast") main.c:50:17: warning: incompatible implicit declaration of built-in function 'sprintf' [-Wbuiltin-declaration-mismatch] 50 | sprintf(s[i],"%10d\n",q); | ^~~~~~~ main.c:50:17: note: include '<stdio.h>' or provide a declaration of 'sprintf' main.c:57:25: warning: implicit declaration of function 'memcpy' [-Wimplicit-function-declaration] 57 | memcpy(wp,s[(n+i<r)+(n+~i<r)],11); | ^~~~~~ main.c:1:1: note: include '<string.h>' or provide a declaration of 'memcpy' +++ |+#include <string.h> 1 | #pragma GCC optimize("Ofast") main.c:57:25: warning: incompatible implicit declaration of built-in function 'memcpy' [-Wbuiltin-declaration-mismatch] 57 | memcpy(wp,s[(n+i<r)+(n+~i<r)],11); | ^~~~~~ main.c:57:25: note: include '<string.h>' or provide a declaration of 'memcpy' main.c:65:25: warning: incompatible implicit declaration of built-in function 'memcpy' [-Wbuiltin-declaration-mismatch] 65 | memcpy(wp,"0\n",2); | ^~~~~~ main.c:65:25: note: include '<string.h>' or provide a declaration of 'memcpy' main.c:71:9: warning: implicit declaration of function 'write' [-Wimplicit-function-declaration] 71 | write(1,wbuf,wp-wbuf); | ^~~~~ main.c:72:9: warning: implicit declaration of function '_exit'; did you mean '_Exit'? [-Wimplicit-function-declaration] 72 | _exit(0); | ^~~~~
ソースコード
#pragma GCC optimize("Ofast") #pragma GCC target("avx2") char*mmap(); #define RD(v) int v=0;{int _c;while(_c=*rp++-48,_c>=0)v=v*10+_c;} char wbuf[1<<28]; #define MD 1000000007 long modpow(long a, long b, long m){ long r=1; while(b){ if(b&1){ r=r*a%m; } b>>=1; a=a*a%m; } return r; } int inverse(int a){ int b=MD; int u=1; int v=0; while(b){ int q=a/b,t; t=b, b=a-q*b, a=t; t=v, v=u-q*v, u=t; } if(u<0){ u+=MD; } return u; } char wbuf[1<<28]; char s[5][12]; main(){ char*rp=mmap(0l,1l<<28,1,2,0,0ll); RD(n); RD(k); int r=modpow(2,k-1,n); int q=(modpow(2,k-1,MD)-r+MD)%MD*inverse(n)*(n&1?2:4)%MD; int d=modpow((MD+1)/2,k,MD); q=1l*q*d%MD; for(int i=0;i<5;++i){ sprintf(s[i],"%10d\n",q); q=(q+d)%MD; } r*=2; char*wp=wbuf; if(n&1){ for(int i=0;i<n;i+=2){ memcpy(wp,s[(n+i<r)+(n+~i<r)],11); wp+=11; memcpy(wp,s[(i<r)+(n*2+~i<r)],11); wp+=11; } wp-=11; }else{ for(int i=0;i<n;i+=2){ memcpy(wp,"0\n",2); wp+=2; memcpy(wp,s[(i<r)+(n*2+~i<r)+(n+i<r)+(n+~i<r)],11); wp+=11; } } write(1,wbuf,wp-wbuf); _exit(0); }