답안 #155425

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
155425 2019-09-28T03:42:16 Z Nordway Zamjena (COCI18_zamjena) C++14
28 / 70
18 ms 4088 KB
#include <bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define up_b upper_bound
#define low_b lower_bound
#define sz(x) (int)x.size()
#define all(v) v.begin(),v.end()

#define boost ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
typedef pair<ll,ll> pll;

const ll INF=1e18;
const int inf = 2e9;
const ld eps=1e-7;
const ld pi = acos(-1);
const int dx[4]={0,0 ,1,-1};
const int dy[4]={1,-1,0,0};
const int N=5e4+11;
const int M=21;
const int mod=1e9+7;

map<string,string>d;
string a[N],b[N];

int main(){
  int n;
  cin>>n;
  for(int i=1;i<=n;i++){
    cin>>a[i];
  }
  for(int i=1;i<=n;i++){
    cin>>b[i];
    if(isalpha(a[i][0])){
      if(!isalpha(b[i][0])){
        d[b[i]]=b[i];
        if(d[a[i]]==""){
          d[a[i]]=b[i];
        }
      }
    }
    else{
      d[a[i]]=a[i];
      if(isalpha(b[i][0])){
        if(d[b[i]]==""){
          d[b[i]]=a[i];
        }
      }
      else{
        d[b[i]]=b[i];
        if(a[i]!=b[i]){
          cout<<"NE";
          return 0;
        }
      }
    }
  }
  for(int i=1;i<=n;i++){
    if(d[a[i]]!=d[b[i]]&&d[a[i]]!=""&&d[b[i]]!=""){
      cout<<"NE";
      return 0;
    }
  }
  cout<<"DA";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 3448 KB Output is correct
2 Correct 5 ms 3448 KB Output is correct
3 Correct 5 ms 3448 KB Output is correct
4 Correct 5 ms 3448 KB Output is correct
5 Correct 5 ms 3448 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 3448 KB Output is correct
2 Correct 5 ms 3448 KB Output is correct
3 Correct 5 ms 3448 KB Output is correct
4 Correct 5 ms 3448 KB Output is correct
5 Correct 5 ms 3448 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 3448 KB Output is correct
2 Correct 5 ms 3448 KB Output is correct
3 Correct 5 ms 3448 KB Output is correct
4 Correct 5 ms 3448 KB Output is correct
5 Correct 5 ms 3476 KB Output is correct
6 Incorrect 5 ms 3524 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 3448 KB Output is correct
2 Correct 6 ms 3576 KB Output is correct
3 Incorrect 9 ms 3704 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 18 ms 4088 KB Output isn't correct
2 Halted 0 ms 0 KB -