답안 #41546

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
41546 2018-02-18T17:42:17 Z wzy 지구 온난화 (NOI13_gw) C++11
40 / 40
658 ms 32768 KB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define F first
#define S second
#define pii pair<int,int>

vector<pii> t;
bool x[1000100];
int n;


int main(){
	cin>>n;
	for(int i = 0 ; i < n; i++){
		int k ;
		cin>>k;
		t.pb(pii(k , i + 1));
		x[i+1] = 1;
	}
	sort(t.begin() , t.end());
	int maxxi = 1;
	int curr = 1;
	for(int i = 0 ; i < n; i++){
		pii u = t[i];
		x[u.S] = 0;
		if(i && t[i-1].F != u.F){
			maxxi = max(maxxi , curr);
		}
		if(x[u.S - 1] + x[u.S + 1] == 2) curr++; // Cria nova ilha
		else if(x[u.S - 1] + x[u.S + 1] == 0) curr--; // Afunda uma ilha existente
	}
	cout<<maxxi<<endl;
}	
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 480 KB Output is correct
4 Correct 2 ms 520 KB Output is correct
5 Correct 2 ms 536 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 35 ms 2184 KB Output is correct
2 Correct 37 ms 2428 KB Output is correct
3 Correct 38 ms 2612 KB Output is correct
4 Correct 38 ms 2872 KB Output is correct
5 Correct 36 ms 3132 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 56 ms 3904 KB Output is correct
2 Correct 43 ms 4604 KB Output is correct
3 Correct 56 ms 5368 KB Output is correct
4 Correct 57 ms 6200 KB Output is correct
5 Correct 56 ms 7036 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 602 ms 17648 KB Output is correct
2 Correct 592 ms 27084 KB Output is correct
3 Correct 614 ms 32768 KB Output is correct
4 Correct 629 ms 32768 KB Output is correct
5 Correct 607 ms 32768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 590 ms 32768 KB Output is correct
2 Correct 619 ms 32768 KB Output is correct
3 Correct 658 ms 32768 KB Output is correct
4 Correct 387 ms 32768 KB Output is correct
5 Correct 389 ms 32768 KB Output is correct