답안 #979599

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
979599 2024-05-11T08:04:53 Z vjudge1 벽 칠하기 (APIO20_paint) C++17
0 / 100
1500 ms 2588 KB
#include "paint.h"
#include<bits/stdc++.h>
using namespace std;
const int INF = 1e9;

int eq(vector<int> c, int p, vector<vector<int>> b, int m)
{
    int ok = 1;
    for(int i = p; i < p + m; ++i)
    {
        int _ok = 0;
        for(int j : b[i - p])
            _ok |= c[i] == j;
        ok &= _ok;
    }
    return ok;
}

void sdvig(vector<vector<int>> &b, int m)
{
    for(int i = 0; i < m - 1; ++i)
        swap(b[i], b[i + 1]);
}

int minimumInstructions(int n, int m, int k, vector<int> c, vector<int> a, vector<vector<int>> b)
{
    int i;
    int dp[n + 5] = {};
    for(i = 0; i <= n - m; ++i)
    {
        for(int t = 0; t < m && !dp[i]; ++t)
        {
            if(eq(c, i, b, m))
                dp[i] = 1;
            sdvig(b, m);
        }
    }
    int ans = 1, cur = 0;
    while(cur < n - m)
    {
        int lst = INF;
        for(i = cur + 1; i <= cur + m; ++i)
            if(dp[i])
                lst = i;
        cur = lst;
        ++ans;
    }
//    for(i = 0; i < n; ++i)
//        cout << dp[i] << ' ';
//    return;
    return (cur < INF ? ans : -1);
}

//int main()
//{
////    ios_base::sync_with_stdio(0);
////    cin.tie(0), cout.tie(0);
////    solve();
//}

//8 3 5
//3 3 1 3 4 4 2 2
//3 0 1 2
//2 2 3
//2 3 4
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 3 ms 344 KB Output is correct
14 Correct 4 ms 348 KB Output is correct
15 Correct 3 ms 348 KB Output is correct
16 Correct 3 ms 348 KB Output is correct
17 Correct 3 ms 348 KB Output is correct
18 Correct 3 ms 348 KB Output is correct
19 Correct 502 ms 600 KB Output is correct
20 Correct 525 ms 464 KB Output is correct
21 Correct 490 ms 464 KB Output is correct
22 Execution timed out 1523 ms 2588 KB Time limit exceeded
23 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 3 ms 344 KB Output is correct
14 Correct 4 ms 348 KB Output is correct
15 Correct 3 ms 348 KB Output is correct
16 Correct 3 ms 348 KB Output is correct
17 Correct 3 ms 348 KB Output is correct
18 Correct 3 ms 348 KB Output is correct
19 Correct 502 ms 600 KB Output is correct
20 Correct 525 ms 464 KB Output is correct
21 Correct 490 ms 464 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Incorrect 0 ms 348 KB Output isn't correct
26 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 3 ms 344 KB Output is correct
16 Correct 4 ms 348 KB Output is correct
17 Correct 3 ms 348 KB Output is correct
18 Correct 3 ms 348 KB Output is correct
19 Correct 3 ms 348 KB Output is correct
20 Correct 3 ms 348 KB Output is correct
21 Correct 502 ms 600 KB Output is correct
22 Correct 525 ms 464 KB Output is correct
23 Correct 490 ms 464 KB Output is correct
24 Execution timed out 1523 ms 2588 KB Time limit exceeded
25 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 3 ms 344 KB Output is correct
16 Correct 4 ms 348 KB Output is correct
17 Correct 3 ms 348 KB Output is correct
18 Correct 3 ms 348 KB Output is correct
19 Correct 3 ms 348 KB Output is correct
20 Correct 3 ms 348 KB Output is correct
21 Correct 502 ms 600 KB Output is correct
22 Correct 525 ms 464 KB Output is correct
23 Correct 490 ms 464 KB Output is correct
24 Execution timed out 1523 ms 2588 KB Time limit exceeded
25 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 3 ms 344 KB Output is correct
16 Correct 4 ms 348 KB Output is correct
17 Correct 3 ms 348 KB Output is correct
18 Correct 3 ms 348 KB Output is correct
19 Correct 3 ms 348 KB Output is correct
20 Correct 3 ms 348 KB Output is correct
21 Correct 502 ms 600 KB Output is correct
22 Correct 525 ms 464 KB Output is correct
23 Correct 490 ms 464 KB Output is correct
24 Execution timed out 1523 ms 2588 KB Time limit exceeded
25 Halted 0 ms 0 KB -