Submission #28239

#TimeUsernameProblemLanguageResultExecution timeMemory
28239AcornCkiGuiziTeam (#68)Play Onwards (FXCUP2_onward)C++11
0 / 1
9 ms2256 KiB
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <memory.h> #include <math.h> #include <assert.h> #include <queue> #include <map> #include <set> #include <string> #include <algorithm> #include <iostream> #include <functional> #include <unordered_map> #include <unordered_set> #include <list> #include <bitset> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define pb(x) push_back(x) #define rep(i, n) for(int i=0;i<n;i++) #define all(x) x.begin(), x.end() #define sz(x) (int)(x).size() #define Fi first #define Se second char A[220][220]; int n, k; int E[220][220]; int L[220]; int color[220]; void dfs(int x, int c) { color[x] = c; rep(i, n) if(E[x][i]) { if(color[i] == 0) dfs(i, 3 - c); } } void solve() { scanf("%d%d", &n, &k); for(int i=0;i<n;i++) scanf("%s", A[i]); rep(i, n) L[i] = (int)strlen(A[i]); rep(i, n) rep(j, i){ for(int u=0;u<=L[i]-k;u++) { for(int v=0;v<=L[j]-k;v++){ int ok = 1; for(int a=0;a<k;a++) if(A[i][u+a] != A[j][v+a]) ok = 0; if(ok){ E[i][j] = E[j][i] = 1; break; } } if(E[i][j]) break; } } rep(i, n) if(color[i] == 0) { dfs(i, 1); } rep(i, n) rep(j, n) if(E[i][j] && color[i] == color[j]) { puts("No"); return; } puts("Yes"); rep(i, n) printf("%d\n", color[i]); } int main(){ int Tc = 1; //scanf("%d", &Tc); for(int tc=1;tc<=Tc;tc++) { // printf("Case #%d\n", tc); solve(); } return 0; };

Compilation message (stderr)

onward.cpp: In function 'void solve()':
onward.cpp:44:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &n, &k);
                       ^
onward.cpp:45:40: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=0;i<n;i++) scanf("%s", A[i]);
                                        ^
#Verdict Execution timeMemoryGrader output
Fetching results...