답안 #151431

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
151431 2019-09-02T22:37:10 Z scott_wu On the Grid (FXCUP4_grid) C++17
43 / 100
20 ms 420 KB
#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;
    int cval = PutDisks (cv);
    while (nhas)
    {
        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]);
            }
            if (cval == nval - nhas)
                cval = PutDisks (cv);
        }
        else
            cval = nval;
    }


    vector <int> res;
    for (int i = 0; i < N; i++)
        res.push_back(ans[i] + 1);
    return res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 2 ms 248 KB Output is correct
5 Correct 2 ms 248 KB Output is correct
6 Correct 2 ms 248 KB Output is correct
7 Correct 2 ms 252 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 2 ms 248 KB Output is correct
5 Correct 2 ms 248 KB Output is correct
6 Correct 2 ms 248 KB Output is correct
7 Correct 2 ms 252 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 3 ms 296 KB Output is correct
11 Correct 3 ms 248 KB Output is correct
12 Correct 3 ms 248 KB Output is correct
13 Correct 3 ms 248 KB Output is correct
14 Correct 3 ms 376 KB Output is correct
15 Correct 3 ms 252 KB Output is correct
16 Correct 3 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 2 ms 248 KB Output is correct
5 Correct 2 ms 248 KB Output is correct
6 Correct 2 ms 248 KB Output is correct
7 Correct 2 ms 252 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 3 ms 296 KB Output is correct
11 Correct 3 ms 248 KB Output is correct
12 Correct 3 ms 248 KB Output is correct
13 Correct 3 ms 248 KB Output is correct
14 Correct 3 ms 376 KB Output is correct
15 Correct 3 ms 252 KB Output is correct
16 Correct 3 ms 376 KB Output is correct
17 Correct 4 ms 248 KB Output is correct
18 Correct 13 ms 248 KB Output is correct
19 Correct 17 ms 420 KB Output is correct
20 Correct 20 ms 336 KB Output is correct
21 Incorrect 16 ms 248 KB Output isn't correct
22 Halted 0 ms 0 KB -