# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
236779 |
2020-06-03T09:41:16 Z |
topovik |
Vođe (COCI17_vode) |
C++14 |
|
3000 ms |
96376 KB |
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
using namespace std;
typedef long long ll;
typedef long double ld;
const ll oo = 1e9+7;
const ll N = 5000+2;
int dp[N][N];
int b[N];
int n,m,k;
int Rec(int x,int y)
{
if (dp[x][y]<oo) return dp[x][y];
int nx=(x+1)%n;
bool g0=0,g1=0;
for (int i=1; i<=k && i+y<=m; i++)
{
int c=Rec(nx,i+y);
g0=g0||(c==0);
g1=g1||(c==1);
}
if (b[x]==b[nx]) return dp[x][y]=g1;
else return dp[x][y]=g0;
}
int main()
{
cin>>n>>m>>k;
for (int i=0; i<n; i++) cin>>b[i];
m--;
for (int i=0; i<n; i++)
for (int j=1; j<m; j++) dp[i][j]=oo;
for (int i=0; i<n; i++)
{
bool g=0;
for (int j=1; j<=min(k,m); j++) g=g||Rec(i,j);
cout<<(g^b[i]^1)<<" ";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Incorrect |
5 ms |
640 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
1408 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
1536 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
24 ms |
2176 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
21 ms |
3072 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
2816 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
304 ms |
19448 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2638 ms |
38668 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3089 ms |
95608 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3084 ms |
96376 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |