답안 #382934

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
382934 2021-03-28T14:39:47 Z Iwanttobreakfree Baloni (COCI15_baloni) C++17
0 / 100
2000 ms 1092 KB
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
	int n,h,num;
	cin>>n;
	vector<int> v;
	cin>>h;
	v.push_back(h);
	for(int i=1;i<n;i++){
		cin>>num;
		bool pos=false;
		if(num<h){
		for(int j=0;j<v.size();j++){
			if(v[j]==num+1){
			v[j]=num;
			pos=true;	
			}
		}
	}
		if(!pos){
		v.push_back(num);
		if(num>h)h=num;	
		}
	}
	cout<<v.size();
}

Compilation message

baloni.cpp: In function 'int main()':
baloni.cpp:15:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |   for(int j=0;j<v.size();j++){
      |               ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 364 KB Output isn't correct
2 Incorrect 5 ms 364 KB Output isn't correct
3 Incorrect 10 ms 396 KB Output isn't correct
4 Incorrect 21 ms 364 KB Output isn't correct
5 Execution timed out 2073 ms 596 KB Time limit exceeded
6 Execution timed out 2060 ms 716 KB Time limit exceeded
7 Execution timed out 2071 ms 724 KB Time limit exceeded
8 Execution timed out 2064 ms 752 KB Time limit exceeded
9 Execution timed out 2070 ms 816 KB Time limit exceeded
10 Execution timed out 2081 ms 1092 KB Time limit exceeded