Submission #915335

#TimeUsernameProblemLanguageResultExecution timeMemory
915335jpfr12Baloni (COCI15_baloni)C++14
100 / 100
45 ms7760 KiB
#include <iostream> #include <stdio.h> #include <algorithm> #include <vector> #include <queue> #include <deque> #include <set> #include <string> #include <map> #include <math.h> #include <cmath> #include <climits> #include <unordered_map> #include <unordered_set> #include <assert.h> #include <fstream> #include <bitset> #include <iomanip> typedef long long ll; using namespace std; int MOD = (int)1e9; int MAXN = 1e6; //classes //global int main(){ ios_base::sync_with_stdio(false); cin.tie(0); //ifstream fin("input.txt"); //ofstream fout("output.txt"); //stop int n; cin >> n; vector<int> vec(n); for(int& i: vec) cin >> i; vector<int> dp(1e6+1); int sum = 0; for(int& i: vec){ if(dp[i+1] > 0){ dp[i+1]--; dp[i]++; } else{ dp[i]++; sum++; } } cout << sum << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...