# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
397904 | ZikXewen | Painting Walls (APIO20_paint) | C++17 | 1566 ms | 14244 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "paint.h"
#include <bits/stdc++.h>
using namespace std;
int minimumInstructions( int N, int M, int K, vector<int> C, vector<int> A, vector<vector<int>> B) {
auto md = [=](int u){return ((u % M) + M) % M;};
vector<vector<int>> f(K);
vector<int> mem(M), an;
for(int i = 0; i < M; ++i) for(int j: B[i]) f[j].emplace_back(i);
for(int i = 0, ct = 0, tem; i < N; ++i) {
if(i >= M) for(int j: f[C[i - M]]) if(--mem[md(j - i)] == M - 1) --ct;
for(int j: f[C[i]]) if(++mem[md(j - i)] == M) ++ct;
if(ct) an.emplace_back(i);
}
if(an.empty() or upper_bound(an.begin(), an.end(), M - 1) == an.begin()) return -1;
for(int i = -1, ct = 1, tem;; i = tem, ++ct){
tem = *(upper_bound(an.begin(), an.end(), i + M) - 1);
if(tem == N - 1) return ct;
if(tem == i) return -1;
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |