Submission #933756

#TimeUsernameProblemLanguageResultExecution timeMemory
933756panVlak (COCI20_vlak)C++17
70 / 70
29 ms85340 KiB
#include <bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> //#include "bits_stdc++.h" #define f first #define s second #define pb push_back #define mp make_pair #define lb lower_bound #define ub upper_bound #define input(x) scanf("%lld", &x); #define input2(x, y) scanf("%lld%lld", &x, &y); #define input3(x, y, z) scanf("%lld%lld%lld", &x, &y, &z); #define input4(x, y, z, a) scanf("%lld%lld%lld%lld", &x, &y, &z, &a); #define print(x, y) printf("%lld%c", x, y); #define show(x) cerr << #x << " is " << x << endl; #define show2(x,y) cerr << #x << " is " << x << " " << #y << " is " << y << endl; #define show3(x,y,z) cerr << #x << " is " << x << " " << #y << " is " << y << " " << #z << " is " << z << endl; #define discretize(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end()); using namespace std; //using namespace __gnu_pbds; //#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> //#define ordered_multiset tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> typedef long long ll; typedef long double ld; typedef pair<ld, ll> pd; typedef pair<string, ll> psl; typedef pair<ll, ll> pi; typedef pair<ll, pi> pii; ll tries[200005][26]; ll ending[200005][2]; ll dp[200005][26]; ll label = 0; void insert(string word, ll of) { ll now = 0; for (char c: word) { if (tries[now][c-'a']==-1) tries[now][c-'a'] = ++label; now = tries[now][c-'a']; } ending[now][of]++; } void dfs(ll from, ll of) { if (dp[from][of]!=-1) return; bool can = false; for (ll i=0; i<26; ++i) { if (tries[from][i]==-1) continue; dfs(tries[from][i], (1-of)%2); for (ll k=0; k<2; ++k) ending[from][k]+=ending[tries[from][i]][k]; if (ending[tries[from][i]][of]==0) continue; can = (can || (dp[tries[from][i]][(1-of)%2]==0)); } dp[from][of] = can; } int main() { ll n, m; string word; input(n); for (ll i=0; i<200005; ++i) for (ll j=0; j<26; ++j) {tries[i][j] = -1; dp[i][j] = -1;} for (ll i=0; i<200005; ++i) for (ll j=0; j<2; ++j) ending[i][j] = 0; for (ll i=0; i<n; ++i) { cin >> word; insert(word, 0); } input(m); for (ll i=0; i<m; ++i) { cin >> word; insert(word, 1); } dfs(0, 0); if (dp[0][0]) cout << "Nina" << endl; else cout << "Emilija" << endl; return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:11:23: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 | #define input(x) scanf("%lld", &x);
      |                  ~~~~~^~~~~~~~~~~~
Main.cpp:64:2: note: in expansion of macro 'input'
   64 |  input(n);
      |  ^~~~~
Main.cpp:11:23: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 | #define input(x) scanf("%lld", &x);
      |                  ~~~~~^~~~~~~~~~~~
Main.cpp:72:2: note: in expansion of macro 'input'
   72 |  input(m);
      |  ^~~~~
#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...