結果

問題 No.457 (^^*)
ユーザー bal4ubal4u
提出日時 2019-06-26 08:42:49
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 781 bytes
コンパイル時間 1,351 ms
コンパイル使用メモリ 28,152 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-06 06:36:12
合計ジャッジ時間 2,807 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 0 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 0 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 0 ms
4,376 KB
testcase_19 AC 0 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: 関数 ‘ins’ 内:
main.c:7:14: 警告: 関数 ‘getchar_unlocked’ の暗黙的な宣言です [-Wimplicit-function-declaration]
    7 | #define gc() getchar_unlocked()
      |              ^~~~~~~~~~~~~~~~
main.c:14:17: 備考: in expansion of macro ‘gc’
   14 |         do *s = gc();
      |                 ^~

ソースコード

diff #

// yukicoder: No.457 (^^*)
// 2019.6.26 bal4u

#include <stdio.h>

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif

void ins(char *s)  // 文字列の入力 スペース以下の文字で入力終了
{
	do *s = gc();
	while (*s++ > ' ');
	*(s-1) = 0;
}

int L[4], R[4];
int al, ar;
char S[10005];

int main()
{
	char *s;
	
	ins(s = S);
	while (*s) {
		if (*s == '(') L[0]++, R[0]++;
		else if (*s == '^') {
			if (L[1]) L[2] += L[1], L[1] = 0;
			if (L[0]) L[1] += L[0], L[0] = 0;
			if (R[2]) R[3] += R[2], R[2] = 0;
			if (R[1]) R[2] += R[1], R[1] = 0;
		} else if (*s == '*') {
			if (L[2]) L[3] += L[2], L[2] = 0;
			if (R[0]) R[1] += R[0], R[0] = 0;
		} else if (*s == ')') al += L[3], ar += R[3];
		s++;
	}
	printf("%d %d\n", al, ar);
	return 0;
}
0