Submission #87721

# Submission time Handle Problem Language Result Execution time Memory
87721 2018-12-02T08:14:29 Z jvalsortav Baloni (COCI15_baloni) C++14
100 / 100
987 ms 19852 KB
#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

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 time Memory Grader output
1 Correct 1 ms 376 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 564 KB Output is correct
4 Correct 7 ms 564 KB Output is correct
5 Correct 590 ms 4184 KB Output is correct
6 Correct 987 ms 7804 KB Output is correct
7 Correct 815 ms 10648 KB Output is correct
8 Correct 770 ms 13488 KB Output is correct
9 Correct 719 ms 16936 KB Output is correct
10 Correct 841 ms 19852 KB Output is correct