Submission #743693

# Submission time Handle Problem Language Result Execution time Memory
743693 2023-05-17T17:48:22 Z speedyArda Painting Walls (APIO20_paint) C++14
12 / 100
55 ms 13648 KB
#include "paint.h"
#include <vector>
#include "bits/stdc++.h"

using namespace std;
const int MAXN = 1e5+5;
vector< vector< int > > colors(MAXN);

int minimumInstructions(int N, int M, int K, vector<int> C, vector<int> A, vector< vector<int> > B) {
  for(int i = 0; i < M; i++)
  {
    for(int a = 0; a < A[i]; a++)
    {
      colors[B[i][a]].push_back(i);
    }
  }
  int max_color = 0;
  for(int i = 0; i < K; i++)
  {
    max_color = max(max_color, (int)colors[i].size());
  }

  if(max_color <= 1) // Sub 1
  {
    if(colors[C[0]].size() == 0)
      return -1;
    int curr = (colors[C[0]][0] + 1) % M;
    for(int i = 1; i < N; i++)
    {
      if(colors[C[i]].empty() || colors[C[i]][0] != curr)
        return -1;
      curr++;
      curr %= M;
    }

    return ((N + (M - 1)) / M);
  } else {

  }
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
4 Correct 2 ms 2660 KB Output is correct
5 Correct 2 ms 2644 KB Output is correct
6 Correct 2 ms 2660 KB Output is correct
7 Correct 2 ms 2644 KB Output is correct
8 Correct 2 ms 2656 KB Output is correct
9 Correct 2 ms 2644 KB Output is correct
10 Correct 2 ms 2644 KB Output is correct
11 Correct 2 ms 2644 KB Output is correct
12 Correct 2 ms 2656 KB Output is correct
13 Correct 2 ms 2664 KB Output is correct
14 Correct 2 ms 2644 KB Output is correct
15 Correct 2 ms 2660 KB Output is correct
16 Correct 2 ms 2668 KB Output is correct
17 Correct 2 ms 2664 KB Output is correct
18 Correct 2 ms 2644 KB Output is correct
19 Correct 2 ms 2644 KB Output is correct
20 Correct 3 ms 2668 KB Output is correct
21 Correct 2 ms 2644 KB Output is correct
22 Correct 20 ms 7152 KB Output is correct
23 Correct 20 ms 7064 KB Output is correct
24 Correct 18 ms 7132 KB Output is correct
25 Correct 3 ms 2772 KB Output is correct
26 Correct 3 ms 2772 KB Output is correct
27 Correct 3 ms 2772 KB Output is correct
28 Correct 3 ms 2800 KB Output is correct
29 Correct 4 ms 2772 KB Output is correct
30 Correct 3 ms 2772 KB Output is correct
31 Correct 10 ms 3952 KB Output is correct
32 Correct 10 ms 3948 KB Output is correct
33 Correct 9 ms 3924 KB Output is correct
34 Correct 11 ms 3876 KB Output is correct
35 Correct 10 ms 3872 KB Output is correct
36 Correct 8 ms 3924 KB Output is correct
37 Correct 20 ms 7504 KB Output is correct
38 Correct 19 ms 7536 KB Output is correct
39 Correct 23 ms 7500 KB Output is correct
40 Correct 8 ms 3452 KB Output is correct
41 Correct 5 ms 3184 KB Output is correct
42 Correct 9 ms 3540 KB Output is correct
43 Correct 6 ms 3284 KB Output is correct
44 Correct 6 ms 3156 KB Output is correct
45 Correct 8 ms 3572 KB Output is correct
46 Correct 36 ms 12700 KB Output is correct
47 Correct 22 ms 8268 KB Output is correct
48 Correct 27 ms 10844 KB Output is correct
49 Correct 32 ms 11212 KB Output is correct
50 Correct 38 ms 10892 KB Output is correct
51 Correct 28 ms 8608 KB Output is correct
52 Correct 12 ms 3540 KB Output is correct
53 Correct 9 ms 3556 KB Output is correct
54 Correct 9 ms 3540 KB Output is correct
55 Correct 10 ms 3632 KB Output is correct
56 Correct 8 ms 3544 KB Output is correct
57 Correct 8 ms 3632 KB Output is correct
58 Correct 40 ms 13616 KB Output is correct
59 Correct 39 ms 13544 KB Output is correct
60 Correct 55 ms 13648 KB Output is correct
61 Correct 44 ms 13584 KB Output is correct
62 Correct 40 ms 13644 KB Output is correct
63 Correct 42 ms 13644 KB Output is correct
64 Correct 41 ms 12880 KB Output is correct
65 Correct 42 ms 12816 KB Output is correct
66 Correct 46 ms 12824 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
4 Correct 2 ms 2660 KB Output is correct
5 Correct 2 ms 2644 KB Output is correct
6 Correct 2 ms 2660 KB Output is correct
7 Correct 2 ms 2644 KB Output is correct
8 Correct 2 ms 2656 KB Output is correct
9 Correct 2 ms 2644 KB Output is correct
10 Correct 2 ms 2644 KB Output is correct
11 Correct 2 ms 2644 KB Output is correct
12 Correct 2 ms 2656 KB Output is correct
13 Correct 2 ms 2664 KB Output is correct
14 Correct 2 ms 2644 KB Output is correct
15 Correct 2 ms 2660 KB Output is correct
16 Correct 2 ms 2668 KB Output is correct
17 Correct 2 ms 2664 KB Output is correct
18 Correct 2 ms 2644 KB Output is correct
19 Correct 2 ms 2644 KB Output is correct
20 Correct 3 ms 2668 KB Output is correct
21 Correct 2 ms 2644 KB Output is correct
22 Incorrect 2 ms 2644 KB Output isn't correct
23 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -