Submission #734405

# Submission time Handle Problem Language Result Execution time Memory
734405 2023-05-02T11:22:59 Z Amaarsaa Global Warming (NOI13_gw) C++14
29 / 40
484 ms 29400 KB
#include<bits/stdc++.h>
 
using namespace std;
using ll = long long;
ll n, ans, p, j, s, x;
	int Used[1000005] = {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;
		if ( v[i].first != v[i - 1].first) {
			r = max (r, ans);	
		}
		Used[x] = 1;
		
		ans ++;
			if ( Used[x + 1] == 1) ans --;
			if ( Used[x - 1] == 1) 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 336 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 2412 KB Output is correct
2 Correct 27 ms 2760 KB Output is correct
3 Correct 27 ms 2760 KB Output is correct
4 Correct 26 ms 2656 KB Output is correct
5 Correct 28 ms 2760 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 41 ms 2504 KB Output is correct
2 Correct 33 ms 2432 KB Output is correct
3 Correct 41 ms 2404 KB Output is correct
4 Correct 41 ms 2452 KB Output is correct
5 Correct 54 ms 2400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 461 ms 19956 KB Output is correct
2 Correct 467 ms 29400 KB Output is correct
3 Correct 461 ms 29348 KB Output is correct
4 Correct 484 ms 29256 KB Output is correct
5 Correct 453 ms 28588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 469 ms 20040 KB Output is correct
2 Correct 452 ms 28656 KB Output is correct
3 Correct 470 ms 28724 KB Output is correct
4 Incorrect 302 ms 22780 KB Output isn't correct
5 Halted 0 ms 0 KB -