# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
145138 | 2019-08-18T21:29:08 Z | Sarah_Mokhtar | Zamjena (COCI18_zamjena) | C++14 | 15 ms | 6776 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N=1e5+20,M=(N<<4),OO=1e9; #define f first #define s second #define pb push_back #define sz size #define l length ll n; string str,A[N],B[N]; map<string,int>m; bool isNumber(string c){ char cmp=c[0]; return cmp>='0'&&cmp<='9'; } bool valid(){ for(int i=0;i<n;++i){ if(isNumber(A[i])&&isNumber(B[i])) if(A[i]!=B[i]) return 0; else if(isNumber(A[i])&&!m[B[i]]) m[B[i]]=stoi(A[i]); else if(isNumber(B[i])&&!m[A[i]]) m[A[i]]=stoi(B[i]); else if(isNumber(A[i])&&m[B[i]]) if(m[B[i]]!=stoi(A[i])) return 0; else if(isNumber(B[i])&&m[A[i]]) if(m[A[i]]!=stoi(B[i])) return 0; } return 1; } int main(){ cin>>n; for(int i=0;i<n;++i) cin>>A[i]; for(int i=0;i<n;++i) cin>>B[i]; puts(valid()?"DA":"NE"); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 6776 KB | Output is correct |
2 | Correct | 9 ms | 6520 KB | Output is correct |
3 | Correct | 8 ms | 6648 KB | Output is correct |
4 | Correct | 9 ms | 6648 KB | Output is correct |
5 | Correct | 9 ms | 6652 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 6648 KB | Output is correct |
2 | Incorrect | 10 ms | 6648 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 6648 KB | Output is correct |
2 | Correct | 9 ms | 6648 KB | Output is correct |
3 | Incorrect | 9 ms | 6520 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 6520 KB | Output is correct |
2 | Correct | 8 ms | 6520 KB | Output is correct |
3 | Incorrect | 10 ms | 6652 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 15 ms | 6648 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |