Submission #251906

#TimeUsernameProblemLanguageResultExecution timeMemory
251906dwscOn the Grid (FXCUP4_grid)C++17
12 / 100
4 ms384 KiB
#include <bits/stdc++.h> #include "grid.h" using namespace std; std::vector<int> SortDisks(int N) { vector<int> l(N,-1); vector<int> order; for (int i = N; i >= 1; i--){ vector<int> unsolved; for (int j = 0; j < N; j++){ if (l[j] == -1) unsolved.push_back(j); } for (int j = 0; j < unsolved.size(); j++){ vector<int> query; query.push_back(unsolved[j]); // cout<< unsolved[j] << "\n"; for (int k = 0; k < unsolved.size(); k++) { if (k != j) { query.push_back(unsolved[k]); // cout << unsolved[k] << "\n"; } } for (int k = order.size()-1; k >= 0; k--) query.push_back(order[k]); int num = PutDisks(query); //cout <<num << "queried\n"; if (num == N-1+i){ int act = unsolved[j]; l[act] = i; order.push_back(act); break; } } } return l; }

Compilation message (stderr)

grid.cpp: In function 'std::vector<int> SortDisks(int)':
grid.cpp:12:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int j = 0; j < unsolved.size(); j++){
                         ~~^~~~~~~~~~~~~~~~~
grid.cpp:16:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for (int k = 0; k < unsolved.size(); k++) {
                             ~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...