# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
236773 |
2020-06-03T09:28:08 Z |
topovik |
Vođe (COCI17_vode) |
C++14 |
|
3000 ms |
96380 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];
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++) dp[i][m]=1;
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 |
8 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 |
22 ms |
3072 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
2688 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
299 ms |
19448 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2605 ms |
38684 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3064 ms |
95608 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3080 ms |
96380 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |