Submission #541761

#TimeUsernameProblemLanguageResultExecution timeMemory
541761FazacasMihaiBaloni (COCI15_baloni)C++17
100 / 100
186 ms1668 KiB
#include <bits/stdc++.h> using namespace std; int v[100005]; int main() { int n, k = 1, i, j, l, nr, cnt = 1; bool ok; cin>>n; cin>>nr; v[nr]++; for(i = 2; i <= n; i++) { cin>>nr; if(v[nr + 1]) { v[nr]++; v[nr + 1]--; } else { cnt++; v[nr]++; } } cout<<cnt; return 0; }

Compilation message (stderr)

baloni.cpp: In function 'int main()':
baloni.cpp:9:12: warning: unused variable 'k' [-Wunused-variable]
    9 |     int n, k = 1, i, j, l, nr, cnt = 1;
      |            ^
baloni.cpp:9:22: warning: unused variable 'j' [-Wunused-variable]
    9 |     int n, k = 1, i, j, l, nr, cnt = 1;
      |                      ^
baloni.cpp:9:25: warning: unused variable 'l' [-Wunused-variable]
    9 |     int n, k = 1, i, j, l, nr, cnt = 1;
      |                         ^
baloni.cpp:10:10: warning: unused variable 'ok' [-Wunused-variable]
   10 |     bool ok;
      |          ^~
#Verdict Execution timeMemoryGrader output
Fetching results...