結果

問題 No.1231 Make a Multiple of Ten
ユーザー tailstails
提出日時 2020-11-01 23:55:40
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 475 bytes
コンパイル時間 349 ms
コンパイル使用メモリ 31,376 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-29 11:38:42
合計ジャッジ時間 3,017 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 0 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 3 ms
4,376 KB
testcase_05 AC 3 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 3 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 3 ms
4,376 KB
testcase_11 AC 3 ms
4,376 KB
testcase_12 AC 6 ms
4,380 KB
testcase_13 AC 6 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 6 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: 関数 ‘main’ 内:
main.c:24:9: 警告: 関数 ‘printf’ の暗黙的な宣言です [-Wimplicit-function-declaration]
   24 |         printf("%d",*dp1);
      |         ^~~~~~
main.c:1:1: 備考: include ‘<stdio.h>’ or provide a declaration of ‘printf’
  +++ |+#include <stdio.h>
    1 | #pragma GCC optimize("Ofast")
main.c:24:9: 警告: 組み込み関数 ‘printf’ の互換性がない暗黙的な宣言です [-Wbuiltin-declaration-mismatch]
   24 |         printf("%d",*dp1);
      |         ^~~~~~
main.c:24:9: 備考: include ‘<stdio.h>’ or provide a declaration of ‘printf’

ソースコード

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;}

int dpbuf[20],*dp1=dpbuf,*dp2=dpbuf+10;

int main() {
	char*rp=mmap(0l,11*200001,1,2,0,0ll);
	RD(n);
	for(int i=1;i<10;++i){
		dp1[i]=-n;
	}
	while(n--){
		while(*rp++>=48);
		int a=rp[-2]-48;
		for(int i=0;i<10;++i){
			dp2[a]=dp1[a]>dp1[i]?dp1[a]:dp1[i]+1;
			if(++a==10) a=0;
		}
		int*tmp=dp1; dp1=dp2; dp2=tmp;
	}
	printf("%d",*dp1);
}
0