| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 726757 | LittleFlowers__ | 즐거운 행로 (APIO20_fun) | C++17 | 2082 ms | 1236 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "fun.h"
#include <bits/stdc++.h>
using namespace std;
mt19937 rng(101202);
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int l,int r) {
if (l > r) { cerr << l << " " << r << "\n"; }
return l + rng() % (r - l + 1);
}
vector<int> createFunTour(int n, int q) {
vector<vector<int>> distance(n, vector<int>(n));
for (int i = 0; i < n; ++i) for (int j = i + 1; j < n; ++j) {
distance[i][j] = distance[j][i] = hoursRequired(i, j);
}
vector<int> state(n); iota(state.begin(), state.end(), 0);
function<int(const vector<int>&)> evaluate = [&](const vector<int> &state) {
int fault = 0;
for (int i = 2; i < state.size(); ++i) {
fault +=
distance[state[i - 2]][state[i - 1]] < distance[state[i - 1]][state[i]];
}
return fault;
};
int best = evaluate(state);
while (best) {
int x = rnd(0, n - 1);
int y = rnd(0, n - 1);
if (x == y) continue;
swap(state[x], state[y]);
int adjValue = evaluate(state);
if (adjValue <= best) best = adjValue;
else swap(state[x], state[y]);
}
return state;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
