Submission #150610

#TimeUsernameProblemLanguageResultExecution timeMemory
150610본인 하지만 안 어림 ㅋㅋ (#200)On the Grid (FXCUP4_grid)C++17
43 / 100
56 ms384 KiB
#include "grid.h" #include <algorithm> using namespace std; pair<int, int> a[1001]; std::vector<int> SortDisks(int N) { vector<int> t(N); int i, j, k, l, m = N; for (i = 0; i < N; i++) t[i] = i; for (i = 0; i < N; i++) { a[i].first = -N; a[i].second = i; } random_shuffle(a, a + N); while (m) { for (j = 0; j < N; j++) t[j] = a[j].second; k = PutDisks(t); l = 0; for (j = 0; j < m; j++) { if (a[j].first <= N - j - k - 1) l++; a[j].first = max(a[j].first, N - j - k - 1); } if (l == 1) { for (j = 0; j < m; j++) if (a[j].first == N - j - k - 1) { swap(a[j], a[--m]); break; } } sort(a, a + m); } for (j = 0; j < N; j++) t[a[j].second] = -a[j].first; return t; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...