#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ii pair<int,int>
#define iii tuple<int,int,int>
#define fi first
#define se second
#define endl '\n'
#define debug(x) cout << #x << ": " << x << endl
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define lb lower_bound
#define ub upper_bound
#define rep(x,start,end) for(int x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
int n,m,k;
int arr[200005];
vector<int> al[200005];
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin.exceptions(ios::badbit | ios::failbit);
cin>>n>>m>>k;
rep(x,1,n+1) cin>>arr[x];
int ans=0;
rep(x,0,m){
int a,b; cin>>a>>b;
al[a].pub(b);
al[b].pub(a);
}
rep(x,2,n+1) ans+=arr[x];
if (arr[n]==1 && *max_element(arr+1,arr+n+1)==2) ans++;
cout<<ans<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4956 KB |
Output is correct |
2 |
Correct |
62 ms |
12868 KB |
Output is correct |
3 |
Correct |
49 ms |
12772 KB |
Output is correct |
4 |
Correct |
47 ms |
12800 KB |
Output is correct |
5 |
Correct |
48 ms |
15712 KB |
Output is correct |
6 |
Correct |
48 ms |
15700 KB |
Output is correct |
7 |
Correct |
49 ms |
15728 KB |
Output is correct |
8 |
Correct |
1 ms |
4956 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4956 KB |
Output is correct |
2 |
Correct |
62 ms |
12868 KB |
Output is correct |
3 |
Correct |
49 ms |
12772 KB |
Output is correct |
4 |
Correct |
47 ms |
12800 KB |
Output is correct |
5 |
Correct |
48 ms |
15712 KB |
Output is correct |
6 |
Correct |
48 ms |
15700 KB |
Output is correct |
7 |
Correct |
49 ms |
15728 KB |
Output is correct |
8 |
Correct |
1 ms |
4956 KB |
Output is correct |
9 |
Incorrect |
1 ms |
4956 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4956 KB |
Output is correct |
2 |
Correct |
62 ms |
12868 KB |
Output is correct |
3 |
Correct |
49 ms |
12772 KB |
Output is correct |
4 |
Correct |
47 ms |
12800 KB |
Output is correct |
5 |
Correct |
48 ms |
15712 KB |
Output is correct |
6 |
Correct |
48 ms |
15700 KB |
Output is correct |
7 |
Correct |
49 ms |
15728 KB |
Output is correct |
8 |
Correct |
1 ms |
4956 KB |
Output is correct |
9 |
Incorrect |
1 ms |
4956 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4956 KB |
Output is correct |
2 |
Correct |
62 ms |
12868 KB |
Output is correct |
3 |
Correct |
49 ms |
12772 KB |
Output is correct |
4 |
Correct |
47 ms |
12800 KB |
Output is correct |
5 |
Correct |
48 ms |
15712 KB |
Output is correct |
6 |
Correct |
48 ms |
15700 KB |
Output is correct |
7 |
Correct |
49 ms |
15728 KB |
Output is correct |
8 |
Correct |
1 ms |
4956 KB |
Output is correct |
9 |
Incorrect |
1 ms |
4956 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
4956 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
4956 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4956 KB |
Output is correct |
2 |
Correct |
62 ms |
12868 KB |
Output is correct |
3 |
Correct |
49 ms |
12772 KB |
Output is correct |
4 |
Correct |
47 ms |
12800 KB |
Output is correct |
5 |
Correct |
48 ms |
15712 KB |
Output is correct |
6 |
Correct |
48 ms |
15700 KB |
Output is correct |
7 |
Correct |
49 ms |
15728 KB |
Output is correct |
8 |
Correct |
1 ms |
4956 KB |
Output is correct |
9 |
Incorrect |
1 ms |
4956 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |