Submission #198601

#TimeUsernameProblemLanguageResultExecution timeMemory
198601ZwariowanyMarcinVođe (COCI17_vode)C++14
120 / 120
239 ms504 KiB
#include <bits/stdc++.h> #define fi first #define se second #define mp make_pair #define ss(x) (int) x.size() #define pb push_back #define LL long long #define ld long double #define cat(x) cerr << #x << " = " << x << endl #define FOR(i, j, n) for(int i = j; i <= n; ++i) #define boost cin.tie(0), ios_base::sync_with_stdio(0); using namespace std; const int nax = 5010; const int INF = 1e9 + 111; int n, m, k; int a[nax]; int win[nax]; int lose[nax]; int dp[nax]; int main() { scanf ("%d%d%d", &n, &m, &k); for (int i = 0; i < n; ++i) { scanf ("%d", a + i); win[i] = INF; lose[i] = m - 1; } for (int i = m - 2; 0 <= i; --i) { for (int j = 0; j < n; ++j) { int g = (j + 1) % n; if (a[j] == a[g]) { if (win[g] <= i + k) { dp[j] = 1; } else { dp[j] = 0; } } else { if (lose[g] <= i + k) { dp[j] = 1; } else { dp[j] = 0; } } } for (int j = 0; j < n; ++j) { if (dp[j]) win[j] = i; else lose[j] = i; } } for (int i = 0; i < n; ++i) { if ((a[i] == 0 && dp[i] == 1) || (a[i] == 1 && dp[i] == 0)) printf ("0 "); else printf ("1 "); } return 0; }

Compilation message (stderr)

vode.cpp: In function 'int main()':
vode.cpp:26:8: 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:28:9: 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...