Submission #199945

#TimeUsernameProblemLanguageResultExecution timeMemory
199945mohammedehab2002Vođe (COCI17_vode)C++11
120 / 120
357 ms291960 KiB
#include <bits/stdc++.h> using namespace std; int a[5005],dp[5005][5005],nex[2][5005][5005]; int main() { int n,m,k; scanf("%d%d%d",&n,&m,&k); for (int i=0;i<n;i++) scanf("%d",&a[i]); m--; for (int i=0;i<n;i++) { nex[0][m][i]=m; nex[1][m][i]=1e9; } for (int i=m-1;i>=0;i--) { for (int j=0;j<n;j++) { nex[0][i][j]=nex[0][i+1][j]; nex[1][i][j]=nex[1][i+1][j]; if (a[j]==a[(j+1)%n]) { if (nex[1][i+1][(j+1)%n]<=i+k) dp[i][j]=1; } else { if (nex[0][i+1][(j+1)%n]<=i+k) dp[i][j]=1; } nex[dp[i][j]][i][j]=i; } } for (int i=0;i<n;i++) printf("%d ",(a[i]^dp[0][i]^1)); }

Compilation message (stderr)

vode.cpp: In function 'int main()':
vode.cpp:7:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d%d",&n,&m,&k);
  ~~~~~^~~~~~~~~~~~~~~~~~~
vode.cpp:9:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&a[i]);
  ~~~~~^~~~~~~~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...