제출 #629839

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
6298392022-08-15 08:51:00abeker송신탑 (IOI22_towers)C++17
23 / 100
4088 ms12624 KiB
#include <bits/stdc++.h>
#include "towers.h"
using namespace std;
const int INF = 2e9;
struct Node {
int mini, arg_max;
};
class Tournament {
int n, offset;
vector <int> vals;
vector <Node> tour;
public:
Node merge(Node lhs, Node rhs) const {
return {min(lhs.mini, rhs.mini), vals[lhs.arg_max] > vals[rhs.arg_max] ? lhs.arg_max : rhs.arg_max};
}
Tournament(int n, vector <int> _vals) : n(n), vals(_vals) {
vals.push_back(0);
for (offset = 1; offset <= n; offset *= 2);
tour.resize(2 * offset);
vals.resize(offset);
for (int i = 0; i < offset; i++)
tour[i + offset] = {vals[i], i};
for (int i = offset - 1; i; i--)
tour[i] = merge(tour[2 * i], tour[2 * i + 1]);
}
Tournament() {}
Node query(int x, int lo, int hi, int from, int to) const {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#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...