Submission #735377

# Submission time Handle Problem Language Result Execution time Memory
735377 2023-05-04T04:51:39 Z keisuke6 Painting Walls (APIO20_paint) C++14
0 / 100
1 ms 212 KB
#include "paint.h"
#include <iostream>
#include <vector>
#include <map>
using namespace std;
int minimumInstructions(int N, int M, int K, vector<int> C,vector<int> A, vector<vector<int>> B){
  map<int,int> m;// c, p
  vector<int> AA(N);
  for(int i=0;i<M;i++){
    for(int x:B[i]){
      m[x] = i;
    }
  }
  for(int i=0;i<N;i++) AA[i] = m[C[i]];
  int ans = 1;
  for(int i=1;i<N;i++){
    if((A[i-1]+1)%M != AA[i]){
      ans++;
      if(N-M < i) return -1;
    } 
  }
  return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -