結果
問題 |
No.679 不思議マーケット
|
ユーザー |
|
提出日時 | 2020-05-31 06:55:30 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 487 bytes |
コンパイル時間 | 3,863 ms |
コンパイル使用メモリ | 197,372 KB |
最終ジャッジ日時 | 2025-01-10 19:58:54 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 18 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:8:23: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | int n,m; scanf("%d%d",&n,&m); | ~~~~~^~~~~~~~~~~~~~ main.cpp:11:31: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | int a,k; scanf("%d%d",&a,&k); a--; | ~~~~~^~~~~~~~~~~~~~ main.cpp:13:31: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 13 | rep(j,k) scanf("%d",&L[a][j]), L[a][j]--; | ~~~~~^~~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<(n);i++) using namespace std; int main(){ int n,m; scanf("%d%d",&n,&m); vector<vector<int>> L(n); rep(i,m){ int a,k; scanf("%d%d",&a,&k); a--; L[a].resize(k); rep(j,k) scanf("%d",&L[a][j]), L[a][j]--; } vector<bool> ok(n); rep(_,n){ rep(i,n) if(!ok[i]) { bool f=true; for(int a:L[i]) if(!ok[a]) { f=false; break; } if(f) ok[i]=true; } } printf("%ld\n",count(ok.begin(),ok.end(),true)); return 0; }