Submission #343504

# Submission time Handle Problem Language Result Execution time Memory
343504 2021-01-04T04:20:12 Z blue Painting Walls (APIO20_paint) C++11
0 / 100
1 ms 384 KB
#include "paint.h"
#include <vector>
using namespace std;

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

    vector<int> contract(K, -1);
    for(int i = 0; i < M; i++) for(int q: B[i]) contract[q] = i;

    int res = 0, count = 0;
    if(contract[C[0]] == -1) return -1;

    res++;
    count++;
    for(int i = 1; i < N; i++)
    {
        if(contract[C[i]] % M != (contract[C[i-1]] + 1) % M || count == M)
        {
            res++;
            count = 1;
        }
        else count++;
    }

    return res;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Incorrect 0 ms 364 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -