結果

問題 No.479 頂点は要らない
ユーザー CleyLCleyL
提出日時 2023-01-22 16:06:16
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 102 ms / 1,500 ms
コード長 590 bytes
コンパイル時間 881 ms
コンパイル使用メモリ 87,680 KB
実行使用メモリ 10,684 KB
最終ジャッジ日時 2023-09-07 02:05:54
合計ジャッジ時間 5,887 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,384 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 101 ms
10,604 KB
testcase_27 AC 102 ms
10,504 KB
testcase_28 AC 92 ms
10,684 KB
testcase_29 AC 71 ms
7,392 KB
testcase_30 AC 71 ms
7,368 KB
testcase_31 AC 71 ms
7,328 KB
testcase_32 AC 72 ms
7,324 KB
testcase_33 AC 76 ms
7,460 KB
testcase_34 AC 79 ms
7,460 KB
testcase_35 AC 65 ms
5,504 KB
testcase_36 AC 35 ms
4,376 KB
testcase_37 AC 81 ms
7,856 KB
testcase_38 AC 65 ms
6,756 KB
testcase_39 AC 48 ms
6,588 KB
testcase_40 AC 61 ms
7,612 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  int n,m;cin>>n>>m;
  vector<int> A[n];
  for(int i = 0; m > i; i++){
    int a,b;cin>>a>>b;
    A[b].push_back(a);
  }
  set<int> B;
  string ans = "";
  for(int i = 0; n > i; i++)ans.push_back('0');
  for(int i = n-1; 0 <= i; i--){
    if(B.count(i)){
      ans[i] = '1';
    }else{
      for(int j = 0; A[i].size() > j; j++){
        B.insert(A[i][j]);
      }
    }
  }
  while(ans[ans.size()-1] == '0')ans.pop_back();
  reverse(ans.begin(),ans.end());
  cout << ans << endl;
}
0