Submission #734410

# Submission time Handle Problem Language Result Execution time Memory
734410 2023-05-02T11:30:39 Z Amaarsaa Global Warming (NOI13_gw) C++14
40 / 40
475 ms 22800 KB
#include<bits/stdc++.h>
 
using namespace std;
using ll = long long;
ll n, ans, p, j, s, x;
	int Used[2000005] = {0};
int main() {
	ll i, t, r;
	cin >> n;

	vector < pair < ll, ll > > v;
	v.push_back(make_pair(-1, -1));
	for ( i = 1; i <= n; i ++) {
		cin >> x;
		v.push_back(make_pair(x, i));
		
	}	
	ans = 0;
	sort ( v.begin(), v.end());
	r = 0;
	for ( i = n; i >= 1; i --) {
		
		x = v[i].second;
		Used[x] = 1;
		
		ans ++;
			if ( Used[x + 1] == 1) ans --;
			if ( Used[x - 1] == 1) ans --;
		if ( v[i].first != v[i - 1].first) {
			r = max (r, ans);	
		}
		
	}
	cout << r << endl;
}

Compilation message

gw.cpp: In function 'int main()':
gw.cpp:8:8: warning: unused variable 't' [-Wunused-variable]
    8 |  ll i, t, r;
      |        ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 30 ms 2416 KB Output is correct
2 Correct 27 ms 2496 KB Output is correct
3 Correct 28 ms 2432 KB Output is correct
4 Correct 28 ms 2504 KB Output is correct
5 Correct 28 ms 2404 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 44 ms 2420 KB Output is correct
2 Correct 34 ms 2372 KB Output is correct
3 Correct 42 ms 2404 KB Output is correct
4 Correct 59 ms 2372 KB Output is correct
5 Correct 40 ms 2456 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 457 ms 20080 KB Output is correct
2 Correct 459 ms 19928 KB Output is correct
3 Correct 473 ms 20028 KB Output is correct
4 Correct 449 ms 19880 KB Output is correct
5 Correct 448 ms 19896 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 475 ms 19920 KB Output is correct
2 Correct 461 ms 19968 KB Output is correct
3 Correct 459 ms 20032 KB Output is correct
4 Correct 284 ms 19924 KB Output is correct
5 Correct 294 ms 22800 KB Output is correct