| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 151025 | Alexa2001 | On the Grid (FXCUP4_grid) | C++17 | 21 ms | 504 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "grid.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> v, mn, val;
int n, ep;
void solve()
{
int last = PutDisks(v) - n;
int i;
while(1)
{
vector<int> last_v = v;
int id = v[ep];
for(i=ep; i; --i) v[i] = v[i-1];
v[0] = id;
int now = PutDisks(v) - n;
if(!now) return;
if(now > last - 1)
{
val[id] = now + 1;
v = last_v;
--ep;
auto cmp = [&val](int x, int y)
{
assert(val[x] && val[y]);
return val[x] < val[y];
};
sort(v.begin() + ep + 1, v.end(), cmp);
// solve();
// break;
}
else last--, mn[id] = min(mn[id], now + 1);
}
}
vector<int> SortDisks(int _n)
{
int i; n = _n;
v.resize(n);
val.resize(n);
mn.resize(n, n);
for(i=0; i<n; ++i) v[i] = i;
ep = n-1;
solve();
vector<int> ans(n);
for(i=0; i<n; ++i)
ans[v[i]] = i+1;
return ans;
}
컴파일 시 표준 에러 (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... | ||||
