Submission #287819

#TimeUsernameProblemLanguageResultExecution timeMemory
287819zecookiezUntitled (POI11_rot)Pypy 2
0 / 100
34 ms4896 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/detail/standard_policies.hpp> using namespace std; using namespace __gnu_pbds; template<class C>constexpr int len(const C&c){return int(c.size());} typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> ordered_set; const int MAXN = 200005; int N; long long ans; ordered_set solve(){ int A; cin >> A; if(A != 0){ ordered_set arr; arr.insert(A); return arr; } ordered_set left = solve(), right = solve(); if(left.size() > right.size()) swap(left, right); int cur, case1 = 0, case2 = 0; for(auto i : left){ cur = right.order_of_key(i); case1 += cur; case2 += len(right) - cur; } ans += min(case1, case2); for(auto i : left) right.insert(i); return right; } int main(){ cin.sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> N; solve(); cout << ans << '\n'; return 0; }

Compilation message (stderr)

File "rot.py", line 5
    using namespace std;
         ^
SyntaxError: invalid syntax
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...