Submission #1306574
Source Code Expand
#include<bits/stdc++.h> #define INF 2000000000 #define int long long int #define MOD 1000000007 #define pb push_back #define cin1(n) (cin >> n) #define cin2(a,b) (cin >> a >> b) #define cin3(a,b,c) (cin >> a >> b >> c) #define cout(n) (cout << n << endl) #define for_(i,a,b) for(int i=(a);i<(b);++i) #define fr first #define sc second #define EPS (1e-10) using namespace std; typedef vector<int> vi; typedef vector< vector<int> > vvi; typedef vector<pair<int,int>> vpii; typedef vector<string> vs; typedef vector<vector<string>> vss; typedef pair<int,int> pii; int dx[] = {1,-1,0,0}; int dy[] = {0,0,1,-1}; int n,m; int a,b; int p,q; signed main() { int k; cin2(n,k); vvi hune(k); for_(i,0,k) { int m; cin1(m); for_(j,0,m) { int bunny; cin1(bunny); hune[i].pb(bunny); } } int r; cin1(r); set<int> ans; for_(i,0,r){ cin2(p,q); for_(j,0,k) { bool pf = false; bool qf = false; for_(l,0,hune[j].size()) { if (hune[j][l] == p) { pf = true; } if (hune[j][l] == q) { qf = true; } } if (pf and qf) { ans.insert(p); ans.insert(q); } } } cout(ans.size()); return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - ソーシャル |
User | kikuchi0408 |
Language | C++14 (GCC 5.4.1) |
Score | 100 |
Code Size | 1243 Byte |
Status | AC |
Exec Time | 2 ms |
Memory | 256 KB |
Judge Result
Set Name | All | ||
---|---|---|---|
Score / Max Score | 100 / 100 | ||
Status |
|
Set Name | Test Cases |
---|---|
All | 00_sample_01, 00_sample_02, 00_sample_03, 10_random_0, 10_random_1, 10_random_10, 10_random_11, 10_random_12, 10_random_13, 10_random_14, 10_random_15, 10_random_16, 10_random_17, 10_random_18, 10_random_19, 10_random_2, 10_random_20, 10_random_21, 10_random_22, 10_random_23, 10_random_24, 10_random_25, 10_random_26, 10_random_27, 10_random_28, 10_random_3, 10_random_4, 10_random_5, 10_random_6, 10_random_7, 10_random_8, 10_random_9, 20_twopartition_0, 20_twopartition_1, 20_twopartition_2, 20_twopartition_3, 20_twopartition_4, 20_twopartition_5, 20_twopartition_6 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_01 | AC | 1 ms | 256 KB |
00_sample_02 | AC | 1 ms | 256 KB |
00_sample_03 | AC | 1 ms | 256 KB |
10_random_0 | AC | 1 ms | 256 KB |
10_random_1 | AC | 1 ms | 256 KB |
10_random_10 | AC | 1 ms | 256 KB |
10_random_11 | AC | 1 ms | 256 KB |
10_random_12 | AC | 1 ms | 256 KB |
10_random_13 | AC | 1 ms | 256 KB |
10_random_14 | AC | 1 ms | 256 KB |
10_random_15 | AC | 1 ms | 256 KB |
10_random_16 | AC | 1 ms | 256 KB |
10_random_17 | AC | 1 ms | 256 KB |
10_random_18 | AC | 1 ms | 256 KB |
10_random_19 | AC | 1 ms | 256 KB |
10_random_2 | AC | 1 ms | 256 KB |
10_random_20 | AC | 1 ms | 256 KB |
10_random_21 | AC | 1 ms | 256 KB |
10_random_22 | AC | 1 ms | 256 KB |
10_random_23 | AC | 1 ms | 256 KB |
10_random_24 | AC | 1 ms | 256 KB |
10_random_25 | AC | 1 ms | 256 KB |
10_random_26 | AC | 1 ms | 256 KB |
10_random_27 | AC | 1 ms | 256 KB |
10_random_28 | AC | 1 ms | 256 KB |
10_random_3 | AC | 1 ms | 256 KB |
10_random_4 | AC | 2 ms | 256 KB |
10_random_5 | AC | 1 ms | 256 KB |
10_random_6 | AC | 1 ms | 256 KB |
10_random_7 | AC | 2 ms | 256 KB |
10_random_8 | AC | 1 ms | 256 KB |
10_random_9 | AC | 1 ms | 256 KB |
20_twopartition_0 | AC | 1 ms | 256 KB |
20_twopartition_1 | AC | 1 ms | 256 KB |
20_twopartition_2 | AC | 1 ms | 256 KB |
20_twopartition_3 | AC | 1 ms | 256 KB |
20_twopartition_4 | AC | 1 ms | 256 KB |
20_twopartition_5 | AC | 1 ms | 256 KB |
20_twopartition_6 | AC | 1 ms | 256 KB |