Submission #84329

#TimeUsernameProblemLanguageResultExecution timeMemory
84329zoooma13Baloni (COCI15_baloni)C++14
40 / 100
2080 ms132096 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #define MAX_N 1000006 int N; vector <int> A; set<int> os[MAX_N]; multiset <int> ms; int main() { scanf("%d",&N); assert(N < MAX_N); A.resize(N ,0); for(int i=0; i<N; i++) { scanf("%d",&A[i]); os[A[i]].insert(i); ms.insert(A[i]); } int Ans = 0; set<int>::iterator it; while(!ms.empty()) { int i = *prev(ms.end()); int j = -1; while(true) { it = os[i].upper_bound(j); if(it == os[i].end()) break; j = *it; ms.erase(ms.find(i)); os[i].erase(it); i--; } Ans++; } cout << Ans << endl; }

Compilation message (stderr)

baloni.cpp: In function 'int main()':
baloni.cpp:20:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&N); assert(N < MAX_N);
     ~~~~~^~~~~~~~~
baloni.cpp:24:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&A[i]);
         ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...