結果
| 問題 | No.679 不思議マーケット |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-05-31 06:55:30 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 487 bytes |
| 記録 | |
| コンパイル時間 | 1,315 ms |
| コンパイル使用メモリ | 220,300 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-10 10:47:21 |
| 合計ジャッジ時間 | 2,438 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 |
ソースコード
#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;
}