結果

問題 No.291 黒い文字列
ユーザー 👑 testestesttestestest
提出日時 2016-10-25 00:04:33
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 59 ms / 2,000 ms
コード長 575 bytes
コンパイル時間 454 ms
コンパイル使用メモリ 22,656 KB
実行使用メモリ 47,744 KB
最終ジャッジ日時 2024-05-03 05:54:28
合計ジャッジ時間 1,837 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 3 ms
5,376 KB
testcase_11 AC 6 ms
5,376 KB
testcase_12 AC 5 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 37 ms
32,256 KB
testcase_17 AC 41 ms
35,328 KB
testcase_18 AC 39 ms
34,688 KB
testcase_19 AC 51 ms
43,520 KB
testcase_20 AC 54 ms
44,928 KB
testcase_21 AC 24 ms
22,272 KB
testcase_22 AC 48 ms
39,808 KB
testcase_23 AC 59 ms
47,744 KB
testcase_24 AC 44 ms
36,736 KB
testcase_25 AC 44 ms
39,680 KB
testcase_26 AC 25 ms
21,632 KB
testcase_27 AC 11 ms
9,472 KB
testcase_28 AC 20 ms
18,304 KB
testcase_29 AC 36 ms
33,664 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:4:1: warning: data definition has no type or storage class
    4 | dp[110][22][22][22][22];
      | ^~
main.c:4:1: warning: type defaults to ‘int’ in declaration of ‘dp’ [-Wimplicit-int]
main.c:5:1: warning: data definition has no type or storage class
    5 | i,a,b,c,d,t;
      | ^
main.c:5:1: warning: type defaults to ‘int’ in declaration of ‘i’ [-Wimplicit-int]
main.c:5:3: warning: type defaults to ‘int’ in declaration of ‘a’ [-Wimplicit-int]
    5 | i,a,b,c,d,t;
      |   ^
main.c:5:5: warning: type defaults to ‘int’ in declaration of ‘b’ [-Wimplicit-int]
    5 | i,a,b,c,d,t;
      |     ^
main.c:5:7: warning: type defaults to ‘int’ in declaration of ‘c’ [-Wimplicit-int]
    5 | i,a,b,c,d,t;
      |       ^
main.c:5:9: warning: type defaults to ‘int’ in declaration of ‘d’ [-Wimplicit-int]
    5 | i,a,b,c,d,t;
      |         ^
main.c:5:11: warning: type defaults to ‘int’ in declaration of ‘t’ [-Wimplicit-int]
    5 | i,a,b,c,d,t;
      |           ^
main.c:6:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
    6 | main(ans){
      | ^~~~
main.c: In function ‘main’:
main.c:6:1: warning: type of ‘ans’ defaults to ‘int’ [-Wimplicit-int]
main.c:8:13: warning: implicit declaration of function ‘gets’ [-Wimplicit-function-declaration]
    8 |         for(gets(s);s[i];i++){
      |             ^~~~
main.c:18:14: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration]
   18 |         ans=!printf("%d",ans-1);
      |              ^~~~~~
main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
  +++ |+#include <stdio.h>
    1 | #define f(i,e)for(i=e+1;i--;)
main.c:18:14: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
   18 |         ans=!printf("%d",ans-1);
      |              ^~~~~~
main.c:18:14: note: include ‘<stdio.h>’ or provide a declaration of ‘pri

ソースコード

diff #

#define f(i,e)for(i=e+1;i--;)
#define max(p,q)(p<(q)?p=q:p)
char s[110];
dp[110][22][22][22][22];
i,a,b,c,d,t;
main(ans){
	*****dp=1;
	for(gets(s);s[i];i++){
		f(a,20)f(b,a)f(c,b)f(d,c)if(t=dp[i][a][b][c][d]){
			if(s[i]=='K'||s[i]=='?')max(dp[i+1][a+1][b][c][d],t);
			if(s[i]=='U'||s[i]=='?')max(dp[i+1][a][b+1][c][d],t);
			if(s[i]=='R'||s[i]=='?')max(dp[i+1][a][b][c+1][d],t);
			if(s[i]=='O'||s[i]=='?')max(dp[i+1][a][b][c][d+1],t);
			if(s[i]=='I'||s[i]=='?')max(ans,max(dp[i+1][a][b][c][d],d<t?0:t+1));
			max(dp[i+1][a][b][c][d],t);
		}
	}
	ans=!printf("%d",ans-1);
}
0