結果

問題 No.479 頂点は要らない
ユーザー tails
提出日時 2017-01-27 22:50:44
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 72 ms / 1,500 ms
コード長 414 bytes
コンパイル時間 1,416 ms
コンパイル使用メモリ 164,972 KB
実行使用メモリ 13,568 KB
最終ジャッジ日時 2024-12-23 16:38:13
合計ジャッジ時間 3,546 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
    7 | main(){
      | ^~~~
main.cpp: In function ‘int main()’:
main.cpp:9:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         scanf("%d%d",&n,&m);
      |         ~~~~~^~~~~~~~~~~~~~
main.cpp:12:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |                 scanf("%d%d",&a,&b);
      |                 ~~~~~^~~~~~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

vector<int> av[100002];
set<int> aset;

main(){
	int n,m;
	scanf("%d%d",&n,&m);
	for(int j=0;j<m;++j){
		int a,b;
		scanf("%d%d",&a,&b);
		av[a].push_back(b);
	}
	bool on=false;
	for(int i=n-1;i>=0;--i){
		int r=0;
		for(int a:av[i]){
			if(aset.find(a)==aset.end()){
				r=1;
				on=true;
				aset.insert(i);
				break;
			}
		}
		if(on){
			putchar(r+48);
		}
	}
}
0