Submission #395562

# Submission time Handle Problem Language Result Execution time Memory
395562 2021-04-28T14:11:41 Z Sugardorj Painting Walls (APIO20_paint) C++14
0 / 100
1 ms 204 KB
#include "paint.h"
#include <bits/stdc++.h>
using namespace std;
int  i,j,s,t;
int c[234567],a[234567],l=12345678,r,tt,k,y,z,n,m,x;

int minimumInstructions(int n, int m, int K, vector<int> C,vector<int> A,       vector<vector<int>> B){
    for (i = 0; i <m; i ++){
        for (auto u:B[i]){
            a[u]=i;
        }
    }
    t= 0;
    while (t<n){
        x = a[C[t]];
        k = 0;
        for (i = t; i<n; i ++){
            if (a[C[i]]!=(x+i-t)%m){
                y=i;
                break;
            }
        }
        if (i==n){
            if (n-t<m)
                return -1;
            s+=(n-t+m-1)/m;
            break;
        }
        if (y-t<m)
            return -1;
        s+=(y-t+m-1)/m;
        t=y;
    }
    return s;

}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -