Submission #73729

#TimeUsernameProblemLanguageResultExecution timeMemory
73729FLDutchmanJousting tournament (IOI12_tournament)C++14
49 / 100
1063 ms2608 KiB
#include <bits/stdc++.h> using namespace std; typedef int INT; #define pb push_back #define fst first #define snd second #define FOR(i,l,r) for(int i = (l); i < (r); i++) typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int,int> ii; typedef vector<ii> vii; vii intervals; vii idx; INT GetBestPosition(INT N, INT C, INT R, INT *K, INT *S, INT *E) { idx.resize(N); FOR(i, 0, N) idx[i] = {i,i}; FOR(i, 0, C){ intervals.pb({idx[S[i]].fst, idx[E[i]].snd}); idx.erase(idx.begin() +S[i], idx.begin() + E[i]); idx[S[i]].fst = intervals.back().fst; } //for(ii p : intervals) cout << p.fst << " " << p.snd << endl; vi val(C, -1); FOR(i, 0, C) FOR(j, intervals[i].fst, intervals[i].snd){ val[i] = max(val[i], K[j]); } ii best = {-1, -1e9}; //for(int k : val) cout << k << endl; FOR(i, 0, N) { int tot = 0; FOR(c,0,C) if(intervals[c].fst <= i and i <= intervals[c].snd){ tot += val[c] < R; } best = max(best, {tot,-i}); } return -best.snd; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...