結果

問題 No.709 優勝可能性
ユーザー bal4ubal4u
提出日時 2019-08-04 07:21:33
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 37 ms / 3,500 ms
コード長 1,018 bytes
コンパイル時間 422 ms
コンパイル使用メモリ 29,516 KB
実行使用メモリ 5,368 KB
最終ジャッジ日時 2023-09-21 21:34:13
合計ジャッジ時間 2,954 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
4,380 KB
testcase_01 AC 0 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,384 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 0 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,384 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 13 ms
4,376 KB
testcase_11 AC 6 ms
4,380 KB
testcase_12 AC 27 ms
4,380 KB
testcase_13 AC 23 ms
4,380 KB
testcase_14 AC 19 ms
4,376 KB
testcase_15 AC 16 ms
4,380 KB
testcase_16 AC 15 ms
4,376 KB
testcase_17 AC 16 ms
5,368 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 37 ms
4,376 KB
testcase_21 AC 37 ms
4,376 KB
testcase_22 AC 0 ms
4,380 KB
testcase_23 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: 関数 ‘in’ 内:
main.c:8:14: 警告: 関数 ‘getchar_unlocked’ の暗黙的な宣言です [-Wimplicit-function-declaration]
    8 | #define gc() getchar_unlocked()
      |              ^~~~~~~~~~~~~~~~
main.c:16:24: 備考: in expansion of macro ‘gc’
   16 |         int n = 0, c = gc();
      |                        ^~
main.c: 関数 ‘out’ 内:
main.c:9:15: 警告: 関数 ‘putchar_unlocked’ の暗黙的な宣言です [-Wimplicit-function-declaration]
    9 | #define pc(c) putchar_unlocked(c)
      |               ^~~~~~~~~~~~~~~~
main.c:26:21: 備考: in expansion of macro ‘pc’
   26 |         while (i--) pc(b[i]);
      |                     ^~

ソースコード

diff #

// yukicoder: No.709 優勝可能性
// 2019.8.4 bal4u

#include <stdio.h>
#include <string.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); while ((c = gc()) >= '0');
	return n;
}

void out(int n) { // 正整数の表示(出力)
	int i;
	char b[20];

	i = 0; while (n) b[i++] = n % 10 + '0', n /= 10;
	while (i--) pc(b[i]);
	pc('\n');
}

int N, M;
char f[100005]; int ans;
int ma[12], list[12][100005], sz[12];

int main()
{
	int i, n, m, r;

	N = in(), M = in();
	for (n = 0; n < N; n++) {
		for (m = 0; m < M; m++) {
			r = in();
			if (r > ma[m]) {
				for (i = 0; i < sz[m]; i++) {
					if (--f[list[m][i]] == 0) ans--;
				}
				ma[m] = r, list[m][0] = n, sz[m] = 1;
				if (f[n] == 0) ans++;
				f[n]++;
			} else if (r == ma[m]) {
				list[m][sz[m]++] = n;
				if (f[n] == 0) ans++;
				f[n]++;
			}
		}
		out(ans);
	}
	return 0;
}
0