Submission #1085907

#TimeUsernameProblemLanguageResultExecution timeMemory
1085907lmaobruhZamjena (COCI18_zamjena)C++14
70 / 70
114 ms16380 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define fo(i, a, b) for (int i = (a); i <= (b); ++i) #define fd(i, a, b) for (int i = (a); i >= (b); --i) #define ii pair<int, int> #define fi first #define se second #define pb push_back #define all(x) x.begin(), x.end() const int N = 50050; int n, cnt = 0; string a[N], b[N]; map<string, bool> vis; map<string, vector<string>> g; bool allDigit(string &s) { for (char c : s) if(c < '0' || c > '9') return 0; return 1; } void dfs(string &u) { vis[u] = 1; cnt += allDigit(u); for (string &v : g[u]) if (!vis[v]) dfs(v); } int32_t main() { cin.tie(0)->sync_with_stdio(0); if (fopen("A.inp", "r")) { freopen("A.inp", "r", stdin); // freopen("A.out", "w", stdout); } cin >> n; fo(i, 1, n) cin >> a[i]; fo(i, 1, n) cin >> b[i]; fo(i, 1, n) if (a[i] != b[i]) g[a[i]].pb(b[i]), g[b[i]].pb(a[i]); fo(i, 1, n) if (!vis[a[i]]) { cnt = 0; dfs(a[i]); if (cnt > 1) { cout << "NE"; return 0; } } cout << "DA"; }

Compilation message (stderr)

zamjena.cpp: In function 'int32_t main()':
zamjena.cpp:32:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |         freopen("A.inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
#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...