Submission #12777268


Source Code Expand

Copy
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
            ∧_∧
      ∧_∧  (´<_` )  Welcome to My Coding Space!
     ( ´_ゝ`) /  ⌒i     @hamayanhamayan0
    /   \     | |
    /   / ̄ ̄ ̄ ̄/  |
  __(__ニつ/     _/ .| .|____
     \/____/ (u ⊃
---------------------------------------------------------------------------------------------------*/














int N, M, H[101010];
vector<int> E[101010];
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N >> M;
	rep(i, 0, N) cin >> H[i];
	rep(i, 0, M) {
		int a, b; cin >> a >> b;
		a--; b--;
		E[a].push_back(b);
		E[b].push_back(a);
	}

	int ans = 0;
	rep(cu, 0, N) {
		bool ok = true;
		fore(to, E[cu]) if (H[cu] <= H[to]) ok = false;
		if (ok) ans++;
	}
	cout << ans << endl;
}





Submission Info

Submission Time
Task C - Peaks
User hamayanhamayan
Language C++ (GCC 9.2.1)
Score 300
Code Size 1756 Byte
Status AC
Exec Time 47 ms
Memory 9204 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 19
Set Name Test Cases
Sample Sample_01.txt, Sample_02.txt
All Sample_01.txt, Sample_02.txt, maxrand_01.txt, maxrand_02.txt, maxrand_03.txt, ni_01.txt, ni_02.txt, rand_01.txt, rand_02.txt, rand_03.txt, same_01.txt, same_02.txt, same_03.txt, small_01.txt, small_02.txt, small_03.txt, uni_01.txt, uni_02.txt, uni_03.txt
Case Name Status Exec Time Memory
Sample_01.txt AC 10 ms 5944 KB
Sample_02.txt AC 10 ms 5944 KB
maxrand_01.txt AC 42 ms 9140 KB
maxrand_02.txt AC 42 ms 9196 KB
maxrand_03.txt AC 46 ms 9072 KB
ni_01.txt AC 5 ms 5940 KB
ni_02.txt AC 5 ms 5972 KB
rand_01.txt AC 46 ms 9072 KB
rand_02.txt AC 44 ms 9052 KB
rand_03.txt AC 47 ms 9060 KB
same_01.txt AC 41 ms 9204 KB
same_02.txt AC 40 ms 9144 KB
same_03.txt AC 45 ms 9152 KB
small_01.txt AC 8 ms 5888 KB
small_02.txt AC 5 ms 5956 KB
small_03.txt AC 3 ms 5848 KB
uni_01.txt AC 39 ms 8508 KB
uni_02.txt AC 42 ms 8456 KB
uni_03.txt AC 39 ms 8600 KB