제출 #830165

#제출 시각아이디문제언어결과실행 시간메모리
830165Liudas마상시합 토너먼트 (IOI12_tournament)C++17
17 / 100
1076 ms2104 KiB
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include <vector> #include <algorithm> #include <iostream> //#include "tournament.h" using namespace std; int GetBestPosition(int N, int C, int R, int K[], int S[], int E[]){ vector<int> arr(N-1); int id = 0, ms = 0; for(int i = 0; i < N-1; i ++){ arr[i] = K[i]; } for(int i = 0; i < N; i ++){ vector<int> crr = arr; vector<pair<int, int>> brr; int score = 0; crr.insert(crr.begin()+i, R); for(int j = 0; j < N; j ++){ brr.push_back({crr[j], j+1}); } for(int j = 0; j < C; j ++){ int s = S[j], e = E[j]; int p = 0, pos = 0; while(p < s){ pos = brr[pos].second; p++; } int sp = pos; int maxi = 0; while(p <= e){ maxi = max(maxi, brr[pos].first); pos = brr[pos].second; p++; } brr[sp] = {maxi, pos}; if(maxi == R){ score ++; } } if(score > ms){ ms = score; id = i; } } return id; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...