Submission #105685

#TimeUsernameProblemLanguageResultExecution timeMemory
105685RezwanArefin01Jousting tournament (IOI12_tournament)C++17
Compilation error
0 ms0 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; typedef pair<int, int> ii; typedef tree< ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; const int M = 2e5 + 10; struct node { int sum, flag, l, d; node(int s=0, int f=0, int l=0, int d=0) : sum(s), flag(f), l(l), d(d) {} } t[M]; int idx; ordered_set st; int GetBestPosition(int N, int C, int R, int *K, int *S, int *E) { for(int i = 0; i < N - 1; i++) { t[i] = node(K[i] > R, K[i] > R, i, 0); st.insert({i, i}); } t[N - 1] = node(0, 0, N - 1, 0); st.insert({N - 1, N - 1}); idx = N; for(int i = 0; i < C; i++) { int l = S[i], r = E[i]; auto s = st.find_by_order(l); auto e = st.find_by_order(r); int lid = s -> second, rid = e -> second; t[idx].l = t[lid].l; vector<typeof(s)> v; while(1) { int id = s -> second; t[idx].sum += t[id].sum; t[idx].d = max(t[idx].d, t[id].d + 1); v.push_back(s); if(s == e) break; s++; } for(auto it : v) st.erase(it); t[idx].flag = t[rid].flag; st.insert({l, idx}); idx++; } int maxwin = 0, ans = 0; for(int i = 0; i < idx; i++) if(t[i].d >= maxwin){ if(t[i].sum == 0 || (t[i].sum == 1 && t[i].flag)) { if(t[i].d > maxwin) { maxwin = t[i].d; ans = t[i].l; } else { ans = min(ans, t[i].l); } } } return ans; }

Compilation message (stderr)

tournament.cpp: In function 'int GetBestPosition(int, int, int, int*, int*, int*)':
tournament.cpp:42:10: error: 'typeof' was not declared in this scope
   vector<typeof(s)> v; 
          ^~~~~~
tournament.cpp:42:10: note: suggested alternative: 'feof'
   vector<typeof(s)> v; 
          ^~~~~~
          feof
tournament.cpp:42:19: error: template argument 1 is invalid
   vector<typeof(s)> v; 
                   ^
tournament.cpp:42:19: error: template argument 2 is invalid
tournament.cpp:48:6: error: request for member 'push_back' in 'v', which is of non-class type 'int'
    v.push_back(s);  
      ^~~~~~~~~
tournament.cpp:53:17: error: 'begin' was not declared in this scope
   for(auto it : v) st.erase(it);
                 ^
tournament.cpp:53:17: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95:0,
                 from tournament.cpp:1:
/usr/include/c++/7/valarray:1211:5: note:   'std::begin'
     begin(const valarray<_Tp>& __va)
     ^~~~~
/usr/include/c++/7/valarray:1211:5: note:   'std::begin'
tournament.cpp:53:17: error: 'end' was not declared in this scope
   for(auto it : v) st.erase(it);
                 ^
tournament.cpp:53:17: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95:0,
                 from tournament.cpp:1:
/usr/include/c++/7/valarray:1231:5: note:   'std::end'
     end(const valarray<_Tp>& __va)
     ^~~
/usr/include/c++/7/valarray:1231:5: note:   'std::end'