답안 #717161

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
717161 2023-04-01T10:05:49 Z LittleCube 벽 칠하기 (APIO20_paint) C++14
0 / 100
1500 ms 2132 KB
#include "paint.h"
#ifndef EVAL
#include "grader.cpp"
#endif
#include <bits/stdc++.h>
#define pii pair<int, int>
#define F first
#define S second
using namespace std;

int minimumInstructions(
    int N, int M, int K, vector<int> C,
    vector<int> A, vector<vector<int>> B)
{

  auto match = [&](int i, int j)
  {
    // auto iter = lower_bound(B[j].begin(), B[j].end(), C[i]);
    // if(iter != B[j].end() && *iter == )
    for (int c = 0; c < A[j]; c++)
      if (C[i] == B[j][c])
        return 1;
    return 0;
  };
  vector<int> cover(N, 0), dp(N, 0);
  for (int x = 0; x < M; x++)
  {
    int cnt = 0;
    for (int y = 0; y < M; y++)
      cnt += match(y, (x + y) % M);
    for (int y = 0; y < N - M; y++)
    {
      cover[y] |= (cnt == M);
      cnt -= match(y, (x + y) % M);
      cnt += match(y + M, (x + y + M) % M);
    }
    cover[N - M] |= (cnt == M);
  }
  for (int i = 0; i < N; i++)
  {
    dp[i] = (cover[i] ? i : (i ? dp[i - 1] : 0));
  }
  int cur = 0, ans = 0;
  for (int i = 0; i < N; i++)
    if (cur < N)
      cur = max(cur, dp[cur] + M), ans++;
  return (cur < N ? -1 : ans);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 2 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 3 ms 212 KB Output is correct
20 Correct 2 ms 212 KB Output is correct
21 Correct 2 ms 212 KB Output is correct
22 Correct 41 ms 980 KB Output is correct
23 Correct 39 ms 1048 KB Output is correct
24 Correct 41 ms 1084 KB Output is correct
25 Correct 2 ms 596 KB Output is correct
26 Correct 2 ms 596 KB Output is correct
27 Correct 3 ms 596 KB Output is correct
28 Correct 3 ms 596 KB Output is correct
29 Correct 3 ms 596 KB Output is correct
30 Correct 4 ms 596 KB Output is correct
31 Correct 661 ms 888 KB Output is correct
32 Correct 642 ms 1132 KB Output is correct
33 Correct 658 ms 1116 KB Output is correct
34 Correct 650 ms 1108 KB Output is correct
35 Correct 641 ms 1120 KB Output is correct
36 Correct 641 ms 1132 KB Output is correct
37 Execution timed out 1572 ms 2132 KB Time limit exceeded
38 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 2 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 3 ms 212 KB Output is correct
20 Correct 2 ms 212 KB Output is correct
21 Correct 2 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Incorrect 0 ms 212 KB Output isn't correct
26 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 2 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 3 ms 212 KB Output is correct
22 Correct 2 ms 212 KB Output is correct
23 Correct 2 ms 212 KB Output is correct
24 Correct 41 ms 980 KB Output is correct
25 Correct 39 ms 1048 KB Output is correct
26 Correct 41 ms 1084 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Incorrect 0 ms 212 KB Output isn't correct
29 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 2 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 3 ms 212 KB Output is correct
22 Correct 2 ms 212 KB Output is correct
23 Correct 2 ms 212 KB Output is correct
24 Correct 41 ms 980 KB Output is correct
25 Correct 39 ms 1048 KB Output is correct
26 Correct 41 ms 1084 KB Output is correct
27 Correct 2 ms 596 KB Output is correct
28 Correct 2 ms 596 KB Output is correct
29 Correct 3 ms 596 KB Output is correct
30 Correct 3 ms 596 KB Output is correct
31 Correct 3 ms 596 KB Output is correct
32 Correct 4 ms 596 KB Output is correct
33 Correct 661 ms 888 KB Output is correct
34 Correct 642 ms 1132 KB Output is correct
35 Correct 658 ms 1116 KB Output is correct
36 Correct 650 ms 1108 KB Output is correct
37 Correct 641 ms 1120 KB Output is correct
38 Correct 641 ms 1132 KB Output is correct
39 Execution timed out 1572 ms 2132 KB Time limit exceeded
40 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 2 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 3 ms 212 KB Output is correct
22 Correct 2 ms 212 KB Output is correct
23 Correct 2 ms 212 KB Output is correct
24 Correct 41 ms 980 KB Output is correct
25 Correct 39 ms 1048 KB Output is correct
26 Correct 41 ms 1084 KB Output is correct
27 Correct 2 ms 596 KB Output is correct
28 Correct 2 ms 596 KB Output is correct
29 Correct 3 ms 596 KB Output is correct
30 Correct 3 ms 596 KB Output is correct
31 Correct 3 ms 596 KB Output is correct
32 Correct 4 ms 596 KB Output is correct
33 Correct 661 ms 888 KB Output is correct
34 Correct 642 ms 1132 KB Output is correct
35 Correct 658 ms 1116 KB Output is correct
36 Correct 650 ms 1108 KB Output is correct
37 Correct 641 ms 1120 KB Output is correct
38 Correct 641 ms 1132 KB Output is correct
39 Execution timed out 1572 ms 2132 KB Time limit exceeded
40 Halted 0 ms 0 KB -