답안 #734384

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
734384 2023-05-02T10:58:12 Z Amaarsaa 지구 온난화 (NOI13_gw) C++14
13 / 40
1000 ms 60760 KB
#include<bits/stdc++.h>
 
using namespace std;
using ll = int;
ll n, ans, p, j, s, x;
int main() {
	ll i, t, r;
	cin >> n;
	map < ll, ll > Used;
	vector < pair < ll, ll > > v;
	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 - 1; i >= 0; i --) {
		x = v[i].second;
		ans ++;
		if ( Used[x + 1] == 1) ans --;
		if ( Used[x - 1] == 1) ans --;
		Used[x] ++;
		r = max (r, ans);
	}
	cout << r << endl;
}

Compilation message

gw.cpp: In function 'int main()':
gw.cpp:7:8: warning: unused variable 't' [-Wunused-variable]
    7 |  ll i, t, r;
      |        ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 2 ms 308 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 66 ms 5936 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 98 ms 6520 KB Output is correct
2 Correct 65 ms 6300 KB Output is correct
3 Correct 91 ms 6508 KB Output is correct
4 Correct 99 ms 6536 KB Output is correct
5 Correct 103 ms 6460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1084 ms 60760 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1075 ms 59844 KB Time limit exceeded
2 Halted 0 ms 0 KB -