結果

問題 No.941 商とあまり
ユーザー QCFium
提出日時 2019-09-24 21:37:00
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 937 bytes
コンパイル時間 1,593 ms
コンパイル使用メモリ 165,920 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-14 23:38:43
合計ジャッジ時間 4,662 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 6
other WA * 104
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

/* strict input checker */

int read_integer() {
	int c = getchar(), sign = 0, res = 0;
	if (c == '-') sign = 1;
	else {
		assert(c >= '0' && c <= '9');
		res = c - '0';
	}
	while (1) {
		c = getchar();
		if (c < '0' || c > '9') break;
		assert(res <= 200000000); // avoid overflow
		res = res * 10 + c - '0';
	}
	ungetc(c, stdin);
	return sign ? -res : res;
}

void read_linebreak() {
	int c = getchar();
	if (c == '\r') c = getchar();
	assert(c == '\n');
}

int main() {
	int n = read_integer();
	assert(getchar() == ' ');
	int x = read_integer();
	
	assert(1 <= n && n <= 100);
	assert(1 <= x && x <= 500000);
	
	read_linebreak();
	for (int i = 0; i < n; i++) {
		if (i) assert(getchar() == ' ');
		int a = read_integer();
		assert(1 <= a && a <= x);
	}
	
	int c = getchar();
	if (c == '\r') assert((c = getchar()) == '\n'); 
	if (c == '\n') c = getchar();
	assert(c == EOF);
	
	puts("passed");
	return 0;
}
0