結果

問題 No.504 ゲーム大会(ランキング)
ユーザー bal4ubal4u
提出日時 2019-04-18 09:31:26
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 7 ms / 2,000 ms
コード長 707 bytes
コンパイル時間 218 ms
コンパイル使用メモリ 29,696 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-22 08:47:08
合計ジャッジ時間 1,165 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function 'in':
main.c:7:14: warning: implicit declaration of function 'getchar_unlocked' [-Wimplicit-function-declaration]
    7 | #define gc() getchar_unlocked()
      |              ^~~~~~~~~~~~~~~~
main.c:15:24: note: in expansion of macro 'gc'
   15 |         int n = 0, c = gc();
      |                        ^~
main.c: In function 'outs':
main.c:8:15: warning: implicit declaration of function 'putchar_unlocked' [-Wimplicit-function-declaration]
    8 | #define pc(c) putchar_unlocked(c)
      |               ^~~~~~~~~~~~~~~~
main.c:21:41: note: in expansion of macro 'pc'
   21 | void outs() { char *s = top; while (*s) pc(*s++); pc('\n'); }
      |                                         ^~

ソースコード

diff #

// yukicoder: No.504 ゲーム大会(ランキング)
// 2019.4.18 bal4u

#include <stdio.h>

#if 1
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif
int in()
{
	int n = 0, c = gc();
	do n = 10 * n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

char ans[6] = "000001", *top = ans+5, *end = ans+5;
void outs() { char *s = top; while (*s) pc(*s++); pc('\n'); }

void inc(char *p)
{
	if (p < top) top = p;
	if (*p < '9') (*p)++;
	else {
		*p = '0';
		if (top == p) top--;
		inc(p-1);
	}
}

int main()
{
	int N, a, a1;
	N = in();
	a1 = in(); outs();
	while (--N) {
		a = in();
		if (a > a1) inc(end);
		outs();
	}
	return 0;
}
0