Submission #426388

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
4263882021-06-13 22:28:24SuhaibSawalha1Paint By Numbers (IOI16_paint)C++17
100 / 100
874 ms94576 KiB
#include "paint.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5, M = 100;
int canb[3 * N], canw[3 * N], dp[N][M], n, m, cnt[N];
vector<int> c;
string s;
bool calc (int i = 0, int j = 0) {
if (i >= n) {
return j == m;
}
int &ret = dp[i][j];
if (~ret) {
return ret;
}
ret = 0;
if (s[i] != 'X' && calc(i + 1, j)) {
canw[i] = ret = 1;
}
if (j != m && cnt[i] >= c[j] && s[i] != '_' && (i + c[j] >= n || s[i + c[j]] != 'X') && calc(i + c[j] + 1, j + 1)) {
ret = 1;
++canb[i];
--canb[i + c[j]];
canw[i + c[j]] = 1;
}
return ret;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...