# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
728213 | 2023-04-22T04:47:30 Z | vjudge1 | Zamjena (COCI18_zamjena) | C++17 | 526 ms | 8884 KB |
#include <bits/stdc++.h> #define sts stable_sort #define B begin() #define rB rbegin() #define E end() #define rE rend() #define F first #define S second #define pb push_back #define ppb pop_back() #define pf push_front #define ppf pop_front() #define eb emplace_back #define ll long long #define ui unsigned int #define ull unsigned long long using namespace std; const int MAXN = 1e6 + 4; const int MOD = 1e9 + 7; int to_int(string s){ int n = 0; for(int i = 0; i < s.size(); i++){ n *= 10; n += s[i] - '0'; } return n; } bool comp(string s){ if(s[0] - '0' > 9){ return 1; } return 0; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; vector<string> v(n); vector<string> b(n); map<string, string> m; for(int i = 0; i < n; i++){ cin >> v[i]; m[v[i]] = "-1"; } for(int i = 0; i < n; i++){ cin >> b[i]; m[b[i]] = "-1"; } while(true){ int cnt = 0; for(int i = 0; i < n; i++){ if(!comp(v[i]) && !comp(b[i]) && v[i] != b[i]){ cout << "NE\n"; return 0; } if(!comp(v[i]) && comp(b[i]) && m[b[i]] == "-1"){ cnt++; m[b[i]] = v[i]; }else if(!comp(b[i]) && comp(v[i]) && m[v[i]] == "-1"){ cnt++; m[v[i]] = b[i]; } } if(cnt == 0)break; for(int i = 0; i < n; i++){ if(m[v[i]] != "-1"){ v[i] = m[v[i]]; }else if(m[b[i]] != "-1"){ b[i] = m[b[i]]; } } } for(int i = 0; i < n; i++){ if(comp(v[i]) && comp(b[i]))continue; if(v[i] != b[i]){ cout << "NE\n"; return 0; } }cout << "DA\n"; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Incorrect | 1 ms | 212 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 340 KB | Output is correct |
2 | Correct | 3 ms | 452 KB | Output is correct |
3 | Correct | 6 ms | 712 KB | Output is correct |
4 | Correct | 8 ms | 832 KB | Output is correct |
5 | Correct | 10 ms | 724 KB | Output is correct |
6 | Correct | 6 ms | 724 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 22 ms | 1620 KB | Output is correct |
2 | Correct | 90 ms | 3180 KB | Output is correct |
3 | Correct | 84 ms | 5076 KB | Output is correct |
4 | Correct | 89 ms | 6096 KB | Output is correct |
5 | Correct | 526 ms | 8884 KB | Output is correct |
6 | Incorrect | 173 ms | 6108 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |