제출 #151709

#제출 시각아이디문제언어결과실행 시간메모리
151709gs14004On the Grid (FXCUP4_grid)C++17
100 / 100
18 ms504 KiB
#include "grid.h" #include <bits/stdc++.h> using namespace std; vector<int> SortDisks(int n){ vector<int> v(n); vector<int> ans(n); iota(v.begin(), v.end(), 0); int p = PutDisks(v); int found = 0; while(found < n){ auto w = v; rotate(w.begin(), w.end() - found - 1, w.end() - found); int q = PutDisks(w); if(q == n){ for(int i=0; i+found<n; i++){ ans[w[i]] = i + 1; } break; } if(q >= p){ ans[w[0]] = q - n + 1; found++; sort(v.end() - found, v.end(), [&](const int &a, const int &b){ return ans[a] < ans[b]; }); } else{ p = q; v = w; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...