結果

問題 No.1013 〇マス進む
ユーザー tailstails
提出日時 2021-02-12 10:24:09
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 20 ms / 2,000 ms
コード長 977 bytes
コンパイル時間 1,679 ms
コンパイル使用メモリ 33,488 KB
実行使用メモリ 10,312 KB
最終ジャッジ日時 2023-09-26 09:53:21
合計ジャッジ時間 5,537 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,540 KB
testcase_01 AC 2 ms
5,528 KB
testcase_02 AC 2 ms
5,544 KB
testcase_03 AC 1 ms
5,496 KB
testcase_04 AC 2 ms
5,484 KB
testcase_05 AC 1 ms
5,500 KB
testcase_06 AC 1 ms
5,500 KB
testcase_07 AC 2 ms
5,576 KB
testcase_08 AC 1 ms
5,564 KB
testcase_09 AC 1 ms
5,512 KB
testcase_10 AC 1 ms
5,648 KB
testcase_11 AC 1 ms
5,672 KB
testcase_12 AC 2 ms
5,572 KB
testcase_13 AC 2 ms
5,660 KB
testcase_14 AC 6 ms
7,080 KB
testcase_15 AC 9 ms
7,764 KB
testcase_16 AC 7 ms
7,576 KB
testcase_17 AC 4 ms
6,952 KB
testcase_18 AC 6 ms
7,040 KB
testcase_19 AC 4 ms
6,600 KB
testcase_20 AC 9 ms
8,048 KB
testcase_21 AC 5 ms
6,832 KB
testcase_22 AC 6 ms
7,204 KB
testcase_23 AC 2 ms
6,172 KB
testcase_24 AC 10 ms
8,144 KB
testcase_25 AC 9 ms
8,008 KB
testcase_26 AC 3 ms
6,168 KB
testcase_27 AC 4 ms
6,808 KB
testcase_28 AC 3 ms
6,108 KB
testcase_29 AC 9 ms
7,948 KB
testcase_30 AC 4 ms
6,700 KB
testcase_31 AC 7 ms
7,328 KB
testcase_32 AC 5 ms
6,932 KB
testcase_33 AC 8 ms
7,040 KB
testcase_34 AC 13 ms
7,668 KB
testcase_35 AC 13 ms
7,492 KB
testcase_36 AC 2 ms
5,656 KB
testcase_37 AC 2 ms
5,652 KB
testcase_38 AC 14 ms
7,760 KB
testcase_39 AC 5 ms
6,536 KB
testcase_40 AC 14 ms
7,572 KB
testcase_41 AC 4 ms
6,180 KB
testcase_42 AC 8 ms
6,948 KB
testcase_43 AC 6 ms
6,604 KB
testcase_44 AC 9 ms
7,052 KB
testcase_45 AC 8 ms
6,812 KB
testcase_46 AC 4 ms
6,252 KB
testcase_47 AC 7 ms
7,060 KB
testcase_48 AC 9 ms
7,148 KB
testcase_49 AC 13 ms
7,564 KB
testcase_50 AC 12 ms
7,412 KB
testcase_51 AC 10 ms
7,236 KB
testcase_52 AC 2 ms
5,932 KB
testcase_53 AC 4 ms
6,048 KB
testcase_54 AC 13 ms
7,476 KB
testcase_55 AC 5 ms
6,332 KB
testcase_56 AC 17 ms
7,876 KB
testcase_57 AC 12 ms
7,332 KB
testcase_58 AC 19 ms
10,140 KB
testcase_59 AC 20 ms
10,228 KB
testcase_60 AC 19 ms
10,312 KB
testcase_61 AC 9 ms
8,084 KB
testcase_62 AC 6 ms
8,084 KB
testcase_63 AC 2 ms
5,540 KB
testcase_64 AC 1 ms
5,548 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:14:1: 警告: 戻り値の型をデフォルトの ‘int’ にします [-Wimplicit-int]
   14 | main(){
      | ^~~~
main.c: 関数 ‘main’ 内:
main.c:45:9: 警告: 関数 ‘write’ の暗黙的な宣言です [-Wimplicit-function-declaration]
   45 |         write(1,wbuf,wp-wbuf);
      |         ^~~~~
main.c:46:9: 警告: implicit declaration of function ‘_exit’; did you mean ‘_Exit’? [-Wimplicit-function-declaration]
   46 |         _exit(0);
      |         ^~~~~
      |         _Exit

ソースコード

diff #

#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 WTHI(v) {long _z=v,_n=0,_d=0;while(++_n,_d=_d<<8|0x30|_z%10,_z/=10);*(long*)wp=_d;wp+=_n;}
#define WTLO(v) {long _z=v,_n=8,_d=0;while(_d=_d<<8|0x30|_z%10,_z/=10,--_n);*(long*)wp=_d;wp+=8;}
#define WT(v) if(v>=100000000){WTHI(v/100000000);WTLO(v);}else{WTHI(v);}

struct {long u,v;} a[100000],p[100000],q[100000];

main(){
	char*rp=mmap(0l,1l<<28,1,2,0,0ll);
	RD(n);
	RD(k);
	for(int i=0;i<n;++i){
		RD(t);
		p[i].u=(t+i)%n;
		p[i].v=t;
		a[i].u=i;
	}
	for(;k;k>>=1){
		if(k&1){
			for(int i=0;i<n;++i){
				a[i].v=p[a[i].u].v+a[i].v;
				a[i].u=p[a[i].u].u;
			}
		}
		for(int i=0;i<n;++i){
			q[i].v=p[p[i].u].v+p[i].v;
			q[i].u=p[p[i].u].u;
		}
		for(int i=0;i<n;++i){
			p[i]=q[i];
		}
	}
	char*wp=wbuf;
	for(int i=0;i<n;++i){
		long t=a[i].v+i+1;
		WT(t);
		*wp++=10;
	}
	write(1,wbuf,wp-wbuf);
	_exit(0);
}
0