Submission #87721

#TimeUsernameProblemLanguageResultExecution timeMemory
87721jvalsortavBaloni (COCI15_baloni)C++14
100 / 100
987 ms19852 KiB
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <cctype>
#include <ctime>
#include <set>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <utility>
#include <string>
#include <map>

using namespace std;

vector <int> v;
int n, x;
bool inf;

int main() {
	
	cin >> n;
	cin >> x;
	v.push_back(x);
	for (int i = 1; i < n; i++){
		inf = true;
		cin >> x;
		for (int j = 0; j < v.size(); j++){
			if (v[j] - 1 == x){
				v[j] = x;
				inf = false;
				break;
			}
		}
		if (inf){
			v.push_back(x);
		}
	}
	cout << v.size();

return 0;
}

Compilation message (stderr)

baloni.cpp: In function 'int main()':
baloni.cpp:30:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int j = 0; j < v.size(); j++){
                   ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...