Submission #1497971


Source Code Expand

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

#define FOR(i,l,r) for(int i = int(l);i < int(r);i++)
template<typename T> bool chmax(T& a,const T& b){ return a < b ? (a = b,true) : false; }
template<typename T> bool chmin(T& a,const T& b){ return b < a ? (a = b,true) : false; }
typedef long long ll;

int N,K,R;
vector<int> A;

int main()
{
	scanf("%d%d",&N,&K);
	A.assign(N,0);
	FOR(i,0,K){
		int sz;
		scanf("%d",&sz);
		FOR(j,0,sz){
			int x;
			scanf("%d",&x);
			A [x - 1] = i;
		}
	}

	scanf("%d",&R);
	deque<bool> bad(N);
	FOR(i,0,R){
		int p,q;
		scanf("%d%d",&p,&q);
		p--;
		q--;
		if(A [p] == A [q]){
			bad [p] = bad [q] = true;
		}
	}

	printf("%d\n",accumulate(bad.begin(),bad.end(),0));

	return 0;
}

Submission Info

Submission Time
Task C - ソーシャル
User gigime
Language C++14 (GCC 5.4.1)
Score 100
Code Size 758 Byte
Status AC
Exec Time 1 ms
Memory 256 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:14:21: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d",&N,&K);
                     ^
./Main.cpp:18:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&sz);
                  ^
./Main.cpp:21:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d",&x);
                  ^
./Main.cpp:26:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&R);
                ^
./Main.cpp:30:22: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d",&p,&q);
                      ^

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 39
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 1 ms 256 KB
10_random_5 AC 1 ms 256 KB
10_random_6 AC 1 ms 256 KB
10_random_7 AC 1 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