Submission #56718


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <iomanip>
#include <utility>
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
using namespace std;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n,m,r;
cin>>n>>m>>r;
bool cop[105]={false};
int a,b;
cop[m]=true;
rep(i,r){
cin>>a>>b;
if(cop[a] || cop[b]){
cop[a]=true;
cop[b]=true;
}
}
int sum=0;
reps(i,n){
if(cop[i]){
sum++;
}
}
cout<<sum<<'\n';
return 0;
}

ステータス

項目 データ
問題 1188 - マジック
ユーザー名 NASSUN_ei1906
投稿日時 2019-11-19 15:54:42
言語 C++14
状態 Accepted
得点 1
ソースコード長 809 Byte
最大実行時間 31 ms
最大メモリ使用量 680 KB

セット

セット 得点 Cases
1 ALL 1 / 1 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
in01.text AC 31 ms 604 KB
1
in02.text AC 20 ms 432 KB
1
in03.text AC 20 ms 520 KB
1
in04.text AC 19 ms 472 KB
1
in05.text AC 24 ms 552 KB
1
in06.text AC 21 ms 512 KB
1
in07.text AC 20 ms 596 KB
1
sample1.text AC 23 ms 680 KB
1
sample2.text AC 20 ms 508 KB
1
sample3.text AC 18 ms 468 KB
1