結果

問題 No.479 頂点は要らない
ユーザー DugongDugong
提出日時 2017-03-16 20:43:27
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 43 ms / 1,500 ms
コード長 712 bytes
コンパイル時間 504 ms
コンパイル使用メモリ 45,704 KB
実行使用メモリ 9,708 KB
最終ジャッジ日時 2023-09-17 05:21:16
合計ジャッジ時間 3,297 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,324 KB
testcase_01 AC 3 ms
5,288 KB
testcase_02 AC 3 ms
5,316 KB
testcase_03 AC 3 ms
5,328 KB
testcase_04 AC 3 ms
5,292 KB
testcase_05 AC 2 ms
5,352 KB
testcase_06 AC 3 ms
5,344 KB
testcase_07 AC 2 ms
5,336 KB
testcase_08 AC 3 ms
5,340 KB
testcase_09 AC 3 ms
5,348 KB
testcase_10 AC 3 ms
5,356 KB
testcase_11 AC 3 ms
5,320 KB
testcase_12 AC 3 ms
5,292 KB
testcase_13 AC 3 ms
5,340 KB
testcase_14 AC 2 ms
5,296 KB
testcase_15 AC 2 ms
5,336 KB
testcase_16 AC 3 ms
5,332 KB
testcase_17 AC 3 ms
5,328 KB
testcase_18 AC 2 ms
5,336 KB
testcase_19 AC 3 ms
5,364 KB
testcase_20 AC 2 ms
5,412 KB
testcase_21 AC 3 ms
5,380 KB
testcase_22 AC 3 ms
5,336 KB
testcase_23 AC 3 ms
5,368 KB
testcase_24 AC 3 ms
5,396 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 42 ms
9,696 KB
testcase_27 AC 43 ms
9,708 KB
testcase_28 AC 33 ms
9,708 KB
testcase_29 AC 31 ms
8,228 KB
testcase_30 AC 32 ms
8,200 KB
testcase_31 AC 32 ms
8,224 KB
testcase_32 AC 34 ms
8,256 KB
testcase_33 AC 33 ms
8,352 KB
testcase_34 AC 36 ms
8,512 KB
testcase_35 AC 32 ms
7,892 KB
testcase_36 AC 17 ms
6,788 KB
testcase_37 AC 35 ms
8,528 KB
testcase_38 AC 30 ms
8,036 KB
testcase_39 AC 23 ms
7,444 KB
testcase_40 AC 27 ms
8,140 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;

vector<int> G[100000];
bool used[100000];
int ans[100000];

int main(){
	int n,m;
	int a[100000],b[100000];
	scanf("%d %d",&n,&m);
	for(int i=0;i<m;i++){
		scanf("%d %d",a+i,b+i);
		G[a[i]].push_back(i);
		G[b[i]].push_back(i);
	}
	fill(used,used+m,false);
	fill(ans,ans+n,0);
	for(int i=n-1;i>=0;i--){
		for(int j=0;j<G[i].size();j++){
			if(!used[G[i][j]]&&max(a[G[i][j]],b[G[i][j]])>i){
				ans[i] = 1;
				break;
			}
		}
		if(ans[i]) for(int j=0;j<G[i].size();j++) used[G[i][j]] = true;
	}
	bool flag = false;
	for(int i=n-1;i>=0;i--){
		if(flag||ans[i]){
			printf("%d",ans[i]);
			flag = true;
		}
	}
	printf("\n");
	return 0;
}
0