結果

問題 No.1703 Much Matching
ユーザー 沙耶花沙耶花
提出日時 2021-10-08 22:04:16
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 278 ms / 2,000 ms
コード長 651 bytes
コンパイル時間 4,522 ms
コンパイル使用メモリ 265,564 KB
実行使用メモリ 8,004 KB
最終ジャッジ日時 2023-09-30 10:15:15
合計ジャッジ時間 8,216 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 75 ms
5,252 KB
testcase_07 AC 5 ms
4,380 KB
testcase_08 AC 80 ms
5,108 KB
testcase_09 AC 88 ms
5,424 KB
testcase_10 AC 13 ms
4,376 KB
testcase_11 AC 20 ms
4,376 KB
testcase_12 AC 5 ms
4,376 KB
testcase_13 AC 33 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 17 ms
4,376 KB
testcase_16 AC 47 ms
4,824 KB
testcase_17 AC 53 ms
4,620 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 115 ms
6,612 KB
testcase_20 AC 16 ms
4,376 KB
testcase_21 AC 137 ms
7,520 KB
testcase_22 AC 54 ms
5,120 KB
testcase_23 AC 40 ms
4,464 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 6 ms
4,376 KB
testcase_26 AC 26 ms
4,380 KB
testcase_27 AC 55 ms
4,504 KB
testcase_28 AC 115 ms
5,576 KB
testcase_29 AC 21 ms
4,380 KB
testcase_30 AC 31 ms
4,376 KB
testcase_31 AC 5 ms
4,376 KB
testcase_32 AC 61 ms
4,692 KB
testcase_33 AC 40 ms
4,380 KB
testcase_34 AC 5 ms
4,380 KB
testcase_35 AC 12 ms
4,376 KB
testcase_36 AC 278 ms
8,004 KB
testcase_37 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint1000000007;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000000

int op(int a,int b){
	return max(a,b);
}

int e(){
	return 0;
}



int main(){
	
	int n,m,q;
	cin>>n>>m>>q;
	
	vector<vector<int>> E(n);
	rep(i,q){
		int x,y;
		scanf("%d %d",&x,&y);
		x--;y--;
		E[x].push_back(y);
	}
	
	segtree<int,op,e> seg(m);
	
	rep(i,n){
		sort(E[i].rbegin(),E[i].rend());
		rep(j,E[i].size()){
			int b = E[i][j];
			seg.set(b,max(seg.get(b),seg.prod(0,b)+1));
		}
	}
	
	cout<<seg.all_prod()<<endl;
	
	return 0;
}
0