제출 #1085904

#제출 시각아이디문제언어결과실행 시간메모리
1085904lmaobruhZamjena (COCI18_zamjena)C++14
0 / 70
40 ms65536 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 = 1e6+5; int n, cnt = 0; string a[2][N]; vector<int> g[2][N]; bool vis[2][N]; bool allDigit(string &s) { for (char &c : s) if(c < '0' || c > '9') return 0; return 1; } void dfs(int u, int f) { vis[f][u] = 1; cnt += allDigit(a[f][u]); for (int v : g[f][u]) if (!vis[f^1][v]) dfs(v, f^1); } 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[0][i]; fo(i, 1, n) cin >> a[1][i]; fo(i, 1, n) if (a[0][i] != a[1][i]) g[0][i].pb(i), g[1][i].pb(i); fo(i, 1, n) if (!vis[0][i]) { cnt = 0; dfs(i, 0); if (cnt > 1) { cout << "NE"; return 0; } } cout << "DA"; }

컴파일 시 표준 에러 (stderr) 메시지

zamjena.cpp: In function 'int32_t main()':
zamjena.cpp:33:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   33 |         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...