Submission #251906

# Submission time Handle Problem Language Result Execution time Memory
251906 2020-07-23T05:03:24 Z dwsc On the Grid (FXCUP4_grid) C++17
12 / 100
4 ms 384 KB
#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

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 time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 0 ms 256 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 0 ms 256 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Incorrect 4 ms 384 KB Output isn't correct
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 0 ms 256 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Incorrect 4 ms 384 KB Output isn't correct
10 Halted 0 ms 0 KB -