Submission #73728

#TimeUsernameProblemLanguageResultExecution timeMemory
73728FLDutchmanJousting tournament (IOI12_tournament)C++14
0 / 100
1078 ms1632 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]); } int best = 0; //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); } return best; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...