結果

問題 No.686 Uncertain LIS
ユーザー kriiikriii
提出日時 2018-12-08 22:54:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 530 bytes
コンパイル時間 487 ms
コンパイル使用メモリ 56,872 KB
実行使用メモリ 8,696 KB
最終ジャッジ日時 2023-10-12 15:34:32
合計ジャッジ時間 5,220 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
8,696 KB
testcase_01 AC 1 ms
4,352 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 WA -
testcase_04 AC 4 ms
4,368 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 2 ms
4,356 KB
testcase_08 WA -
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bitset>
using namespace std;

const int lim = 100000;
bitset<lim+1> now;

int f(int y)
{
	int l = y-1, r = lim+1;
	while (l + 1 < r){
		int m = (l + r) / 2;
		if ((now >> m).count() >= 1) l = m;
		else r = m;
	}
	return l;
}

int main()
{
	int N; scanf ("%d",&N); while (N--){
		int x,y; scanf ("%d %d",&x,&y);
		int z = f(y);
		if (z >= y) now[z] = 0;

		auto v = ((now << (lim - y)) >> (lim - y + x)) << x;
		now ^= v;
		now ^= (v << 1);
		now[x] = 1;
	}

	printf ("%d\n",now.count());

	return 0;
}
0