제출 #151427

#제출 시각아이디문제언어결과실행 시간메모리
151427scott_wuOn the Grid (FXCUP4_grid)C++17
43 / 100
13 ms376 KiB
#include "grid.h" #include <bits/stdc++.h> using namespace std; const int MAXN = 1100; int N; vector <int> cv; vector <int> nv; int ans[MAXN]; void cyc (int K) { nv.clear(); for (int i = 0; i < K; i++) nv.push_back(cv[(i+K-1)%K]); for (int i = K; i < N; i++) nv.push_back(cv[i]); } vector<int> SortDisks(int __N) { N = __N; for (int i = 0; i < N; i++) cv.push_back(i); int nhas = N; while (nhas) { int cval = PutDisks (cv); cyc (nhas); int nval = PutDisks (nv); cv = nv; if (cval != nval + 1) { ans[cv[0]] = nval - N; nhas--; for (int i = 0; i < N - 1; i++) { if (i >= nhas && ans[cv[i]] <= ans[cv[i+1]]) break; swap (cv[i], cv[i+1]); } } } vector <int> res; for (int i = 0; i < N; i++) res.push_back(ans[i] + 1); return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...