結果

問題 No.1607 Kth Maximum Card
ユーザー 沙耶花沙耶花
提出日時 2021-07-16 21:52:00
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2,552 ms / 3,500 ms
コード長 705 bytes
コンパイル時間 5,020 ms
コンパイル使用メモリ 276,340 KB
実行使用メモリ 53,544 KB
最終ジャッジ日時 2023-09-20 13:41:10
合計ジャッジ時間 31,294 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1,326 ms
53,008 KB
testcase_09 AC 1,035 ms
45,480 KB
testcase_10 AC 1,812 ms
53,192 KB
testcase_11 AC 199 ms
15,068 KB
testcase_12 AC 1,198 ms
43,988 KB
testcase_13 AC 196 ms
12,668 KB
testcase_14 AC 271 ms
14,916 KB
testcase_15 AC 1,431 ms
49,660 KB
testcase_16 AC 230 ms
14,108 KB
testcase_17 AC 64 ms
6,344 KB
testcase_18 AC 912 ms
40,536 KB
testcase_19 AC 485 ms
26,608 KB
testcase_20 AC 614 ms
29,392 KB
testcase_21 AC 686 ms
31,592 KB
testcase_22 AC 2,401 ms
52,908 KB
testcase_23 AC 2,552 ms
52,540 KB
testcase_24 AC 415 ms
18,360 KB
testcase_25 AC 252 ms
14,044 KB
testcase_26 AC 292 ms
15,620 KB
testcase_27 AC 458 ms
21,380 KB
testcase_28 AC 347 ms
16,916 KB
testcase_29 AC 863 ms
32,160 KB
testcase_30 AC 1,860 ms
53,212 KB
testcase_31 AC 806 ms
29,616 KB
testcase_32 AC 835 ms
53,544 KB
testcase_33 AC 842 ms
52,488 KB
testcase_34 AC 817 ms
52,676 KB
testcase_35 AC 854 ms
53,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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


int main(){
	
	int N,M,K;
	cin>>N>>M>>K;
	
	vector<int> u(M),v(M),c(M);
	rep(i,M){
		scanf("%d %d %d",&u[i],&v[i],&c[i]);
		u[i]--;v[i]--;
	}
	
	int ng = -1,ok = 200005;
	
	while(ok-ng>1){
		
		int mid = (ok+ng)/2;
		
		mcf_graph<int,int> G(N);
		rep(i,M){
			if(c[i]>mid){
				G.add_edge(u[i],v[i],1,1);
				G.add_edge(v[i],u[i],1,1);
			}
			else{
				G.add_edge(u[i],v[i],1,0);
				G.add_edge(v[i],u[i],1,0);
			}
		}
		
		if(G.flow(0,N-1,1).second<K)ok = mid;
		else ng = mid;
		
	}
	
	cout<<ok<<endl;
	
	return 0;
}
0